]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rockstargames.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
  11 class RockstarGamesIE(InfoExtractor
): 
  12     _VALID_URL 
= r
'https?://(?:www\.)?rockstargames\.com/videos(?:/video/|#?/?\?.*\bvideo=)(?P<id>\d+)' 
  14         'url': 'https://www.rockstargames.com/videos/video/11544/', 
  15         'md5': '03b5caa6e357a4bd50e3143fc03e5733', 
  19             'title': 'Further Adventures in Finance and Felony Trailer', 
  20             'description': 'md5:6d31f55f30cb101b5476c4a379e324a3', 
  21             'thumbnail': r
're:^https?://.*\.jpg$', 
  22             'timestamp': 1464876000, 
  23             'upload_date': '20160602', 
  26         'url': 'http://www.rockstargames.com/videos#/?video=48', 
  27         'only_matching': True, 
  30     def _real_extract(self
, url
): 
  31         video_id 
= self
._match
_id
(url
) 
  33         video 
= self
._download
_json
( 
  34             'https://www.rockstargames.com/videoplayer/videos/get-video.json', 
  40         title 
= video
['title'] 
  43         for video 
in video
['files_processed']['video/mp4']: 
  44             if not video
.get('src'): 
  46             resolution 
= video
.get('resolution') 
  47             height 
= int_or_none(self
._search
_regex
( 
  48                 r
'^(\d+)[pP]$', resolution 
or '', 'height', default
=None)) 
  50                 'url': self
._proto
_relative
_url
(video
['src']), 
  51                 'format_id': resolution
, 
  56             youtube_id 
= video
.get('youtube_id') 
  58                 return self
.url_result(youtube_id
, 'Youtube') 
  60         self
._sort
_formats
(formats
) 
  65             'description': video
.get('description'), 
  66             'thumbnail': self
._proto
_relative
_url
(video
.get('screencap')), 
  67             'timestamp': parse_iso8601(video
.get('created')),