]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dreisat.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   6 from ..utils 
import unified_strdate
 
   9 class DreiSatIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'(?:http://)?(?:www\.)?3sat\.de/mediathek/(?:index\.php)?\?(?:(?:mode|display)=[^&]+&)*obj=(?P<id>[0-9]+)$' 
  13         'url': 'http://www.3sat.de/mediathek/index.php?obj=36983', 
  14         'md5': '9dcfe344732808dbfcc901537973c922', 
  18             'title': 'Kaffeeland Schweiz', 
  19             'description': 'md5:cc4424b18b75ae9948b13929a0814033', 
  21             'upload_date': '20130622' 
  25     def _real_extract(self
, url
): 
  26         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  27         video_id 
= mobj
.group('id') 
  28         details_url 
= 'http://www.3sat.de/mediathek/xmlservice/web/beitragsDetails?ak=web&id=%s' % video_id
 
  29         details_doc 
= self
._download
_xml
(details_url
, video_id
, 'Downloading video details') 
  31         thumbnail_els 
= details_doc
.findall('.//teaserimage') 
  33             'width': int(te
.attrib
['key'].partition('x')[0]), 
  34             'height': int(te
.attrib
['key'].partition('x')[2]), 
  36         } for te 
in thumbnail_els
] 
  38         information_el 
= details_doc
.find('.//information') 
  39         video_title 
= information_el
.find('./title').text
 
  40         video_description 
= information_el
.find('./detail').text
 
  42         details_el 
= details_doc
.find('.//details') 
  43         video_uploader 
= details_el
.find('./channel').text
 
  44         upload_date 
= unified_strdate(details_el
.find('./airtime').text
) 
  46         format_els 
= details_doc
.findall('.//formitaet') 
  48             'format_id': fe
.attrib
['basetype'], 
  49             'width': int(fe
.find('./width').text
), 
  50             'height': int(fe
.find('./height').text
), 
  51             'url': fe
.find('./url').text
, 
  52             'filesize': int(fe
.find('./filesize').text
), 
  53             'video_bitrate': int(fe
.find('./videoBitrate').text
), 
  54         } for fe 
in format_els
 
  55             if not fe
.find('./url').text
.startswith('http://www.metafilegenerator.de/')] 
  57         self
._sort
_formats
(formats
) 
  64             'description': video_description
, 
  65             'thumbnails': thumbnails
, 
  66             'thumbnail': thumbnails
[-1]['url'], 
  67             'uploader': video_uploader
, 
  68             'upload_date': upload_date
,