]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/dfb.py
[funimation] Detect blocking and support CloudFlare cookies
[yt-dlp.git] / youtube_dl / extractor / dfb.py
CommitLineData
74aa18f6
JMF
1from __future__ import unicode_literals
2
3import re
4
5from .common import InfoExtractor
ddcdc684 6from ..utils import unified_strdate
74aa18f6
JMF
7
8
9class 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)
19dbaeec 41 self._sort_formats(formats)
74aa18f6
JMF
42
43 return {
44 'id': video_id,
ddcdc684 45 'display_id': display_id,
74aa18f6 46 'title': video_info.find('title').text,
74aa18f6 47 'thumbnail': self._og_search_thumbnail(webpage),
ddcdc684 48 'upload_date': unified_strdate(video_info.find('time_date').text),
6c1b0c0e 49 'formats': formats,
74aa18f6 50 }