]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/dvtv.py
3 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class DVTVIE(InfoExtractor
):
14 IE_DESC
= 'http://video.aktualne.cz/dvtv/'
16 _VALID_URL
= r
'http://video\.aktualne\.cz/dvtv/(?P<id>[a-z0-9-]+/r~[0-9a-f]{32})/?'
19 'url': 'http://video.aktualne.cz/dvtv/vondra-o-ceskem-stoleti-pri-pohledu-na-havla-mi-bylo-trapne/r~e5efe9ca855511e4833a0025900fea04/',
20 'md5': '75800f964fa0f82939a2914563301f72',
22 'id': 'e5efe9ca855511e4833a0025900fea04',
24 'title': 'Vondra o Českém století: Při pohledu na Havla mi bylo trapně'
27 'url': 'http://video.aktualne.cz/dvtv/stropnicky-policie-vrbetice-preventivne-nekontrolovala/r~82ed4322849211e4a10c0025900fea04/',
28 'md5': '6388f1941b48537dbd28791f712af8bf',
30 'id': '82ed4322849211e4a10c0025900fea04',
32 'title': 'Stropnický: Policie Vrbětice preventivně nekontrolovala'
36 def _real_extract(self
, url
):
37 video_id
= self
._match
_id
(url
)
38 webpage
= self
._download
_webpage
(url
, video_id
)
40 code
= self
._search
_regex
(
41 r
'(?s)embedData[0-9a-f]{32}\[\'asset
\'\
] = (\{.+?\}
);',
42 webpage, 'video JSON
')
43 payload = self._parse_json(code, video_id, transform_source=js_to_json)
45 for source in payload['sources
']:
46 ext = source['type'][6:]
48 'url
': source['file'],
50 'format
': '%s %s' % (ext, source['label
']),
51 'format_id
': '%s-%s' % (ext, source['label
']),
52 'height
': int(source['label
'].rstrip('p
')),
55 self._sort_formats(formats)
59 'display_id
': video_id[:-35],
60 'title
': unescapeHTML(payload['title
']),
61 'thumbnail
': 'http
:%s' % payload['image
'],