]>
Commit | Line | Data |
---|---|---|
74aa18f6 JMF |
1 | from __future__ import unicode_literals |
2 | ||
3 | import re | |
4 | ||
5 | from .common import InfoExtractor | |
ddcdc684 | 6 | from ..utils import unified_strdate |
74aa18f6 JMF |
7 | |
8 | ||
9 | class DFBIE(InfoExtractor): | |
10 | IE_NAME = 'tv.dfb.de' | |
ddcdc684 | 11 | _VALID_URL = r'https?://tv\.dfb\.de/video/(?P<display_id>[^/]+)/(?P<id>\d+)' |
74aa18f6 JMF |
12 | |
13 | _TEST = { | |
eae89f92 | 14 | 'url': 'http://tv.dfb.de/video/u-19-em-stimmen-zum-spiel-gegen-russland/11633/', |
74aa18f6 JMF |
15 | # The md5 is different each time |
16 | 'info_dict': { | |
eae89f92 | 17 | 'id': '11633', |
ddcdc684 | 18 | 'display_id': 'u-19-em-stimmen-zum-spiel-gegen-russland', |
74aa18f6 | 19 | 'ext': 'flv', |
eae89f92 S |
20 | 'title': 'U 19-EM: Stimmen zum Spiel gegen Russland', |
21 | 'upload_date': '20150714', | |
74aa18f6 JMF |
22 | }, |
23 | } | |
24 | ||
25 | def _real_extract(self, url): | |
26 | mobj = re.match(self._VALID_URL, url) | |
27 | video_id = mobj.group('id') | |
ddcdc684 | 28 | display_id = mobj.group('display_id') |
74aa18f6 | 29 | |
ddcdc684 | 30 | webpage = self._download_webpage(url, display_id) |
74aa18f6 JMF |
31 | player_info = self._download_xml( |
32 | 'http://tv.dfb.de/server/hd_video.php?play=%s' % video_id, | |
ddcdc684 | 33 | display_id) |
74aa18f6 JMF |
34 | video_info = player_info.find('video') |
35 | ||
ddcdc684 S |
36 | f4m_info = self._download_xml( |
37 | self._proto_relative_url(video_info.find('url').text.strip()), display_id) | |
74aa18f6 JMF |
38 | token_el = f4m_info.find('token') |
39 | manifest_url = token_el.attrib['url'] + '?' + 'hdnea=' + token_el.attrib['auth'] + '&hdcore=3.2.0' | |
6c1b0c0e | 40 | formats = self._extract_f4m_formats(manifest_url, display_id) |
74aa18f6 JMF |
41 | |
42 | return { | |
43 | 'id': video_id, | |
ddcdc684 | 44 | 'display_id': display_id, |
74aa18f6 | 45 | 'title': video_info.find('title').text, |
74aa18f6 | 46 | 'thumbnail': self._og_search_thumbnail(webpage), |
ddcdc684 | 47 | 'upload_date': unified_strdate(video_info.find('time_date').text), |
6c1b0c0e | 48 | 'formats': formats, |
74aa18f6 | 49 | } |