2 from __future__ import unicode_literals
4 from .common import InfoExtractor
11 class TVCEmbedIE(InfoExtractor):
12 _VALID_URL = r'http://(?:www\.)?tvc\.ru/video/iframe/id/(?P<id>\d+)'
14 'url': 'http://www.tvc.ru/video/iframe/id/74622/isPlay/false/id_stat/channel/?acc_video_id=/channel/brand/id/17/show/episodes/episode_id/39702',
15 'md5': 'bbc5ff531d1e90e856f60fc4b3afd708',
19 'title': 'События. "События". Эфир от 22.05.2015 14:30',
20 'thumbnail': 're:^https?://.*\.jpg$',
25 def _real_extract(self, url):
26 video_id = self._match_id(url)
28 video = self._download_json(
29 'http://www.tvc.ru/video/json/id/%s' % video_id, video_id)
32 for info in video.get('path', {}).get('quality', []):
33 video_url = info.get('url')
36 format_id = self._search_regex(
37 r'cdnvideo/([^/]+?)(?:-[^/]+?)?/', video_url,
38 'format id', default=None)
41 'format_id': format_id,
42 'width': int_or_none(info.get('width')),
43 'height': int_or_none(info.get('height')),
44 'tbr': int_or_none(info.get('bitrate')),
46 self._sort_formats(formats)
50 'title': video['title'],
51 'thumbnail': video.get('picture'),
52 'duration': int_or_none(video.get('duration')),
57 class TVCIE(InfoExtractor):
58 _VALID_URL = r'http://(?:www\.)?tvc\.ru/(?!video/iframe/id/)(?P<id>[^?#]+)'
60 'url': 'http://www.tvc.ru/channel/brand/id/29/show/episodes/episode_id/39702/',
64 'title': 'События. "События". Эфир от 22.05.2015 14:30',
65 'description': 'md5:ad7aa7db22903f983e687b8a3e98c6dd',
66 'thumbnail': 're:^https?://.*\.jpg$',
70 'url': 'http://www.tvc.ru/news/show/id/69944',
74 'title': 'Эксперты: в столице встал вопрос о максимально безопасных остановках',
75 'description': 'md5:f2098f71e21f309e89f69b525fd9846e',
76 'thumbnail': 're:^https?://.*\.jpg$',
80 'url': 'http://www.tvc.ru/channel/brand/id/47/show/episodes#',
84 'title': 'Ещё не поздно. Эфир от 03.08.2013',
85 'description': 'md5:51fae9f3f8cfe67abce014e428e5b027',
86 'thumbnail': 're:^https?://.*\.jpg$',
91 def _real_extract(self, url):
92 webpage = self._download_webpage(url, self._match_id(url))
94 '_type': 'url_transparent',
96 'url': self._og_search_video_url(webpage),
97 'title': clean_html(self._og_search_title(webpage)),
98 'description': clean_html(self._og_search_description(webpage)),
99 'thumbnail': self._og_search_thumbnail(webpage),