1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import int_or_none
10 class SWRMediathekIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.)?swrmediathek\.de/player\.htm\?show=(?P<videoid>[^?#&]+)'
14 'url': 'http://swrmediathek.de/player.htm?show=849790d0-dab8-11e3-a953-0026b975f2e6',
16 'id': '849790d0-dab8-11e3-a953-0026b975f2e6',
18 'title': 'SWR odysso',
19 'description': 'md5:2012e31baad36162e97ce9eb3f157b8a',
20 'thumbnail': 're:^http:.*\.jpg$',
23 'skip_download': True, # requires rtmpdump
26 'url': 'http://swrmediathek.de/player.htm?show=0e1a8510-ddf2-11e3-9be3-0026b975f2e6',
28 'id': '0e1a8510-ddf2-11e3-9be3-0026b975f2e6',
30 'title': 'Nachtcafé - Alltagsdroge Alkohol - zwischen Sektempfang und Komasaufen',
31 'description': 'md5:e0a3adc17e47db2c23aab9ebc36dbee2',
32 'thumbnail': 're:http://.*\.jpg',
35 'skip_download': True, # requires rtmpdump
39 def _real_extract(self, url):
40 mobj = re.match(self._VALID_URL, url)
41 video_id = mobj.group('videoid')
43 webpage = self._download_webpage(url, video_id)
45 smilurl = 'http://swrmediathek.de/rtmpQuals/%s/clips.smil'
46 smildoc = self._download_xml(smilurl % video_id, video_id, note='Downloading SMIL page')
48 baseurl = smildoc.find('.//meta').attrib['base']
51 for video in smildoc.findall('.//video'):
52 vbr = video.attrib.get('system-bitrate')
57 'format_id': video.attrib['height'] + 'p',
58 'width': int_or_none(video.attrib['width']),
59 'height': int_or_none(video.attrib['height']),
62 'play_path': 'mp4:' + video.attrib['src'],
66 self._sort_formats(formats)
70 'title': self._html_search_regex(r'<meta name="title" content="(.+)" />', webpage, 'title'),
71 'thumbnail': self._search_regex(r'<link rel="image_src".+href="(.+)" />', webpage, 'thumbnail'),
73 'description': self._html_search_regex(r'<meta name="description" content="(.+)" />', webpage, 'description'),