1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
7 from .common import InfoExtractor
10 class StreamCZIE(InfoExtractor):
11 _VALID_URL = r'https?://www\.stream\.cz/((?P<category>.+)/)?(?P<videogroup>.+)/(?P<videoid>.+)'
14 'url': 'http://www.stream.cz/peklonataliri/765767-ecka-pro-deti',
15 'md5': '6d3ca61a8d0633c9c542b92fcb936b0c',
19 'title': 'Peklo na talíři: Éčka pro děti',
20 'description': 'md5:49ace0df986e95e331d0fe239d421519',
21 'thumbnail': 'http://im.stream.cz/episode/52961d7e19d423f8f06f0100',
26 def _real_extract(self, url):
27 mobj = re.match(self._VALID_URL, url)
28 video_id = mobj.group('videoid')
30 webpage = self._download_webpage(url, video_id)
32 data = self._html_search_regex(r'Stream\.Data\.Episode\((.+?)\);', webpage, 'stream data')
34 jsonData = json.loads(data)
37 for video in jsonData['instances']:
38 format_id = video['instances'][0]['quality']
40 if format_id == '240p':
42 elif format_id == '360p':
44 elif format_id == '480p':
46 elif format_id == '720p':
50 'format_id': format_id,
51 'url': video['instances'][0]['source'],
56 self._sort_formats(formats)
59 'id': str(jsonData['id']),
60 'title': self._og_search_title(webpage),
61 'thumbnail': jsonData['episode_image_original_url'].replace('//', 'http://'),
63 'description': self._og_search_description(webpage),