1 from __future__ import unicode_literals
5 from .common import InfoExtractor
16 class MassengeschmackTVIE(InfoExtractor):
17 IE_NAME = 'massengeschmack.tv'
18 _VALID_URL = r'https?://(?:www\.)?massengeschmack\.tv/play/(?P<id>[^?&#]+)'
21 'url': 'https://massengeschmack.tv/play/fktv202',
22 'md5': 'a9e054db9c2b5a08f0a0527cc201e8d3',
26 'title': 'Fernsehkritik-TV - Folge 202',
30 def _real_extract(self, url):
31 episode = self._match_id(url)
33 webpage = self._download_webpage(url, episode)
34 title = clean_html(self._html_search_regex(
35 '<h3>([^<]+)</h3>', webpage, 'title'))
36 thumbnail = self._search_regex(r'POSTER\s*=\s*"([^"]+)', webpage, 'thumbnail', fatal=False)
37 sources = self._parse_json(self._search_regex(r'(?s)MEDIA\s*=\s*(\[.+?\]);', webpage, 'media'), episode, js_to_json)
40 for source in sources:
41 furl = source.get('src')
44 furl = self._proto_relative_url(furl)
45 ext = determine_ext(furl) or mimetype2ext(source.get('type'))
47 formats.extend(self._extract_m3u8_formats(
48 furl, episode, 'mp4', 'm3u8_native',
49 m3u8_id='hls', fatal=False))
53 'format_id': determine_ext(furl),
56 for (durl, format_id, width, height, filesize) in re.findall(r'''(?x)
57 <a[^>]+?href="(?P<url>(?:https:)?//[^"]+)".*?
58 <strong>(?P<format_id>.+?)</strong>.*?
59 <small>(?:(?P<width>\d+)x(?P<height>\d+))?\s+?\((?P<filesize>[\d,]+\s*[GM]iB)\)</small>
63 'format_id': format_id,
64 'width': int_or_none(width),
65 'height': int_or_none(height),
66 'filesize': parse_filesize(filesize),
67 'vcodec': 'none' if format_id.startswith('Audio') else None,
70 self._sort_formats(formats, ('width', 'height', 'filesize', 'tbr'))
76 'thumbnail': thumbnail,