2 from __future__ import unicode_literals
6 from .common import InfoExtractor
13 class SportDeutschlandIE(InfoExtractor):
14 _VALID_URL = r'https?://sportdeutschland\.tv/(?P<sport>[^/?#]+)/(?P<id>[^?#/]+)(?:$|[?#])'
16 'url': 'http://sportdeutschland.tv/badminton/live-li-ning-badminton-weltmeisterschaft-2014-kopenhagen',
18 'id': 'live-li-ning-badminton-weltmeisterschaft-2014-kopenhagen',
20 'title': 'LIVE: Li-Ning Badminton Weltmeisterschaft 2014 Kopenhagen',
21 'categories': ['Badminton'],
23 'thumbnail': 're:^https?://.*\.jpg',
24 'description': 're:^Die Badminton-WM 2014 aus Kopenhagen LIVE',
25 'timestamp': 1409043600,
26 'upload_date': '20140826',
29 'skip_download': 'Live stream',
33 def _real_extract(self, url):
34 mobj = re.match(self._VALID_URL, url)
35 video_id = mobj.group('id')
36 sport_id = mobj.group('sport')
38 api_url = 'http://splink.tv/api/permalinks/%s/%s' % (
40 req = compat_urllib_request.Request(api_url, headers={
41 'Accept': 'application/vnd.vidibus.v2.html+json',
44 data = self._download_json(req, video_id)
46 categories = list(data.get('section', {}).get('tags', {}).values())
49 smil_url = asset['video']
50 m3u8_url = smil_url.replace('.smil', '.m3u8')
51 formats = self._extract_m3u8_formats(m3u8_url, video_id, ext='mp4')
53 smil_doc = self._download_xml(
54 smil_url, video_id, note='Downloading SMIL metadata')
55 base_url = smil_doc.find('./head/meta').attrib['base']
59 'play_path': n.attrib['src'],
62 'format_note': 'Seems to fail at example stream',
63 } for n in smil_doc.findall('./body/video')])
64 self._sort_formats(formats)
69 'title': asset['title'],
70 'thumbnail': asset.get('image'),
71 'description': asset.get('teaser'),
72 'categories': categories,
73 'view_count': asset.get('views'),
74 'rtmp_live': asset['live'],
75 'timestamp': parse_iso8601(asset.get('date')),