]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tweakers.py
c80ec15cf1170d2e307dfc851cd5a91c4126afc2
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
  12 class TweakersIE(InfoExtractor
): 
  13     _VALID_URL 
= r
'https?://tweakers\.net/video/(?P<id>\d+)' 
  15         'url': 'https://tweakers.net/video/9926/new-nintendo-3ds-xl-op-alle-fronten-beter.html', 
  16         'md5': '1b5afa817403bb5baa08359dca31e6df', 
  20             'title': 'New Nintendo 3DS XL - Op alle fronten beter', 
  21             'description': 'md5:f97324cc71e86e11c853f0763820e3ba', 
  22             'thumbnail': 're:^https?://.*\.jpe?g$', 
  27     def _real_extract(self
, url
): 
  28         video_id 
= self
._match
_id
(url
) 
  30         playlist 
= self
._download
_xml
( 
  31             'https://tweakers.net/video/s1playlist/%s/playlist.xspf' % video_id
, 
  35             'xspf': 'http://xspf.org/ns/0/', 
  36             's1': 'http://static.streamone.nl/player/ns/0', 
  39         track 
= playlist
.find(xpath_with_ns('./xspf:trackList/xspf:track', NS_MAP
)) 
  42             track
, xpath_with_ns('./xspf:title', NS_MAP
), 'title') 
  43         description 
= xpath_text( 
  44             track
, xpath_with_ns('./xspf:annotation', NS_MAP
), 'description') 
  45         thumbnail 
= xpath_text( 
  46             track
, xpath_with_ns('./xspf:image', NS_MAP
), 'thumbnail') 
  47         duration 
= float_or_none( 
  48             xpath_text(track
, xpath_with_ns('./xspf:duration', NS_MAP
), 'duration'), 
  53             'format_id': location
.get(xpath_with_ns('s1:label', NS_MAP
)), 
  54             'width': int_or_none(location
.get(xpath_with_ns('s1:width', NS_MAP
))), 
  55             'height': int_or_none(location
.get(xpath_with_ns('s1:height', NS_MAP
))), 
  56         } for location 
in track
.findall(xpath_with_ns('./xspf:location', NS_MAP
))] 
  61             'description': description
, 
  62             'thumbnail': thumbnail
,