4 from .common
import InfoExtractor
5 from ..compat
import compat_HTTPError
19 class RumbleEmbedIE(InfoExtractor
):
20 _VALID_URL
= r
'https?://(?:www\.)?rumble\.com/embed/(?:[0-9a-z]+\.)?(?P<id>[0-9a-z]+)'
21 _EMBED_REGEX
= [fr
'(?:<(?:script|iframe)[^>]+\bsrc=|["\']embedUrl
["\']\s*:\s*)["\'](?P
<url
>{_VALID_URL}
)']
23 'url
': 'https
://rumble
.com
/embed
/v5pv5f
',
24 'md5
': '36a18a049856720189f30977ccbb2c34
',
28 'title
': 'WMAR
2 News Latest Headlines | October
20, 6pm
',
29 'timestamp
': 1571611968,
30 'upload_date
': '20191020',
31 'channel_url
': 'https
://rumble
.com
/c
/WMAR
',
33 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/1/5/M
/z
/1/5Mz1a
.OvCc
-small
-WMAR
-2-News
-Latest
-Headline
.jpg
',
36 'live_status
': 'not_live
',
39 'url
': 'https
://rumble
.com
/embed
/vslb7v
',
40 'md5
': '7418035de1a30a178b8af34dc2b6a52b
',
44 'title
': 'Defense Sec
. says US Commitment to NATO Defense
\'Ironclad
\'',
45 'timestamp
': 1645142135,
46 'upload_date
': '20220217',
47 'channel_url
': 'https
://rumble
.com
/c
/CyberTechNews
',
49 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/6/7/i
/9/h
/7i9hd
.OvCc
.jpg
',
52 'live_status
': 'not_live
',
55 'url
': 'https
://rumble
.com
/embed
/vunh1h
',
59 'title
': '‘Gideon
, op zoek naar de waarheid’ including ENG SUBS
',
60 'timestamp
': 1647197663,
61 'upload_date
': '20220313',
62 'channel_url
': 'https
://rumble
.com
/user
/BLCKBX
',
64 'thumbnail
': r're
:https
://.+\
.jpg
',
67 'live_status
': 'not_live
',
71 'url
': r're
:https
://.+\
.vtt
',
78 'params
': {'skip_download': True}
80 'url
': 'https
://rumble
.com
/embed
/v1essrt
',
84 'title
': 'startswith
:lofi hip hop radio
- beats to relax
/study
',
85 'timestamp
': 1661519399,
86 'upload_date
': '20220826',
87 'channel_url
': 'https
://rumble
.com
/c
/LofiGirl
',
88 'channel
': 'Lofi Girl
',
89 'thumbnail
': r're
:https
://.+\
.jpg
',
91 'uploader
': 'Lofi Girl
',
92 'live_status
': 'is_live
',
94 'params
': {'skip_download': True}
96 'url
': 'https
://rumble
.com
/embed
/v1amumr
',
101 'title
': 'Turning Point USA
2022 Student Action Summit DAY
1 - Rumble Exclusive Live
',
102 'timestamp
': 1658518457,
103 'upload_date
': '20220722',
104 'channel_url
': 'https
://rumble
.com
/c
/RumbleEvents
',
105 'channel
': 'Rumble Events
',
106 'thumbnail
': r're
:https
://.+\
.jpg
',
108 'uploader
': 'Rumble Events
',
109 'live_status
': 'was_live
',
111 'params
': {'skip_download': True}
113 'url
': 'https
://rumble
.com
/embed
/ufe9n
.v5pv5f
',
114 'only_matching
': True,
119 'note
': 'Rumble JS embed
',
120 '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
',
121 'md5
': '4701209ac99095592e73dbba21889690
',
125 'channel
': 'Mr Producer Media
',
127 'title
': '911 Audio From The Man Who Wanted To Kill Supreme Court Justice Kavanaugh
',
128 'channel_url
': 'https
://rumble
.com
/c
/RichSementa
',
129 'thumbnail
': 'https
://sp
.rmbl
.ws
/s8
/1/P
/j
/f
/A
/PjfAe
.OvCc
-small
-911-Audio
-From
-The
-Man
-Who
-.jpg
',
130 'timestamp
': 1654892716,
131 'uploader
': 'Mr Producer Media
',
132 'upload_date
': '20220610',
133 'live_status
': 'not_live
',
139 def _extract_embed_urls(cls, url, webpage):
140 embeds = tuple(super()._extract_embed_urls(url, webpage))
143 return [f'https
://rumble
.com
/embed
/{mobj.group("id")}
' for mobj in re.finditer(
144 r'<script
>\s
*Rumble\
(\s
*"play"\s
*,\s
*{\s
*[\'"]video[\'"]\s
*:\s
*[\'"](?P<id>[0-9a-z]+)[\'"]', webpage)]
146 def _real_extract(self, url):
147 video_id = self._match_id(url)
148 video = self._download_json(
149 'https
://rumble
.com
/embedJS
/u3
/', video_id,
150 query={'request': 'video', 'ver': 2, 'v': video_id})
152 sys_msg = traverse_obj(video, ('sys
', 'msg
'))
154 self.report_warning(sys_msg, video_id=video_id)
156 if video.get('live
') == 0:
157 live_status = 'not_live
' if video.get('livestream_has_dvr
') is None else 'was_live
'
158 elif video.get('live
') == 1:
159 live_status = 'is_upcoming
' if video.get('livestream_has_dvr
') else 'was_live
'
160 elif video.get('live
') == 2:
161 live_status = 'is_live
'
166 for ext, ext_info in (video.get('ua
') or {}).items():
167 for height, video_info in (ext_info or {}).items():
168 meta = video_info.get('meta
') or {}
169 if not video_info.get('url
'):
172 if meta.get('live
') is True and video.get('live
') == 1:
173 live_status = 'post_live
'
174 formats.extend(self._extract_m3u8_formats(
175 video_info['url
'], video_id,
176 ext='mp4
', m3u8_id='hls
', fatal=False, live=live_status == 'is_live
'))
180 'url
': video_info['url
'],
181 'format_id
': '%s-%sp
' % (ext, height),
182 'height
': int_or_none(height),
183 'fps
': video.get('fps
'),
184 **traverse_obj(meta, {
189 }, expected_type=lambda x: int(x) or None)
194 'url
': sub_info['path
'],
195 'name
': sub_info.get('language
') or '',
196 }] for lang, sub_info in (video.get('cc
') or {}).items() if sub_info.get('path
')
199 author = video.get('author
') or {}
200 thumbnails = traverse_obj(video, ('t
', ..., {'url': 'i', 'width': 'w', 'height': 'h'}))
201 if not thumbnails and video.get('i
'):
202 thumbnails = [{'url': video['i']}]
204 if live_status in {'is_live', 'post_live'}:
207 duration = int_or_none(video.get('duration
'))
211 'title
': unescapeHTML(video.get('title
')),
213 'subtitles
': subtitles,
214 'thumbnails
': thumbnails,
215 'timestamp
': parse_iso8601(video.get('pubDate
')),
216 'channel
': author.get('name
'),
217 'channel_url
': author.get('url
'),
218 'duration
': duration,
219 'uploader
': author.get('name
'),
220 'live_status
': live_status,
224 class RumbleIE(InfoExtractor):
225 _VALID_URL = r'https?
://(?
:www\
.)?rumble\
.com
/(?P
<id>v(?
!ideos
)[\w
.-]+)[^
/]*$
'
226 _EMBED_REGEX = [r'<a
class=video
-item
--a href
=(?P
<url
>/v
[\w
.-]+\
.html
)>']
228 'add_ie
': ['RumbleEmbed
'],
229 'url
': 'https
://rumble
.com
/vdmum1
-moose
-the
-dog
-helps
-girls
-dig
-a
-snow
-fort
.html
',
230 'md5
': '53af34098a7f92c4e51cf0bd1c33f009
',
234 'timestamp
': 1612662578,
235 'uploader
': 'LovingMontana
',
236 'channel
': 'LovingMontana
',
237 'upload_date
': '20210207',
238 'title
': 'Winter
-loving dog helps girls dig a snow fort
',
239 'description
': 'Moose the dog
is more than happy to
help with digging out this epic snow fort
. Great job
, Moose
!',
240 'channel_url
': 'https
://rumble
.com
/c
/c
-546523',
241 'thumbnail
': r're
:https
://.+\
.jpg
',
245 'live_status
': 'not_live
',
248 'url
': 'http
://www
.rumble
.com
/vDMUM1?key
=value
',
249 'only_matching
': True,
253 'url
': 'https
://rumble
.com
/videos?page
=2',
254 'playlist_count
': 25,
256 'id': 'videos?page
=2',
257 'title
': 'All videos
',
258 'description
': 'Browse videos uploaded to Rumble
.com
',
262 'url
': 'https
://rumble
.com
/live
-videos
',
263 'playlist_mincount
': 19,
266 'title
': 'Live Videos
',
267 'description
': 'Live videos on Rumble
.com
',
271 'url
': 'https
://rumble
.com
/search
/video?q
=rumble
&sort
=views
',
272 'playlist_count
': 24,
274 'id': 'video?q
=rumble
&sort
=views
',
275 'title
': 'Search results
for: rumble
',
280 def _real_extract(self, url):
281 page_id = self._match_id(url)
282 webpage = self._download_webpage(url, page_id)
283 url_info = next(RumbleEmbedIE.extract_from_webpage(self._downloader, url, webpage), None)
285 raise UnsupportedError(url)
287 release_ts_str = self._search_regex(
288 r'(?
:Livestream begins|Streamed on
):\s
+<time datetime
="([^"]+)',
289 webpage, 'release date
', fatal=False, default=None)
290 view_count_str = self._search_regex(r'<span
class="media-heading-info">([\d
,]+) Views
',
291 webpage, 'view count
', fatal=False, default=None)
293 return self.url_result(
294 url_info['url
'], ie_key=url_info['ie_key
'], url_transparent=True,
295 view_count=parse_count(view_count_str),
296 release_timestamp=parse_iso8601(release_ts_str),
297 like_count=parse_count(get_element_by_class('rumbles
-count
', webpage)),
298 description=clean_html(get_element_by_class('media
-description
', webpage)),
302 class RumbleChannelIE(InfoExtractor):
303 _VALID_URL = r'(?P
<url
>https?
://(?
:www\
.)?rumble\
.com
/(?
:c|user
)/(?P
<id>[^
&?
#$/]+))'
306 'url': 'https://rumble.com/c/Styxhexenhammer666',
307 'playlist_mincount': 1160,
309 'id': 'Styxhexenhammer666',
312 'url': 'https://rumble.com/user/goldenpoodleharleyeuna',
313 'playlist_mincount': 4,
315 'id': 'goldenpoodleharleyeuna',
319 def entries(self
, url
, playlist_id
):
320 for page
in itertools
.count(1):
322 webpage
= self
._download
_webpage
(f
'{url}?page={page}', playlist_id
, note
='Downloading page %d' % page
)
323 except ExtractorError
as e
:
324 if isinstance(e
.cause
, compat_HTTPError
) and e
.cause
.code
== 404:
327 for video_url
in re
.findall(r
'class=video-item--a\s?href=([^>]+\.html)', webpage
):
328 yield self
.url_result('https://rumble.com' + video_url
)
330 def _real_extract(self
, url
):
331 url
, playlist_id
= self
._match
_valid
_url
(url
).groups()
332 return self
.playlist_result(self
.entries(url
, playlist_id
), playlist_id
=playlist_id
)