aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorDracony <draconyster@gmail.com>2016-06-09 13:31:22 +0200
committerSergey M․ <dstftw@gmail.com>2016-06-14 01:09:35 +0700
commit14d0f4e0f3e1b6a467b6302eb60644535aff4292 (patch)
tree31d16a0e2b51755876a0d1e3c89abfa986a0561a /youtube_dl
parent778f96944785f814a97964be1d6fb3bb78bc13f0 (diff)
Added extractor for rockstargames.com
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/extractors.py1
-rw-r--r--youtube_dl/extractor/rockstargames.py54
2 files changed, 55 insertions, 0 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
index d2db4d803..8a6c54b97 100644
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -649,6 +649,7 @@ from .revision3 import (
from .rice import RICEIE
from .ringtv import RingTVIE
from .ro220 import Ro220IE
+from .rockstargames import RockstarGamesIE
from .rottentomatoes import RottenTomatoesIE
from .roxwel import RoxwelIE
from .rtbf import RTBFIE
diff --git a/youtube_dl/extractor/rockstargames.py b/youtube_dl/extractor/rockstargames.py
new file mode 100644
index 000000000..427ab153a
--- /dev/null
+++ b/youtube_dl/extractor/rockstargames.py
@@ -0,0 +1,54 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ qualities,
+ parse_iso8601
+)
+
+
+class RockstarGamesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?rockstargames\.com/videos/video/(?P<id>[0-9]+)'
+ _TEST = {
+ 'url': 'https://www.rockstargames.com/videos/video/11544/',
+ 'md5': '03b5caa6e357a4bd50e3143fc03e5733',
+ 'info_dict': {
+ 'id': '11544',
+ 'ext': 'mp4',
+ 'title': 'Further Adventures in Finance and Felony Trailer',
+ 'thumbnail': 're:^https?://.*\.jpg$',
+ 'description': 'md5:6d31f55f30cb101b5476c4a379e324a3',
+ 'upload_date': '20160602',
+ 'timestamp': 1464876000
+ }
+ }
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ json_data = self._download_json(
+ 'https://www.rockstargames.com/videoplayer/videos/get-video.json?id=%s&locale=en_us' % video_id,
+ video_id
+ )['video']
+
+ formats = []
+
+ for video in json_data['files_processed']['video/mp4']:
+ if not video.get('src'):
+ continue
+ height = video.get('resolution', '').replace('p', '')
+
+ formats.append({
+ 'url': self._proto_relative_url(video['src']),
+ 'height': int(height) if height.isdigit() else -1,
+ })
+ self._sort_formats(formats)
+
+ return {
+ 'id': video_id,
+ 'title': json_data['title'],
+ 'description': json_data.get('description'),
+ 'formats': formats,
+ 'thumbnail': self._proto_relative_url(json_data.get('screencap')),
+ 'timestamp': parse_iso8601(json_data.get('created'))
+ }