2 from __future__ import unicode_literals
6 from .common import InfoExtractor
15 class SportDeutschlandIE(InfoExtractor):
16 _VALID_URL = r'https?://sportdeutschland\.tv/(?P<sport>[^/?#]+)/(?P<id>[^?#/]+)(?:$|[?#])'
18 'url': 'http://sportdeutschland.tv/badminton/live-li-ning-badminton-weltmeisterschaft-2014-kopenhagen',
20 'id': 'live-li-ning-badminton-weltmeisterschaft-2014-kopenhagen',
22 'title': 're:Li-Ning Badminton Weltmeisterschaft 2014 Kopenhagen',
23 'categories': ['Badminton'],
25 'thumbnail': 're:^https?://.*\.jpg$',
26 'description': 're:Die Badminton-WM 2014 aus Kopenhagen bei Sportdeutschland\.TV',
28 'upload_date': 're:^201408[23][0-9]$',
31 'skip_download': 'Live stream',
34 'url': 'http://sportdeutschland.tv/li-ning-badminton-wm-2014/lee-li-ning-badminton-weltmeisterschaft-2014-kopenhagen-herren-einzel-wei-vs',
36 'id': 'lee-li-ning-badminton-weltmeisterschaft-2014-kopenhagen-herren-einzel-wei-vs',
38 'upload_date': '20140825',
39 'description': 'md5:60a20536b57cee7d9a4ec005e8687504',
40 'timestamp': 1408976060,
42 'title': 'Li-Ning Badminton Weltmeisterschaft 2014 Kopenhagen: Herren Einzel, Wei Lee vs. Keun Lee',
43 'thumbnail': 're:^https?://.*\.jpg$',
45 'categories': ['Li-Ning Badminton WM 2014'],
50 def _real_extract(self, url):
51 mobj = re.match(self._VALID_URL, url)
52 video_id = mobj.group('id')
53 sport_id = mobj.group('sport')
55 api_url = 'http://proxy.vidibusdynamic.net/sportdeutschland.tv/api/permalinks/%s/%s?access_token=true' % (
57 req = compat_urllib_request.Request(api_url, headers={
58 'Accept': 'application/vnd.vidibus.v2.html+json',
61 data = self._download_json(req, video_id)
64 categories = [data['section']['title']]
67 smil_url = asset['video']
68 if '.smil' in smil_url:
69 m3u8_url = smil_url.replace('.smil', '.m3u8')
71 self._extract_m3u8_formats(m3u8_url, video_id, ext='mp4'))
73 smil_doc = self._download_xml(
74 smil_url, video_id, note='Downloading SMIL metadata')
75 base_url = smil_doc.find('./head/meta').attrib['base']
79 'play_path': n.attrib['src'],
82 'format_note': 'Seems to fail at example stream',
83 } for n in smil_doc.findall('./body/video')])
85 formats.append({'url': smil_url})
87 self._sort_formats(formats)
92 'title': asset['title'],
93 'thumbnail': asset.get('image'),
94 'description': asset.get('teaser'),
95 'duration': asset.get('duration'),
96 'categories': categories,
97 'view_count': asset.get('views'),
98 'rtmp_live': asset.get('live'),
99 'timestamp': parse_iso8601(asset.get('date')),