]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tweakers.py
7a9386cde3d9e0e5d78bfd368d47819430c53e85
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
  11 class TweakersIE(InfoExtractor
): 
  12     _VALID_URL 
= r
'https?://tweakers\.net/video/(?P<id>\d+)' 
  14         'url': 'https://tweakers.net/video/9926/new-nintendo-3ds-xl-op-alle-fronten-beter.html', 
  15         'md5': 'fe73e417c093a788e0160c4025f88b15', 
  19             'title': 'New Nintendo 3DS XL - Op alle fronten beter', 
  20             'description': 'md5:3789b21fed9c0219e9bcaacd43fab280', 
  21             'thumbnail': 're:^https?://.*\.jpe?g$', 
  23             'uploader_id': 's7JeEm', 
  27     def _real_extract(self
, url
): 
  28         video_id 
= self
._match
_id
(url
) 
  29         video_data 
= self
._download
_json
( 
  30             'https://tweakers.net/video/s1playlist/%s/1920/1080/playlist.json' % video_id
, 
  33         title 
= video_data
['title'] 
  36         for location 
in video_data
.get('locations', {}).get('progressive', []): 
  37             format_id 
= location
.get('label') 
  38             width 
= int_or_none(location
.get('width')) 
  39             height 
= int_or_none(location
.get('height')) 
  40             for source 
in location
.get('sources', []): 
  41                 source_url 
= source
.get('src') 
  44                 ext 
= mimetype2ext(source
.get('type')) or determine_ext(source_url
) 
  46                     'format_id': format_id
, 
  52         self
._sort
_formats
(formats
) 
  57             'description': video_data
.get('description'), 
  58             'thumbnail': video_data
.get('poster'), 
  59             'duration': int_or_none(video_data
.get('duration')), 
  60             'uploader_id': video_data
.get('account'),