2 from __future__ import unicode_literals
6 from .common import InfoExtractor
13 class TwentyMinutenIE(InfoExtractor):
20 videoplayer/videoplayer\.html\?.*?\bvideoId@
25 'url': 'http://www.20min.ch/videotv/?vid=469148&cid=2',
26 'md5': 'e7264320db31eed8c38364150c12496e',
30 'title': '85 000 Franken für 15 perfekte Minuten',
31 'thumbnail': r're:https?://.*\.jpg$',
34 'url': 'http://www.20min.ch/videoplayer/videoplayer.html?params=client@twentyDE|videoId@523629',
38 'title': 'So kommen Sie bei Eis und Schnee sicher an',
39 'description': 'md5:117c212f64b25e3d95747e5276863f7d',
40 'thumbnail': r're:https?://.*\.jpg$',
43 'skip_download': True,
46 'url': 'http://www.20min.ch/videotv/?cid=44&vid=468738',
47 'only_matching': True,
51 def _extract_urls(webpage):
52 return [m.group('url') for m in re.finditer(
53 r'<iframe[^>]+src=(["\'])(?P<url>(?:(?:https?:)?//)?(?:www\.)?20min\.ch/videoplayer/videoplayer.html\?.*?\bvideoId@\d+.*?)\1',
56 def _real_extract(self, url):
57 video_id = self._match_id(url)
59 video = self._download_json(
60 'http://api.20min.ch/video/%s/show' % video_id,
63 title = video['title']
66 'format_id': format_id,
67 'url': 'http://podcast.20min-tv.ch/podcast/20min/%s%s.mp4' % (video_id, p),
69 } for quality, (format_id, p) in enumerate([('sd', ''), ('hd', 'h')])]
70 self._sort_formats(formats)
72 description = video.get('lead')
73 thumbnail = video.get('thumbnail')
75 def extract_count(kind):
78 lambda x: int_or_none(x['communityobject']['thumbs_%s' % kind]))
80 like_count = extract_count('up')
81 dislike_count = extract_count('down')
86 'description': description,
87 'thumbnail': thumbnail,
88 'like_count': like_count,
89 'dislike_count': dislike_count,