1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
7 from .common import InfoExtractor
16 class StreamCZIE(InfoExtractor):
17 _VALID_URL = r'https?://(?:www\.)?stream\.cz/.+/(?P<id>[0-9]+)'
20 'url': 'http://www.stream.cz/peklonataliri/765767-ecka-pro-deti',
21 'md5': '6d3ca61a8d0633c9c542b92fcb936b0c',
25 'title': 'Peklo na talíři: Éčka pro děti',
26 'description': 'Taška s grónskou pomazánkou a další pekelnosti ZDE',
27 'thumbnail': 're:^http://im.stream.cz/episode/52961d7e19d423f8f06f0100',
31 'url': 'http://www.stream.cz/blanik/10002447-tri-roky-pro-mazanka',
32 'md5': 'e54a254fb8b871968fd8403255f28589',
36 'title': 'Kancelář Blaník: Tři roky pro Mazánka',
37 'description': 'md5:3862a00ba7bf0b3e44806b544032c859',
38 'thumbnail': 're:^http://im.stream.cz/episode/537f838c50c11f8d21320000',
43 def _real_extract(self, url):
44 video_id = self._match_id(url)
45 data = self._download_json(
46 'http://www.stream.cz/API/episode/%s' % video_id, video_id)
49 for quality, video in enumerate(data['video_qualities']):
50 for f in video['formats']:
51 typ = f['type'].partition('/')[2]
52 qlabel = video.get('quality_label')
54 'format_note': '%s-%s' % (qlabel, typ) if qlabel else typ,
55 'format_id': '%s-%s' % (typ, f['quality']),
57 'height': int_or_none(f['quality'].rstrip('p')),
60 self._sort_formats(formats)
62 image = data.get('image')
64 thumbnail = self._proto_relative_url(
65 image.replace('{width}', '1240').replace('{height}', '697'),
71 stream = data.get('_embedded', {}).get('stream:show', {}).get('name')
73 title = '%s: %s' % (stream, data['name'])
80 'thumbnail': thumbnail,
82 'description': data.get('web_site_text'),
83 'duration': int_or_none(data.get('duration')),
84 'view_count': int_or_none(data.get('views')),