]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dfb.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   6 from ..utils 
import unified_strdate
 
   9 class DFBIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'https?://tv\.dfb\.de/video/(?P<display_id>[^/]+)/(?P<id>\d+)' 
  14         'url': 'http://tv.dfb.de/video/u-19-em-stimmen-zum-spiel-gegen-russland/11633/', 
  15         # The md5 is different each time 
  18             'display_id': 'u-19-em-stimmen-zum-spiel-gegen-russland', 
  20             'title': 'U 19-EM: Stimmen zum Spiel gegen Russland', 
  21             'upload_date': '20150714', 
  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') 
  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
, 
  34         video_info 
= player_info
.find('video') 
  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
_f
4m
_formats
(manifest_url
, display_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
),