2015-06-08 02:58:41 +00:00
|
|
|
|
# coding: utf-8
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
2015-06-12 11:48:42 +00:00
|
|
|
|
|
2015-06-08 02:58:41 +00:00
|
|
|
|
from .common import InfoExtractor
|
2015-06-12 11:48:42 +00:00
|
|
|
|
from ..utils import int_or_none
|
2015-06-08 02:58:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FiveTVIE(InfoExtractor):
|
2015-06-12 11:48:42 +00:00
|
|
|
|
_VALID_URL = r'''(?x)
|
2019-07-11 22:09:09 +00:00
|
|
|
|
https?://
|
2015-06-12 11:48:42 +00:00
|
|
|
|
(?:www\.)?5-tv\.ru/
|
|
|
|
|
(?:
|
|
|
|
|
(?:[^/]+/)+(?P<id>\d+)|
|
|
|
|
|
(?P<path>[^/?#]+)(?:[/?#])?
|
|
|
|
|
)
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
|
'url': 'http://5-tv.ru/news/96814/',
|
|
|
|
|
'md5': 'bbff554ad415ecf5416a2f48c22d9283',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '96814',
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
'title': 'Россияне выбрали имя для общенациональной платежной системы',
|
|
|
|
|
'description': 'md5:a8aa13e2b7ad36789e9f77a74b6de660',
|
2017-01-02 12:08:07 +00:00
|
|
|
|
'thumbnail': r're:^https?://.*\.jpg$',
|
2015-06-12 11:48:42 +00:00
|
|
|
|
'duration': 180,
|
2015-06-08 02:58:41 +00:00
|
|
|
|
},
|
2015-06-12 11:48:42 +00:00
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://5-tv.ru/video/1021729/',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '1021729',
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
'title': '3D принтер',
|
|
|
|
|
'description': 'md5:d76c736d29ef7ec5c0cf7d7c65ffcb41',
|
2017-01-02 12:08:07 +00:00
|
|
|
|
'thumbnail': r're:^https?://.*\.jpg$',
|
2015-06-12 11:48:42 +00:00
|
|
|
|
'duration': 180,
|
2015-06-08 02:58:41 +00:00
|
|
|
|
},
|
2015-06-12 11:48:42 +00:00
|
|
|
|
}, {
|
2019-07-11 22:09:09 +00:00
|
|
|
|
# redirect to https://www.5-tv.ru/projects/1000095/izvestia-glavnoe/
|
2015-06-12 11:48:42 +00:00
|
|
|
|
'url': 'http://www.5-tv.ru/glavnoe/#itemDetails',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': 'glavnoe',
|
|
|
|
|
'ext': 'mp4',
|
2017-07-14 15:10:17 +00:00
|
|
|
|
'title': r're:^Итоги недели с \d+ по \d+ \w+ \d{4} года$',
|
2017-01-02 12:08:07 +00:00
|
|
|
|
'thumbnail': r're:^https?://.*\.jpg$',
|
2015-06-12 11:48:42 +00:00
|
|
|
|
},
|
2019-07-11 22:09:09 +00:00
|
|
|
|
'skip': 'redirect to «Известия. Главное» project page',
|
2015-06-12 11:48:42 +00:00
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://www.5-tv.ru/glavnoe/broadcasts/508645/',
|
|
|
|
|
'only_matching': True,
|
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://5-tv.ru/films/1507502/',
|
|
|
|
|
'only_matching': True,
|
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://5-tv.ru/programs/broadcast/508713/',
|
|
|
|
|
'only_matching': True,
|
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://5-tv.ru/angel/',
|
|
|
|
|
'only_matching': True,
|
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://www.5-tv.ru/schedule/?iframe=true&width=900&height=450',
|
|
|
|
|
'only_matching': True,
|
|
|
|
|
}]
|
2015-06-08 02:58:41 +00:00
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2021-08-19 01:41:24 +00:00
|
|
|
|
mobj = self._match_valid_url(url)
|
2015-06-12 11:48:42 +00:00
|
|
|
|
video_id = mobj.group('id') or mobj.group('path')
|
2015-06-08 02:58:41 +00:00
|
|
|
|
|
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
|
|
2015-06-12 11:48:42 +00:00
|
|
|
|
video_url = self._search_regex(
|
2019-07-11 22:09:09 +00:00
|
|
|
|
[r'<div[^>]+?class="(?:flow)?player[^>]+?data-href="([^"]+)"',
|
2017-07-14 15:10:17 +00:00
|
|
|
|
r'<a[^>]+?href="([^"]+)"[^>]+?class="videoplayer"'],
|
2015-06-12 11:48:42 +00:00
|
|
|
|
webpage, 'video url')
|
2015-06-08 02:58:41 +00:00
|
|
|
|
|
2022-04-04 08:27:35 +00:00
|
|
|
|
title = self._og_search_title(webpage, default=None) or self._html_extract_title(webpage)
|
2015-06-08 02:58:41 +00:00
|
|
|
|
duration = int_or_none(self._og_search_property(
|
2015-06-12 11:48:42 +00:00
|
|
|
|
'video:duration', webpage, 'duration', default=None))
|
|
|
|
|
|
2015-06-08 02:58:41 +00:00
|
|
|
|
return {
|
|
|
|
|
'id': video_id,
|
2015-06-12 11:48:42 +00:00
|
|
|
|
'url': video_url,
|
|
|
|
|
'title': title,
|
|
|
|
|
'description': self._og_search_description(webpage, default=None),
|
|
|
|
|
'thumbnail': self._og_search_thumbnail(webpage, default=None),
|
2015-06-08 02:58:41 +00:00
|
|
|
|
'duration': duration,
|
|
|
|
|
}
|