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