3 from .common
import InfoExtractor
4 from ..utils
import js_to_json
7 class RTNewsIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(?:www\.)?rt\.com/[^/]+/(?:[^/]+/)?(?P<id>\d+)'
11 'url': 'https://www.rt.com/sport/546301-djokovic-arrives-belgrade-crowds/',
12 'playlist_mincount': 2,
15 'title': 'Crowds gather to greet deported Djokovic as he returns to Serbia (VIDEO)',
16 'description': 'md5:1d5bfe1a988d81fd74227cfdf93d314d',
17 'thumbnail': 'https://cdni.rt.com/files/2022.01/article/61e587a085f540102c3386c1.png',
20 'url': 'https://www.rt.com/shows/in-question/535980-plot-to-assassinate-julian-assange/',
21 'playlist_mincount': 1,
24 'title': 'The plot to assassinate Julian Assange',
25 'description': 'md5:55279ce5e4441dc1d16e2e4a730152cd',
26 'thumbnail': 'https://cdni.rt.com/files/2021.09/article/615226f42030274e8879b53d.png',
30 'id': '6152271d85f5400464496162',
32 'title': '6152271d85f5400464496162',
37 def _entries(self
, webpage
):
38 video_urls
= set(re
.findall(r
'https://cdnv\.rt\.com/.*[a-f0-9]+\.mp4', webpage
))
39 for v_url
in video_urls
:
40 v_id
= re
.search(r
'([a-f0-9]+)\.mp4', v_url
).group(1)
48 def _real_extract(self
, url
):
49 playlist_id
= self
._match
_id
(url
)
50 webpage
= self
._download
_webpage
(url
, playlist_id
)
55 'entries': self
._entries
(webpage
),
56 'title': self
._og
_search
_title
(webpage
),
57 'description': self
._og
_search
_description
(webpage
),
58 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
62 class RTDocumentryIE(InfoExtractor
):
63 _VALID_URL
= r
'https?://rtd\.rt\.com/(?:(?:series|shows)/[^/]+|films)/(?P<id>[^/?$&#]+)'
66 'url': 'https://rtd.rt.com/films/escobars-hitman/',
68 'id': 'escobars-hitman',
70 'title': "Escobar's Hitman. Former drug-gang killer, now loved and loathed in Colombia",
71 'description': 'md5:647c76984b7cb9a8b52a567e87448d88',
72 'thumbnail': 'https://cdni.rt.com/rtd-files/films/escobars-hitman/escobars-hitman_11.jpg',
73 'average_rating': 8.53,
76 'params': {'skip_download': True},
78 'url': 'https://rtd.rt.com/shows/the-kalashnikova-show-military-secrets-anna-knishenko/iskander-tactical-system-natos-headache/',
80 'id': 'iskander-tactical-system-natos-headache',
82 'title': "Iskander tactical system. NATO's headache | The Kalashnikova Show. Episode 10",
83 'description': 'md5:da7c24a0aa67bc2bb88c86658508ca87',
84 'thumbnail': 'md5:89de8ce38c710b7c501ff02d47e2aa89',
85 'average_rating': 9.27,
87 'timestamp': 1605726000,
89 'upload_date': '20201118',
91 'params': {'skip_download': True},
93 'url': 'https://rtd.rt.com/series/i-am-hacked-trailer/introduction-to-safe-digital-life-ep2/',
95 'id': 'introduction-to-safe-digital-life-ep2',
97 'title': 'How to Keep your Money away from Hackers | I am Hacked. Episode 2',
98 'description': 'md5:c46fa9a5af86c0008c45a3940a8cce87',
99 'thumbnail': 'md5:a5e81b9bf5aed8f5e23d9c053601b825',
100 'average_rating': 10.0,
102 'timestamp': 1636977600,
104 'upload_date': '20211115',
106 'params': {'skip_download': True},
109 def _real_extract(self
, url
):
110 video_id
= self
._match
_id
(url
)
111 webpage
= self
._download
_webpage
(url
, video_id
)
112 ld_json
= self
._search
_json
_ld
(webpage
, None, fatal
=False)
114 self
.raise_no_formats('No video/audio found at the provided url.', expected
=True)
115 media_json
= self
._parse
_json
(
116 self
._search
_regex
(r
'(?s)\'Med
\'\s
*:\s
*\
[\s
*({.+})\s
*\
]\s
*};', webpage, 'media info
'),
117 video_id, transform_source=js_to_json)
118 if 'title
' not in ld_json and 'title
' in media_json:
119 ld_json['title
'] = media_json['title
']
120 formats = [{'url
': src['file']} for src in media_json.get('sources
') or [] if src.get('file')]
124 'thumbnail
': media_json.get('image
'),
130 class RTDocumentryPlaylistIE(InfoExtractor):
131 _VALID_URL = r'https?
://rtd\
.rt\
.com
/(?
:series|shows
)/(?P
<id>[^
/]+)/$
'
134 'url
': 'https
://rtd
.rt
.com
/series
/i
-am
-hacked
-trailer
/',
135 'playlist_mincount
': 6,
137 'id': 'i
-am
-hacked
-trailer
',
140 'url
': 'https
://rtd
.rt
.com
/shows
/the
-kalashnikova
-show
-military
-secrets
-anna
-knishenko
/',
141 'playlist_mincount
': 34,
143 'id': 'the
-kalashnikova
-show
-military
-secrets
-anna
-knishenko
',
147 def _entries(self, webpage, playlist_id):
148 video_urls = set(re.findall(r'list-2__link\s
*"\s*href="([^
"]+)"', webpage))
149 for v_url in video_urls:
150 if playlist_id not in v_url:
152 yield self.url_result(
153 f'https
://rtd
.rt
.com{v_url}
',
154 ie=RTDocumentryIE.ie_key())
156 def _real_extract(self, url):
157 playlist_id = self._match_id(url)
158 webpage = self._download_webpage(url, playlist_id)
163 'entries
': self._entries(webpage, playlist_id),
167 class RuptlyIE(InfoExtractor):
168 _VALID_URL = r'https?
://(?
:www\
.)?ruptly\
.tv
/[a
-z
]{2}
/videos
/(?P
<id>\d
+-\d
+)'
171 'url
': 'https
://www
.ruptly
.tv
/en
/videos
/20220112-020-Japan
-Double
-trouble
-Tokyo
-zoo
-presents
-adorable
-panda
-twins
',
173 'id': '20220112-020',
175 'title
': 'Japan
: Double trouble
! Tokyo zoo presents adorable panda twins | Video Ruptly
',
176 'description
': 'md5
:85a8da5fdb31486f0562daf4360ce75a
',
177 'thumbnail
': 'https
://storage
.ruptly
.tv
/thumbnails
/20220112-020/i6JQKnTNpYuqaXsR
/i6JQKnTNpYuqaXsR
.jpg
',
179 'params
': {'skip_download
': True},
182 def _real_extract(self, url):
183 video_id = self._match_id(url)
184 webpage = self._download_webpage(url, video_id)
185 m3u8_url = self._search_regex(r'preview_url
"\s?:\s?"(https?
://storage\
.ruptly\
.tv
/video_projects
/.+\
.m3u8
)"', webpage, 'm3u8 url', fatal=False)
187 self.raise_no_formats('No video/audio found at the provided url.', expected=True)
188 formats, subs = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, ext='mp4')
193 'title': self._og_search_title(webpage),
194 'description': self._og_search_description(webpage),
195 'thumbnail': self._og_search_thumbnail(webpage),