2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import js_to_json
10 class RTNewsIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?rt\.com/[^/]+/(?:[^/]+/)?(?P<id>\d+)'
14 'url': 'https://www.rt.com/sport/546301-djokovic-arrives-belgrade-crowds/',
15 'playlist_mincount': 2,
18 'title': 'Crowds gather to greet deported Djokovic as he returns to Serbia (VIDEO)',
19 'description': 'md5:1d5bfe1a988d81fd74227cfdf93d314d',
20 'thumbnail': 'https://cdni.rt.com/files/2022.01/article/61e587a085f540102c3386c1.png'
23 'url': 'https://www.rt.com/shows/in-question/535980-plot-to-assassinate-julian-assange/',
24 'playlist_mincount': 1,
27 'title': 'The plot to assassinate Julian Assange',
28 'description': 'md5:55279ce5e4441dc1d16e2e4a730152cd',
29 'thumbnail': 'https://cdni.rt.com/files/2021.09/article/615226f42030274e8879b53d.png'
33 'id': '6152271d85f5400464496162',
35 'title': '6152271d85f5400464496162',
40 def _entries(self
, webpage
):
41 video_urls
= set(re
.findall(r
'https://cdnv\.rt\.com/.*[a-f0-9]+\.mp4', webpage
))
42 for v_url
in video_urls
:
43 v_id
= re
.search(r
'([a-f0-9]+)\.mp4', v_url
).group(1)
51 def _real_extract(self
, url
):
52 id = self
._match
_id
(url
)
53 webpage
= self
._download
_webpage
(url
, id)
58 'entries': self
._entries
(webpage
),
59 'title': self
._og
_search
_title
(webpage
),
60 'description': self
._og
_search
_description
(webpage
),
61 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
65 class RTDocumentryIE(InfoExtractor
):
66 _VALID_URL
= r
'https?://rtd\.rt\.com/(?:(?:series|shows)/[^/]+|films)/(?P<id>[^/?$&#]+)'
69 'url': 'https://rtd.rt.com/films/escobars-hitman/',
71 'id': 'escobars-hitman',
73 'title': "Escobar's Hitman. Former drug-gang killer, now loved and loathed in Colombia",
74 'description': 'md5:647c76984b7cb9a8b52a567e87448d88',
75 'thumbnail': 'https://cdni.rt.com/rtd-files/films/escobars-hitman/escobars-hitman_11.jpg',
76 'average_rating': 8.53,
79 'params': {'skip_download': True}
81 'url': 'https://rtd.rt.com/shows/the-kalashnikova-show-military-secrets-anna-knishenko/iskander-tactical-system-natos-headache/',
83 'id': 'iskander-tactical-system-natos-headache',
85 'title': "Iskander tactical system. NATO's headache | The Kalashnikova Show. Episode 10",
86 'description': 'md5:da7c24a0aa67bc2bb88c86658508ca87',
87 'thumbnail': 'md5:89de8ce38c710b7c501ff02d47e2aa89',
88 'average_rating': 9.27,
90 'timestamp': 1605726000,
92 'upload_date': '20201118'
94 'params': {'skip_download': True}
96 'url': 'https://rtd.rt.com/series/i-am-hacked-trailer/introduction-to-safe-digital-life-ep2/',
98 'id': 'introduction-to-safe-digital-life-ep2',
100 'title': 'How to Keep your Money away from Hackers | I am Hacked. Episode 2',
101 'description': 'md5:c46fa9a5af86c0008c45a3940a8cce87',
102 'thumbnail': 'md5:a5e81b9bf5aed8f5e23d9c053601b825',
103 'average_rating': 10.0,
105 'timestamp': 1636977600,
107 'upload_date': '20211115'
109 'params': {'skip_download': True}
112 def _real_extract(self
, url
):
113 id = self
._match
_id
(url
)
114 webpage
= self
._download
_webpage
(url
, id)
115 ld_json
= self
._search
_json
_ld
(webpage
, None, fatal
=False)
117 self
.raise_no_formats('No video/audio found at the provided url.', expected
=True)
118 media_json
= self
._parse
_json
(
119 self
._search
_regex
(r
'(?s)\'Med
\'\s
*:\s
*\
[\s
*({.+}
)\s
*\
]\s
*};', webpage, 'media info
'),
120 id, transform_source=js_to_json)
121 if 'title
' not in ld_json and 'title
' in media_json:
122 ld_json['title
'] = media_json['title
']
123 formats = [{'url': src['file']} for src in media_json.get('sources
') or [] if src.get('file')]
127 'thumbnail
': media_json.get('image
'),
133 class RTDocumentryPlaylistIE(InfoExtractor):
134 _VALID_URL = r'https?
://rtd\
.rt\
.com
/(?
:series|shows
)/(?P
<id>[^
/]+)/$
'
137 'url
': 'https
://rtd
.rt
.com
/series
/i
-am
-hacked
-trailer
/',
138 'playlist_mincount
': 6,
140 'id': 'i
-am
-hacked
-trailer
',
143 'url
': 'https
://rtd
.rt
.com
/shows
/the
-kalashnikova
-show
-military
-secrets
-anna
-knishenko
/',
144 'playlist_mincount
': 34,
146 'id': 'the
-kalashnikova
-show
-military
-secrets
-anna
-knishenko
',
150 def _entries(self, webpage, id):
151 video_urls = set(re.findall(r'list-2__link\s
*"\s*href="([^
"]+)"', webpage))
152 for v_url in video_urls:
155 yield self.url_result(
156 'https
://rtd
.rt
.com
%s' % v_url,
157 ie=RTDocumentryIE.ie_key())
159 def _real_extract(self, url):
160 id = self._match_id(url)
161 webpage = self._download_webpage(url, id)
166 'entries
': self._entries(webpage, id),
170 class RuptlyIE(InfoExtractor):
171 _VALID_URL = r'https?
://(?
:www\
.)?ruptly\
.tv
/[a
-z
]{2}
/videos
/(?P
<id>\d
+-\d
+)'
174 'url
': 'https
://www
.ruptly
.tv
/en
/videos
/20220112-020-Japan
-Double
-trouble
-Tokyo
-zoo
-presents
-adorable
-panda
-twins
',
176 'id': '20220112-020',
178 'title
': 'Japan
: Double trouble
! Tokyo zoo presents adorable panda twins | Video Ruptly
',
179 'description
': 'md5
:85a8da5fdb31486f0562daf4360ce75a
',
180 'thumbnail
': 'https
://storage
.ruptly
.tv
/thumbnails
/20220112-020/i6JQKnTNpYuqaXsR
/i6JQKnTNpYuqaXsR
.jpg
'
182 'params
': {'skip_download': True}
185 def _real_extract(self, url):
186 id = self._match_id(url)
187 webpage = self._download_webpage(url, id)
188 m3u8_url = self._search_regex(r'preview_url
"\s?:\s?"(https?
://storage\
.ruptly\
.tv
/video_projects
/.+\
.m3u8
)"', webpage, 'm3u8 url', fatal=False)
190 self.raise_no_formats('No video/audio found at the provided url.', expected=True)
191 formats, subs = self._extract_m3u8_formats_and_subtitles(m3u8_url, id, ext='mp4')
196 'title': self._og_search_title(webpage),
197 'description': self._og_search_description(webpage),
198 'thumbnail': self._og_search_thumbnail(webpage),