]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dfb.py
cb8e0682240bfed9a56a58490f18989f33fef71d
[youtubedl] / youtube_dl / extractor / dfb.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6
7
8 class DFBIE(InfoExtractor):
9 IE_NAME = 'tv.dfb.de'
10 _VALID_URL = r'https?://tv\.dfb\.de/video/[^/]+/(?P<id>\d+)'
11
12 _TEST = {
13 'url': 'http://tv.dfb.de/video/highlights-des-empfangs-in-berlin/9070/',
14 # The md5 is different each time
15 'info_dict': {
16 'id': '9070',
17 'ext': 'flv',
18 'title': 'Highlights des Empfangs in Berlin',
19 'upload_date': '20140716',
20 },
21 }
22
23 def _real_extract(self, url):
24 mobj = re.match(self._VALID_URL, url)
25 video_id = mobj.group('id')
26
27 webpage = self._download_webpage(url, video_id)
28 player_info = self._download_xml(
29 'http://tv.dfb.de/server/hd_video.php?play=%s' % video_id,
30 video_id)
31 video_info = player_info.find('video')
32
33 f4m_info = self._download_xml(video_info.find('url').text, video_id)
34 token_el = f4m_info.find('token')
35 manifest_url = token_el.attrib['url'] + '?' + 'hdnea=' + token_el.attrib['auth'] + '&hdcore=3.2.0'
36
37 return {
38 'id': video_id,
39 'title': video_info.find('title').text,
40 'url': manifest_url,
41 'ext': 'flv',
42 'thumbnail': self._og_search_thumbnail(webpage),
43 'upload_date': ''.join(video_info.find('time_date').text.split('.')[::-1]),
44 }