]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tvc.py
3a4f393fcf6d79f3f42970db7aab853d5efedf84
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class TVCIE(InfoExtractor
):
14 _VALID_URL
= r
'http://(?:www\.)?tvc\.ru/video/iframe/id/(?P<id>\d+)'
16 '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',
17 'md5': 'bbc5ff531d1e90e856f60fc4b3afd708',
21 'title': 'События. "События". Эфир от 22.05.2015 14:30',
22 'thumbnail': 're:^https?://.*\.jpg$',
28 def _extract_url(cls
, webpage
):
30 r
'<iframe[^>]+?src=(["\'])(?P
<url
>(?
:http
:)?
//(?
:www\
.)?tvc\
.ru
/video
/iframe
/id/[^
"]+)\1', webpage)
32 return mobj.group('url')
34 def _real_extract(self, url):
35 video_id = self._match_id(url)
37 video = self._download_json(
38 'http://www.tvc.ru/video/json/id/%s' % video_id, video_id)
41 for info in video.get('path', {}).get('quality', []):
42 video_url = info.get('url')
45 format_id = self._search_regex(
46 r'cdnvideo/([^/]+?)(?:-[^/]+?)?/', video_url,
47 'format id', default=None)
50 'format_id': format_id,
51 'width': int_or_none(info.get('width')),
52 'height': int_or_none(info.get('height')),
53 'tbr': int_or_none(info.get('bitrate')),
55 self._sort_formats(formats)
59 'title': video['title'],
60 'thumbnail': video.get('picture'),
61 'duration': int_or_none(video.get('duration')),
66 class TVCArticleIE(InfoExtractor):
67 _VALID_URL = r'http://(?:www\.)?tvc\.ru/(?!video/iframe/id/)(?P<id>[^?#]+)'
69 'url': 'http://www.tvc.ru/channel/brand/id/29/show/episodes/episode_id/39702/',
73 'title': 'События. "События
". Эфир от 22.05.2015 14:30',
74 'description': 'md5:ad7aa7db22903f983e687b8a3e98c6dd',
75 'thumbnail': 're:^https?://.*\.jpg$',
79 'url': 'http://www.tvc.ru/news/show/id/69944',
83 'title': 'Эксперты: в столице встал вопрос о максимально безопасных остановках',
84 'description': 'md5:f2098f71e21f309e89f69b525fd9846e',
85 'thumbnail': 're:^https?://.*\.jpg$',
89 'url': 'http://www.tvc.ru/channel/brand/id/47/show/episodes#',
93 'title': 'Ещё не поздно. Эфир от 03.08.2013',
94 'description': 'md5:51fae9f3f8cfe67abce014e428e5b027',
95 'thumbnail': 're:^https?://.*\.jpg$',
100 def _real_extract(self, url):
101 webpage = self._download_webpage(url, self._match_id(url))
103 '_type': 'url_transparent',
105 'url': self._og_search_video_url(webpage),
106 'title': clean_html(self._og_search_title(webpage)),
107 'description': clean_html(self._og_search_description(webpage)),
108 'thumbnail': self._og_search_thumbnail(webpage),