]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/golem.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
  14 class GolemIE(InfoExtractor
): 
  15     _VALID_URL 
= r
'^https?://video\.golem\.de/.+?/(?P<id>.+?)/' 
  17         'url': 'http://video.golem.de/handy/14095/iphone-6-und-6-plus-test.html', 
  18         'md5': 'c1a2c0a3c863319651c7c992c5ee29bf', 
  23             'title': 'iPhone 6 und 6 Plus - Test', 
  29     _PREFIX 
= 'http://video.golem.de' 
  31     def _real_extract(self
, url
): 
  32         video_id 
= self
._match
_id
(url
) 
  34         config 
= self
._download
_xml
( 
  35             'https://video.golem.de/xml/{0}.xml'.format(video_id
), video_id
) 
  39             'title': config
.findtext('./title', 'golem'), 
  40             'duration': self
._float
(config
.findtext('./playtime'), 'duration'), 
  45             url 
= e
.findtext('./url') 
  50                 'format_id': compat_str(e
.tag
), 
  51                 'url': compat_urlparse
.urljoin(self
._PREFIX
, url
), 
  52                 'height': self
._int
(e
.get('height'), 'height'), 
  53                 'width': self
._int
(e
.get('width'), 'width'), 
  54                 'filesize': self
._int
(e
.findtext('filesize'), 'filesize'), 
  55                 'ext': determine_ext(e
.findtext('./filename')), 
  57         self
._sort
_formats
(formats
) 
  58         info
['formats'] = formats
 
  61         for e 
in config
.findall('.//teaser'): 
  62             url 
= e
.findtext('./url') 
  66                 'url': compat_urlparse
.urljoin(self
._PREFIX
, url
), 
  67                 'width': self
._int
(e
.get('width'), 'thumbnail width'), 
  68                 'height': self
._int
(e
.get('height'), 'thumbnail height'), 
  70         info
['thumbnails'] = thumbnails