4 from .common
import InfoExtractor
5 from ..networking
.exceptions
import HTTPError
22 class RumbleEmbedIE(InfoExtractor
):
23 _VALID_URL
= r
'https?://(?:www\.)?rumble\.com/embed/(?:[0-9a-z]+\.)?(?P<id>[0-9a-z]+)'
24 _EMBED_REGEX
= [fr
'(?:<(?:script|iframe)[^>]+\bsrc=|["\']embedUrl
["\']\s*:\s*)["\'](?P
<url
>{_VALID_URL}
)']
26 'url
': 'https
://rumble
.com
/embed
/v5pv5f
',
27 'md5
': '36a18a049856720189f30977ccbb2c34
',
31 'title
': 'WMAR
2 News Latest Headlines | October
20, 6pm
',
32 'timestamp
': 1571611968,
33 'upload_date
': '20191020',
34 'channel_url
': 'https
://rumble
.com
/c
/WMAR
',
36 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/1/5/M
/z
/1/5Mz1a
.qR4e
-small
-WMAR
-2-News
-Latest
-Headline
.jpg
',
39 'live_status
': 'not_live
',
42 'url
': 'https
://rumble
.com
/embed
/vslb7v
',
43 'md5
': '7418035de1a30a178b8af34dc2b6a52b
',
47 'title
': 'Defense Sec
. says US Commitment to NATO Defense
\'Ironclad
\'',
48 'timestamp
': 1645142135,
49 'upload_date
': '20220217',
50 'channel_url
': 'https
://rumble
.com
/c
/CyberTechNews
',
52 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/6/7/i
/9/h
/7i9hd
.OvCc
.jpg
',
55 'live_status
': 'not_live
',
58 'url
': 'https
://rumble
.com
/embed
/vunh1h
',
62 'title
': '‘Gideon
, op zoek naar de waarheid’ including ENG SUBS
',
63 'timestamp
': 1647197663,
64 'upload_date
': '20220313',
65 'channel_url
': 'https
://rumble
.com
/user
/BLCKBX
',
67 'thumbnail
': r're
:https
://.+\
.jpg
',
70 'live_status
': 'not_live
',
74 'url
': r're
:https
://.+\
.vtt
',
81 'params
': {'skip_download': True}
83 'url
': 'https
://rumble
.com
/embed
/v1essrt
',
87 'title
': 'startswith
:lofi hip hop radio 📚
- beats to relax
/study to
',
88 'timestamp
': 1661519399,
89 'upload_date
': '20220826',
90 'channel_url
': 'https
://rumble
.com
/c
/LofiGirl
',
91 'channel
': 'Lofi Girl
',
92 'thumbnail
': r're
:https
://.+\
.jpg
',
94 'uploader
': 'Lofi Girl
',
95 'live_status
': 'is_live
',
97 'params
': {'skip_download': True}
99 'url
': 'https
://rumble
.com
/embed
/v1amumr
',
104 'title
': 'Turning Point USA
2022 Student Action Summit DAY
1 - Rumble Exclusive Live
',
105 'timestamp
': 1658518457,
106 'upload_date
': '20220722',
107 'channel_url
': 'https
://rumble
.com
/c
/RumbleEvents
',
108 'channel
': 'Rumble Events
',
109 'thumbnail
': r're
:https
://.+\
.jpg
',
111 'uploader
': 'Rumble Events
',
112 'live_status
': 'was_live
',
114 'params
': {'skip_download': True}
116 'url
': 'https
://rumble
.com
/embed
/ufe9n
.v5pv5f
',
117 'only_matching
': True,
122 'note
': 'Rumble JS embed
',
123 'url
': 'https
://therightscoop
.com
/what
-does
-9-plus
-1-plus
-1-equal
-listen
-to
-this
-audio
-of
-attempted
-kavanaugh
-assassins
-call
-and-youll
-get
-it
',
124 'md5
': '4701209ac99095592e73dbba21889690
',
128 'channel
': 'Mr Producer Media
',
130 'title
': '911 Audio From The Man Who Wanted To Kill Supreme Court Justice Kavanaugh
',
131 'channel_url
': 'https
://rumble
.com
/c
/RichSementa
',
132 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/1/P
/j
/f
/A
/PjfAe
.qR4e
-small
-911-Audio
-From
-The
-Man
-Who
-.jpg
',
133 'timestamp
': 1654892716,
134 'uploader
': 'Mr Producer Media
',
135 'upload_date
': '20220610',
136 'live_status
': 'not_live
',
142 def _extract_embed_urls(cls, url, webpage):
143 embeds = tuple(super()._extract_embed_urls(url, webpage))
146 return [f'https
://rumble
.com
/embed
/{mobj.group("id")}
' for mobj in re.finditer(
147 r'<script
>[^
<]*\bRumble\
(\s
*"play"\s
*,\s
*{[^}
]*[\'"]?video[\'"]?\s
*:\s
*[\'"](?P<id>[0-9a-z]+)[\'"]', webpage)]
149 def _real_extract(self, url):
150 video_id = self._match_id(url)
151 video = self._download_json(
152 'https
://rumble
.com
/embedJS
/u3
/', video_id,
153 query={'request': 'video', 'ver': 2, 'v': video_id})
155 sys_msg = traverse_obj(video, ('sys
', 'msg
'))
157 self.report_warning(sys_msg, video_id=video_id)
159 if video.get('live
') == 0:
160 live_status = 'not_live
' if video.get('livestream_has_dvr
') is None else 'was_live
'
161 elif video.get('live
') == 1:
162 live_status = 'is_upcoming
' if video.get('livestream_has_dvr
') else 'was_live
'
163 elif video.get('live
') == 2:
164 live_status = 'is_live
'
169 for ext, ext_info in (video.get('ua
') or {}).items():
170 if isinstance(ext_info, dict):
171 for height, video_info in ext_info.items():
172 if not traverse_obj(video_info, ('meta
', 'h
', {int_or_none})):
173 video_info.setdefault('meta
', {})['h
'] = height
174 ext_info = ext_info.values()
176 for video_info in ext_info:
177 meta = video_info.get('meta
') or {}
178 if not video_info.get('url
'):
181 if meta.get('live
') is True and video.get('live
') == 1:
182 live_status = 'post_live
'
183 formats.extend(self._extract_m3u8_formats(
184 video_info['url
'], video_id,
185 ext='mp4
', m3u8_id='hls
', fatal=False, live=live_status == 'is_live
'))
187 timeline = ext == 'timeline
'
189 ext = determine_ext(video_info['url
'])
192 'acodec
': 'none
' if timeline else None,
193 'url
': video_info['url
'],
194 'format_id
': join_nonempty(ext, format_field(meta, 'h
', '%sp
')),
195 'format_note
': 'Timeline
' if timeline else None,
196 'fps
': None if timeline else video.get('fps
'),
197 **traverse_obj(meta, {
202 }, expected_type=lambda x: int(x) or None)
207 'url
': sub_info['path
'],
208 'name
': sub_info.get('language
') or '',
209 }] for lang, sub_info in (video.get('cc
') or {}).items() if sub_info.get('path
')
212 author = video.get('author
') or {}
213 thumbnails = traverse_obj(video, ('t
', ..., {'url': 'i', 'width': 'w', 'height': 'h'}))
214 if not thumbnails and video.get('i
'):
215 thumbnails = [{'url': video['i']}]
217 if live_status in {'is_live', 'post_live'}:
220 duration = int_or_none(video.get('duration
'))
224 'title
': unescapeHTML(video.get('title
')),
226 'subtitles
': subtitles,
227 'thumbnails
': thumbnails,
228 'timestamp
': parse_iso8601(video.get('pubDate
')),
229 'channel
': author.get('name
'),
230 'channel_url
': author.get('url
'),
231 'duration
': duration,
232 'uploader
': author.get('name
'),
233 'live_status
': live_status,
237 class RumbleIE(InfoExtractor):
238 _VALID_URL = r'https?
://(?
:www\
.)?rumble\
.com
/(?P
<id>v(?
!ideos
)[\w
.-]+)[^
/]*$
'
240 r'<a
class=video
-item
--a href
=(?P
<url
>/v
[\w
.-]+\
.html
)>',
241 r'<a
[^
>]+class="videostream__link link"[^
>]+href
=(?P
<url
>/v
[\w
.-]+\
.html
)[^
>]*>']
243 'add_ie
': ['RumbleEmbed
'],
244 'url
': 'https
://rumble
.com
/vdmum1
-moose
-the
-dog
-helps
-girls
-dig
-a
-snow
-fort
.html
',
245 'md5
': '53af34098a7f92c4e51cf0bd1c33f009
',
249 'timestamp
': 1612662578,
250 'uploader
': 'LovingMontana
',
251 'channel
': 'LovingMontana
',
252 'upload_date
': '20210207',
253 'title
': 'Winter
-loving dog helps girls dig a snow fort
',
254 'description
': 'Moose the dog
is more than happy to
help with digging out this epic snow fort
. Great job
, Moose
!',
255 'channel_url
': 'https
://rumble
.com
/c
/c
-546523',
256 'thumbnail
': r're
:https
://.+\
.jpg
',
259 'dislike_count
': int,
261 'live_status
': 'not_live
',
264 'url
': 'http
://www
.rumble
.com
/vDMUM1?key
=value
',
265 'only_matching
': True,
267 'note
': 'timeline format
',
268 'url
': 'https
://rumble
.com
/v2ea9qb
-the
-u
.s
.-cannot
-hide
-this
-in-ukraine
-anymore
-redacted
-with-natali
-and-clayt
.html
',
269 'md5
': '40d61fec6c0945bca3d0e1dc1aa53d79
',
270 'params
': {'format': 'wv'},
274 'uploader
': 'Redacted News
',
275 'upload_date
': '20230322',
276 'timestamp
': 1679445010,
277 'title
': 'The U
.S
. CANNOT hide this
in Ukraine anymore | Redacted
with Natali
and Clayton Morris
',
279 'channel
': 'Redacted News
',
280 'description
': 'md5
:aaad0c5c3426d7a361c29bdaaced7c42
',
281 'channel_url
': 'https
://rumble
.com
/c
/Redacted
',
282 'live_status
': 'not_live
',
283 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/1/d
/x
/2/O
/dx2Oi
.qR4e
-small
-The
-U
.S
.-CANNOT
-hide
-this
-i
.jpg
',
285 'dislike_count
': int,
289 'url
': 'https
://rumble
.com
/v2e7fju
-the
-covid
-twitter
-files
-drop
-protecting
-fauci
-while-censoring
-the
-truth
-wma
.html
',
293 'live_status
': 'was_live
',
294 'release_timestamp
': 1679446804,
295 'description
': 'md5
:2ac4908ccfecfb921f8ffa4b30c1e636
',
296 'release_date
': '20230322',
297 'timestamp
': 1679445692,
299 'upload_date
': '20230322',
300 'title
': 'The Covid Twitter Files Drop
: Protecting Fauci While Censoring The Truth w
/Matt Taibbi
',
301 'uploader
': 'Kim Iversen
',
302 'channel_url
': 'https
://rumble
.com
/c
/KimIversen
',
303 'channel
': 'Kim Iversen
',
304 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/1/6/b
/w
/O
/6bwOi
.qR4e
-small
-The
-Covid
-Twitter
-Files
-Dro
.jpg
',
306 'dislike_count
': int,
312 'url
': 'https
://rumble
.com
/videos?page
=2',
313 'playlist_mincount
': 24,
315 'id': 'videos?page
=2',
316 'title
': 'All videos
',
317 'description
': 'Browse videos uploaded to Rumble
.com
',
321 'url
': 'https
://rumble
.com
/browse
/live
',
322 'playlist_mincount
': 25,
329 'url
': 'https
://rumble
.com
/search
/video?q
=rumble
&sort
=views
',
330 'playlist_mincount
': 24,
332 'id': 'video?q
=rumble
&sort
=views
',
333 'title
': 'Search results
for: rumble
',
338 def _real_extract(self, url):
339 page_id = self._match_id(url)
340 webpage = self._download_webpage(url, page_id)
341 url_info = next(RumbleEmbedIE.extract_from_webpage(self._downloader, url, webpage), None)
343 raise UnsupportedError(url)
346 '_type
': 'url_transparent
',
347 'ie_key
': url_info['ie_key
'],
348 'url
': url_info['url
'],
349 'release_timestamp
': parse_iso8601(self._search_regex(
350 r'(?
:Livestream begins|Streamed on
):\s
+<time datetime
="([^"]+)', webpage, 'release date
', default=None)),
351 'view_count
': int_or_none(self._search_regex(
352 r'"userInteractionCount"\s
*:\s
*(\d
+)', webpage, 'view count
', default=None)),
353 'like_count
': parse_count(self._search_regex(
354 r'<span data
-js
="rumbles_up_votes">\s
*([\d
,.KM
]+)', webpage, 'like count
', default=None)),
355 'dislike_count
': parse_count(self._search_regex(
356 r'<span data
-js
="rumbles_down_votes">\s
*([\d
,.KM
]+)', webpage, 'dislike count
', default=None)),
357 'description
': clean_html(get_element_by_class('media
-description
', webpage))
361 class RumbleChannelIE(InfoExtractor):
362 _VALID_URL = r'(?P
<url
>https?
://(?
:www\
.)?rumble\
.com
/(?
:c|user
)/(?P
<id>[^
&?
#$/]+))'
365 'url': 'https://rumble.com/c/Styxhexenhammer666',
366 'playlist_mincount': 1160,
368 'id': 'Styxhexenhammer666',
371 'url': 'https://rumble.com/user/goldenpoodleharleyeuna',
372 'playlist_mincount': 4,
374 'id': 'goldenpoodleharleyeuna',
378 def entries(self
, url
, playlist_id
):
379 for page
in itertools
.count(1):
381 webpage
= self
._download
_webpage
(f
'{url}?page={page}', playlist_id
, note
='Downloading page %d' % page
)
382 except ExtractorError
as e
:
383 if isinstance(e
.cause
, HTTPError
) and e
.cause
.status
== 404:
386 for video_url
in re
.findall(r
'class=video-item--a\s?href=([^>]+\.html)', webpage
):
387 yield self
.url_result('https://rumble.com' + video_url
)
389 def _real_extract(self
, url
):
390 url
, playlist_id
= self
._match
_valid
_url
(url
).groups()
391 return self
.playlist_result(self
.entries(url
, playlist_id
), playlist_id
=playlist_id
)