]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tagesschau.py
b870474515ba61ee33641c86554d53d68a6bf46d
   1 # -*- coding: utf-8 -*- 
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   9 class TagesschauIE(InfoExtractor
): 
  10     _VALID_URL 
= r
'https?://(?:www\.)?tagesschau\.de/multimedia/video/video(?P<id>-?[0-9]+)\.html' 
  13         'url': 'http://www.tagesschau.de/multimedia/video/video1399128.html', 
  14         'md5': 'bcdeac2194fb296d599ce7929dfa4009', 
  18             'title': 'Harald Range, Generalbundesanwalt, zu den Ermittlungen', 
  19             'description': 'md5:69da3c61275b426426d711bde96463ab', 
  20             'thumbnail': 're:^http:.*\.jpg$', 
  25         's': {'width': 256, 'height': 144, 'quality': 1}, 
  26         'm': {'width': 512, 'height': 288, 'quality': 2}, 
  27         'l': {'width': 960, 'height': 544, 'quality': 3}, 
  30     def _real_extract(self
, url
): 
  31         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  32         video_id 
= mobj
.group('id') 
  34         if video_id
.startswith('-'): 
  35             display_id 
= video_id
.strip('-') 
  39         webpage 
= self
._download
_webpage
(url
, display_id
) 
  41         playerpage 
= self
._download
_webpage
( 
  42             'http://www.tagesschau.de/multimedia/video/video%s~player_autoplay-true.html' % video_id
, 
  43             display_id
, 'Downloading player page') 
  46             r
'"(http://media.+?)", type:"video/(.+?)", quality:"(.+?)"', 
  50         for url
, ext
, res 
in medias
: 
  52                 'format_id': res 
+ '_' + ext
, 
  56             f
.update(self
._FORMATS
.get(res
, {})) 
  59         self
._sort
_formats
(formats
) 
  61         thumbnail 
= re
.findall(r
'"(/multimedia/.+?\.jpg)"', playerpage
)[-1] 
  65             'title': self
._og
_search
_title
(webpage
).strip(), 
  66             'thumbnail': 'http://www.tagesschau.de' + thumbnail
, 
  68             'description': self
._og
_search
_description
(webpage
).strip(),