1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
7 from .common import InfoExtractor
13 class IPrimaIE(InfoExtractor):
14 _VALID_URL = r'https?://play\.iprima\.cz/(?:.+/)?(?P<id>[^?#]+)'
17 'url': 'http://play.iprima.cz/gondici-s-r-o-33',
21 'title': 'GondÃci s. r. o. (34)',
22 'description': 'md5:16577c629d006aa91f59ca8d8e7f99bd',
25 'skip_download': True, # m3u8 download
28 'url': 'http://play.iprima.cz/particka/particka-92',
29 'only_matching': True,
32 def _real_extract(self, url):
33 mobj = re.match(self._VALID_URL, url)
34 video_id = mobj.group('id')
36 webpage = self._download_webpage(url, video_id)
38 video_id = self._search_regex(r'data-product="([^"]+)">', webpage, 'real id')
40 req = sanitized_Request(
41 'http://play.iprima.cz/prehravac/init?_infuse=1'
42 '&_ts=%s&productId=%s' % (round(time.time()), video_id))
43 req.add_header('Referer', url)
44 playerpage = self._download_webpage(req, video_id, note='Downloading player')
46 m3u8_url = self._search_regex(r"'src': '([^']+\.m3u8)'", playerpage, 'm3u8 url')
48 formats = self._extract_m3u8_formats(m3u8_url, video_id, ext='mp4')
50 self._sort_formats(formats)
54 'title': self._og_search_title(webpage),
55 'thumbnail': self._og_search_thumbnail(webpage),
57 'description': self._og_search_description(webpage),