4 from .common
import InfoExtractor
5 from ..compat
import compat_HTTPError
20 class RumbleEmbedIE(InfoExtractor
):
21 _VALID_URL
= r
'https?://(?:www\.)?rumble\.com/embed/(?:[0-9a-z]+\.)?(?P<id>[0-9a-z]+)'
22 _EMBED_REGEX
= [fr
'(?:<(?:script|iframe)[^>]+\bsrc=|["\']embedUrl
["\']\s*:\s*)["\'](?P
<url
>{_VALID_URL}
)']
24 'url
': 'https
://rumble
.com
/embed
/v5pv5f
',
25 'md5
': '36a18a049856720189f30977ccbb2c34
',
29 'title
': 'WMAR
2 News Latest Headlines | October
20, 6pm
',
30 'timestamp
': 1571611968,
31 'upload_date
': '20191020',
32 'channel_url
': 'https
://rumble
.com
/c
/WMAR
',
34 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/1/5/M
/z
/1/5Mz1a
.OvCc
-small
-WMAR
-2-News
-Latest
-Headline
.jpg
',
37 'live_status
': 'not_live
',
40 'url
': 'https
://rumble
.com
/embed
/vslb7v
',
41 'md5
': '7418035de1a30a178b8af34dc2b6a52b
',
45 'title
': 'Defense Sec
. says US Commitment to NATO Defense
\'Ironclad
\'',
46 'timestamp
': 1645142135,
47 'upload_date
': '20220217',
48 'channel_url
': 'https
://rumble
.com
/c
/CyberTechNews
',
50 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/6/7/i
/9/h
/7i9hd
.OvCc
.jpg
',
53 'live_status
': 'not_live
',
56 'url
': 'https
://rumble
.com
/embed
/vunh1h
',
60 'title
': '‘Gideon
, op zoek naar de waarheid’ including ENG SUBS
',
61 'timestamp
': 1647197663,
62 'upload_date
': '20220313',
63 'channel_url
': 'https
://rumble
.com
/user
/BLCKBX
',
65 'thumbnail
': r're
:https
://.+\
.jpg
',
68 'live_status
': 'not_live
',
72 'url
': r're
:https
://.+\
.vtt
',
79 'params
': {'skip_download': True}
81 'url
': 'https
://rumble
.com
/embed
/v1essrt
',
85 'title
': 'startswith
:lofi hip hop radio
- beats to relax
/study
',
86 'timestamp
': 1661519399,
87 'upload_date
': '20220826',
88 'channel_url
': 'https
://rumble
.com
/c
/LofiGirl
',
89 'channel
': 'Lofi Girl
',
90 'thumbnail
': r're
:https
://.+\
.jpg
',
92 'uploader
': 'Lofi Girl
',
93 'live_status
': 'is_live
',
95 'params
': {'skip_download': True}
97 'url
': 'https
://rumble
.com
/embed
/v1amumr
',
102 'title
': 'Turning Point USA
2022 Student Action Summit DAY
1 - Rumble Exclusive Live
',
103 'timestamp
': 1658518457,
104 'upload_date
': '20220722',
105 'channel_url
': 'https
://rumble
.com
/c
/RumbleEvents
',
106 'channel
': 'Rumble Events
',
107 'thumbnail
': r're
:https
://.+\
.jpg
',
109 'uploader
': 'Rumble Events
',
110 'live_status
': 'was_live
',
112 'params
': {'skip_download': True}
114 'url
': 'https
://rumble
.com
/embed
/ufe9n
.v5pv5f
',
115 'only_matching
': True,
120 'note
': 'Rumble JS embed
',
121 '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
',
122 'md5
': '4701209ac99095592e73dbba21889690
',
126 'channel
': 'Mr Producer Media
',
128 'title
': '911 Audio From The Man Who Wanted To Kill Supreme Court Justice Kavanaugh
',
129 'channel_url
': 'https
://rumble
.com
/c
/RichSementa
',
130 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/1/P
/j
/f
/A
/PjfAe
.OvCc
-small
-911-Audio
-From
-The
-Man
-Who
-.jpg
',
131 'timestamp
': 1654892716,
132 'uploader
': 'Mr Producer Media
',
133 'upload_date
': '20220610',
134 'live_status
': 'not_live
',
140 def _extract_embed_urls(cls, url, webpage):
141 embeds = tuple(super()._extract_embed_urls(url, webpage))
144 return [f'https
://rumble
.com
/embed
/{mobj.group("id")}
' for mobj in re.finditer(
145 r'<script
>\s
*Rumble\
(\s
*"play"\s
*,\s
*{\s
*[\'"]video[\'"]\s
*:\s
*[\'"](?P<id>[0-9a-z]+)[\'"]', webpage)]
147 def _real_extract(self, url):
148 video_id = self._match_id(url)
149 video = self._download_json(
150 'https
://rumble
.com
/embedJS
/u3
/', video_id,
151 query={'request': 'video', 'ver': 2, 'v': video_id})
153 sys_msg = traverse_obj(video, ('sys
', 'msg
'))
155 self.report_warning(sys_msg, video_id=video_id)
157 if video.get('live
') == 0:
158 live_status = 'not_live
' if video.get('livestream_has_dvr
') is None else 'was_live
'
159 elif video.get('live
') == 1:
160 live_status = 'is_upcoming
' if video.get('livestream_has_dvr
') else 'was_live
'
161 elif video.get('live
') == 2:
162 live_status = 'is_live
'
167 for ext, ext_info in (video.get('ua
') or {}).items():
168 for height, video_info in (ext_info or {}).items():
169 meta = video_info.get('meta
') or {}
170 if not video_info.get('url
'):
173 if meta.get('live
') is True and video.get('live
') == 1:
174 live_status = 'post_live
'
175 formats.extend(self._extract_m3u8_formats(
176 video_info['url
'], video_id,
177 ext='mp4
', m3u8_id='hls
', fatal=False, live=live_status == 'is_live
'))
179 timeline = ext == 'timeline
'
181 ext = determine_ext(video_info['url
'])
184 'acodec
': 'none
' if timeline else None,
185 'url
': video_info['url
'],
186 'format_id
': '%s-%sp
' % (ext, height),
187 'format_note
': 'Timeline
' if timeline else None,
188 'fps
': None if timeline else video.get('fps
'),
189 **traverse_obj(meta, {
194 }, expected_type=lambda x: int(x) or None)
199 'url
': sub_info['path
'],
200 'name
': sub_info.get('language
') or '',
201 }] for lang, sub_info in (video.get('cc
') or {}).items() if sub_info.get('path
')
204 author = video.get('author
') or {}
205 thumbnails = traverse_obj(video, ('t
', ..., {'url': 'i', 'width': 'w', 'height': 'h'}))
206 if not thumbnails and video.get('i
'):
207 thumbnails = [{'url': video['i']}]
209 if live_status in {'is_live', 'post_live'}:
212 duration = int_or_none(video.get('duration
'))
216 'title
': unescapeHTML(video.get('title
')),
218 'subtitles
': subtitles,
219 'thumbnails
': thumbnails,
220 'timestamp
': parse_iso8601(video.get('pubDate
')),
221 'channel
': author.get('name
'),
222 'channel_url
': author.get('url
'),
223 'duration
': duration,
224 'uploader
': author.get('name
'),
225 'live_status
': live_status,
229 class RumbleIE(InfoExtractor):
230 _VALID_URL = r'https?
://(?
:www\
.)?rumble\
.com
/(?P
<id>v(?
!ideos
)[\w
.-]+)[^
/]*$
'
231 _EMBED_REGEX = [r'<a
class=video
-item
--a href
=(?P
<url
>/v
[\w
.-]+\
.html
)>']
233 'add_ie
': ['RumbleEmbed
'],
234 'url
': 'https
://rumble
.com
/vdmum1
-moose
-the
-dog
-helps
-girls
-dig
-a
-snow
-fort
.html
',
235 'md5
': '53af34098a7f92c4e51cf0bd1c33f009
',
239 'timestamp
': 1612662578,
240 'uploader
': 'LovingMontana
',
241 'channel
': 'LovingMontana
',
242 'upload_date
': '20210207',
243 'title
': 'Winter
-loving dog helps girls dig a snow fort
',
244 'description
': 'Moose the dog
is more than happy to
help with digging out this epic snow fort
. Great job
, Moose
!',
245 'channel_url
': 'https
://rumble
.com
/c
/c
-546523',
246 'thumbnail
': r're
:https
://.+\
.jpg
',
250 'live_status
': 'not_live
',
253 'url
': 'http
://www
.rumble
.com
/vDMUM1?key
=value
',
254 'only_matching
': True,
256 'note
': 'timeline format
',
257 'url
': 'https
://rumble
.com
/v2ea9qb
-the
-u
.s
.-cannot
-hide
-this
-in-ukraine
-anymore
-redacted
-with-natali
-and-clayt
.html
',
258 'md5
': '40d61fec6c0945bca3d0e1dc1aa53d79
',
259 'params
': {'format': 'wv'},
263 'uploader
': 'Redacted News
',
264 'upload_date
': '20230322',
265 'timestamp
': 1679445010,
266 'title
': 'The U
.S
. CANNOT hide this
in Ukraine anymore | Redacted
with Natali
and Clayton Morris
',
268 'channel
': 'Redacted News
',
269 'description
': 'md5
:aaad0c5c3426d7a361c29bdaaced7c42
',
270 'channel_url
': 'https
://rumble
.com
/c
/Redacted
',
271 'live_status
': 'not_live
',
272 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/1/d
/x
/2/O
/dx2Oi
.qR4e
-small
-The
-U
.S
.-CANNOT
-hide
-this
-i
.jpg
',
277 'url
': 'https
://rumble
.com
/videos?page
=2',
278 'playlist_count
': 25,
280 'id': 'videos?page
=2',
281 'title
': 'All videos
',
282 'description
': 'Browse videos uploaded to Rumble
.com
',
286 'url
': 'https
://rumble
.com
/live
-videos
',
287 'playlist_mincount
': 19,
290 'title
': 'Live Videos
',
291 'description
': 'Live videos on Rumble
.com
',
295 'url
': 'https
://rumble
.com
/search
/video?q
=rumble
&sort
=views
',
296 'playlist_count
': 24,
298 'id': 'video?q
=rumble
&sort
=views
',
299 'title
': 'Search results
for: rumble
',
304 def _real_extract(self, url):
305 page_id = self._match_id(url)
306 webpage = self._download_webpage(url, page_id)
307 url_info = next(RumbleEmbedIE.extract_from_webpage(self._downloader, url, webpage), None)
309 raise UnsupportedError(url)
311 release_ts_str = self._search_regex(
312 r'(?
:Livestream begins|Streamed on
):\s
+<time datetime
="([^"]+)',
313 webpage, 'release date
', fatal=False, default=None)
314 view_count_str = self._search_regex(r'<span
class="media-heading-info">([\d
,]+) Views
',
315 webpage, 'view count
', fatal=False, default=None)
317 return self.url_result(
318 url_info['url
'], ie_key=url_info['ie_key
'], url_transparent=True,
319 view_count=parse_count(view_count_str),
320 release_timestamp=parse_iso8601(release_ts_str),
321 like_count=parse_count(get_element_by_class('rumbles
-count
', webpage)),
322 description=clean_html(get_element_by_class('media
-description
', webpage)),
326 class RumbleChannelIE(InfoExtractor):
327 _VALID_URL = r'(?P
<url
>https?
://(?
:www\
.)?rumble\
.com
/(?
:c|user
)/(?P
<id>[^
&?
#$/]+))'
330 'url': 'https://rumble.com/c/Styxhexenhammer666',
331 'playlist_mincount': 1160,
333 'id': 'Styxhexenhammer666',
336 'url': 'https://rumble.com/user/goldenpoodleharleyeuna',
337 'playlist_mincount': 4,
339 'id': 'goldenpoodleharleyeuna',
343 def entries(self
, url
, playlist_id
):
344 for page
in itertools
.count(1):
346 webpage
= self
._download
_webpage
(f
'{url}?page={page}', playlist_id
, note
='Downloading page %d' % page
)
347 except ExtractorError
as e
:
348 if isinstance(e
.cause
, compat_HTTPError
) and e
.cause
.code
== 404:
351 for video_url
in re
.findall(r
'class=video-item--a\s?href=([^>]+\.html)', webpage
):
352 yield self
.url_result('https://rumble.com' + video_url
)
354 def _real_extract(self
, url
):
355 url
, playlist_id
= self
._match
_valid
_url
(url
).groups()
356 return self
.playlist_result(self
.entries(url
, playlist_id
), playlist_id
=playlist_id
)