]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/tvc.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class TVCIE(InfoExtractor
):
12 _VALID_URL
= r
'http://(?:www\.)?tvc\.ru/.*/show/.*id/(?P<id>\d+)'
15 'url': 'http://www.tvc.ru/channel/brand/id/29/show/episodes/episode_id/39702/',
16 'md5': 'aa6fb3cf384e18a0ad3b30ee2898beba',
19 'display_id': '39702',
21 'title': 'События. "События". Эфир от 22.05.2015 14:30',
22 'description': 'md5:ad7aa7db22903f983e687b8a3e98c6dd',
23 'thumbnail': 're:^https?://.*\.jpg$',
28 'url': 'http://www.tvc.ru/news/show/id/69944',
29 'md5': 'b173128ee7b88b5b06c84e5f7880909f',
32 'display_id': '69944',
34 'title': 'Эксперты: в столице встал вопрос о максимально безопасных остановках',
35 'description': 'md5:f675c8eaf23aab9df542d31773ed6518',
36 'thumbnail': 're:^https?://.*\.jpg$',
42 def _real_extract(self
, url
):
43 display_id
= self
._match
_id
(url
)
45 webpage
= self
._download
_webpage
(url
, display_id
)
47 video_url
= self
._og
_search
_video
_url
(webpage
)
49 video_id
= self
._search
_regex
(
50 r
'video/iframe/id/(\d+)/', video_url
, 'video id')
52 video_json_url
= 'http://www.tvc.ru/video/json/id/%s' % (video_id
)
54 video_json
= self
._download
_json
(video_json_url
, video_id
)
57 for info
in video_json
.get('path', {}).get('quality', []):
58 format_id
= self
._search
_regex
(
59 r
'cdnvideo/([^-]+)-[^/]+/', info
.get('url'), 'format id',
62 'format_id': str_or_none(format_id
),
63 'url': info
.get('url'),
64 'width': int_or_none(info
.get('width')),
65 'height': int_or_none(info
.get('height')),
66 'tbr': int_or_none(info
.get('bitrate')),
69 self
._sort
_formats
(formats
)
73 'display_id': display_id
,
74 'title': self
._og
_search
_title
(webpage
),
75 'description': self
._og
_search
_description
(webpage
),
76 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
77 'duration': int_or_none(video_json
.get('duration')),