2016-06-09 05:31:22 -06:00
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..utils import (
|
2016-06-13 12:11:24 -06:00
|
|
|
int_or_none,
|
|
|
|
parse_iso8601,
|
2016-06-09 05:31:22 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class RockstarGamesIE(InfoExtractor):
|
2024-03-08 17:02:45 -07:00
|
|
|
_WORKING = False
|
2016-06-13 12:11:24 -06:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?rockstargames\.com/videos(?:/video/|#?/?\?.*\bvideo=)(?P<id>\d+)'
|
|
|
|
_TESTS = [{
|
2016-06-09 05:31:22 -06:00
|
|
|
'url': 'https://www.rockstargames.com/videos/video/11544/',
|
|
|
|
'md5': '03b5caa6e357a4bd50e3143fc03e5733',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '11544',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Further Adventures in Finance and Felony Trailer',
|
|
|
|
'description': 'md5:6d31f55f30cb101b5476c4a379e324a3',
|
2017-01-02 05:08:07 -07:00
|
|
|
'thumbnail': r're:^https?://.*\.jpg$',
|
2016-06-13 12:11:24 -06:00
|
|
|
'timestamp': 1464876000,
|
2016-06-09 05:31:22 -06:00
|
|
|
'upload_date': '20160602',
|
2024-06-11 17:09:58 -06:00
|
|
|
},
|
2016-06-13 12:11:24 -06:00
|
|
|
}, {
|
|
|
|
'url': 'http://www.rockstargames.com/videos#/?video=48',
|
|
|
|
'only_matching': True,
|
|
|
|
}]
|
2016-06-09 05:31:22 -06:00
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
|
2016-06-13 12:11:24 -06:00
|
|
|
video = self._download_json(
|
|
|
|
'https://www.rockstargames.com/videoplayer/videos/get-video.json',
|
|
|
|
video_id, query={
|
|
|
|
'id': video_id,
|
|
|
|
'locale': 'en_us',
|
|
|
|
})['video']
|
|
|
|
|
|
|
|
title = video['title']
|
2016-06-09 05:31:22 -06:00
|
|
|
|
2016-06-13 12:11:24 -06:00
|
|
|
formats = []
|
2024-03-10 08:22:49 -06:00
|
|
|
for v in video['files_processed']['video/mp4']:
|
|
|
|
if not v.get('src'):
|
2016-06-09 05:31:22 -06:00
|
|
|
continue
|
2024-03-10 08:22:49 -06:00
|
|
|
resolution = v.get('resolution')
|
2016-06-13 12:11:24 -06:00
|
|
|
height = int_or_none(self._search_regex(
|
|
|
|
r'^(\d+)[pP]$', resolution or '', 'height', default=None))
|
2016-06-09 05:31:22 -06:00
|
|
|
formats.append({
|
2024-03-10 08:22:49 -06:00
|
|
|
'url': self._proto_relative_url(v['src']),
|
2016-06-13 12:11:24 -06:00
|
|
|
'format_id': resolution,
|
|
|
|
'height': height,
|
2016-06-09 05:31:22 -06:00
|
|
|
})
|
2016-06-13 12:11:24 -06:00
|
|
|
|
|
|
|
if not formats:
|
|
|
|
youtube_id = video.get('youtube_id')
|
|
|
|
if youtube_id:
|
|
|
|
return self.url_result(youtube_id, 'Youtube')
|
|
|
|
|
2016-06-09 05:31:22 -06:00
|
|
|
return {
|
|
|
|
'id': video_id,
|
2016-06-13 12:11:24 -06:00
|
|
|
'title': title,
|
|
|
|
'description': video.get('description'),
|
|
|
|
'thumbnail': self._proto_relative_url(video.get('screencap')),
|
|
|
|
'timestamp': parse_iso8601(video.get('created')),
|
2016-06-09 05:31:22 -06:00
|
|
|
'formats': formats,
|
|
|
|
}
|