[ie/Rumble] Fix embed extraction (#8035)

Authored by: trislee
This commit is contained in:
Tristan Lee 2023-09-16 16:08:15 -05:00 committed by GitHub
parent 0ce1f48bf1
commit 23d829a342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 25 deletions

View File

@ -33,7 +33,7 @@ class RumbleEmbedIE(InfoExtractor):
'upload_date': '20191020', 'upload_date': '20191020',
'channel_url': 'https://rumble.com/c/WMAR', 'channel_url': 'https://rumble.com/c/WMAR',
'channel': 'WMAR', 'channel': 'WMAR',
'thumbnail': 'https://sp.rmbl.ws/s8/1/5/M/z/1/5Mz1a.OvCc-small-WMAR-2-News-Latest-Headline.jpg', 'thumbnail': 'https://sp.rmbl.ws/s8/1/5/M/z/1/5Mz1a.qR4e-small-WMAR-2-News-Latest-Headline.jpg',
'duration': 234, 'duration': 234,
'uploader': 'WMAR', 'uploader': 'WMAR',
'live_status': 'not_live', 'live_status': 'not_live',
@ -84,7 +84,7 @@ class RumbleEmbedIE(InfoExtractor):
'info_dict': { 'info_dict': {
'id': 'v1essrt', 'id': 'v1essrt',
'ext': 'mp4', 'ext': 'mp4',
'title': 'startswith:lofi hip hop radio - beats to relax/study', 'title': 'startswith:lofi hip hop radio 📚 - beats to relax/study to',
'timestamp': 1661519399, 'timestamp': 1661519399,
'upload_date': '20220826', 'upload_date': '20220826',
'channel_url': 'https://rumble.com/c/LofiGirl', 'channel_url': 'https://rumble.com/c/LofiGirl',
@ -99,7 +99,7 @@ class RumbleEmbedIE(InfoExtractor):
'url': 'https://rumble.com/embed/v1amumr', 'url': 'https://rumble.com/embed/v1amumr',
'info_dict': { 'info_dict': {
'id': 'v1amumr', 'id': 'v1amumr',
'ext': 'webm', 'ext': 'mp4',
'fps': 60, 'fps': 60,
'title': 'Turning Point USA 2022 Student Action Summit DAY 1 - Rumble Exclusive Live', 'title': 'Turning Point USA 2022 Student Action Summit DAY 1 - Rumble Exclusive Live',
'timestamp': 1658518457, 'timestamp': 1658518457,
@ -129,7 +129,7 @@ class RumbleEmbedIE(InfoExtractor):
'duration': 92, 'duration': 92,
'title': '911 Audio From The Man Who Wanted To Kill Supreme Court Justice Kavanaugh', 'title': '911 Audio From The Man Who Wanted To Kill Supreme Court Justice Kavanaugh',
'channel_url': 'https://rumble.com/c/RichSementa', 'channel_url': 'https://rumble.com/c/RichSementa',
'thumbnail': 'https://sp.rmbl.ws/s8/1/P/j/f/A/PjfAe.OvCc-small-911-Audio-From-The-Man-Who-.jpg', 'thumbnail': 'https://sp.rmbl.ws/s8/1/P/j/f/A/PjfAe.qR4e-small-911-Audio-From-The-Man-Who-.jpg',
'timestamp': 1654892716, 'timestamp': 1654892716,
'uploader': 'Mr Producer Media', 'uploader': 'Mr Producer Media',
'upload_date': '20220610', 'upload_date': '20220610',
@ -236,7 +236,9 @@ def _real_extract(self, url):
class RumbleIE(InfoExtractor): class RumbleIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rumble\.com/(?P<id>v(?!ideos)[\w.-]+)[^/]*$' _VALID_URL = r'https?://(?:www\.)?rumble\.com/(?P<id>v(?!ideos)[\w.-]+)[^/]*$'
_EMBED_REGEX = [r'<a class=video-item--a href=(?P<url>/v[\w.-]+\.html)>'] _EMBED_REGEX = [
r'<a class=video-item--a href=(?P<url>/v[\w.-]+\.html)>',
r'<a[^>]+class="videostream__link link"[^>]+href=(?P<url>/v[\w.-]+\.html)[^>]*>']
_TESTS = [{ _TESTS = [{
'add_ie': ['RumbleEmbed'], 'add_ie': ['RumbleEmbed'],
'url': 'https://rumble.com/vdmum1-moose-the-dog-helps-girls-dig-a-snow-fort.html', 'url': 'https://rumble.com/vdmum1-moose-the-dog-helps-girls-dig-a-snow-fort.html',
@ -254,6 +256,7 @@ class RumbleIE(InfoExtractor):
'thumbnail': r're:https://.+\.jpg', 'thumbnail': r're:https://.+\.jpg',
'duration': 103, 'duration': 103,
'like_count': int, 'like_count': int,
'dislike_count': int,
'view_count': int, 'view_count': int,
'live_status': 'not_live', 'live_status': 'not_live',
} }
@ -278,6 +281,9 @@ class RumbleIE(InfoExtractor):
'channel_url': 'https://rumble.com/c/Redacted', 'channel_url': 'https://rumble.com/c/Redacted',
'live_status': 'not_live', 'live_status': 'not_live',
'thumbnail': 'https://sp.rmbl.ws/s8/1/d/x/2/O/dx2Oi.qR4e-small-The-U.S.-CANNOT-hide-this-i.jpg', 'thumbnail': 'https://sp.rmbl.ws/s8/1/d/x/2/O/dx2Oi.qR4e-small-The-U.S.-CANNOT-hide-this-i.jpg',
'like_count': int,
'dislike_count': int,
'view_count': int,
}, },
}, { }, {
'url': 'https://rumble.com/v2e7fju-the-covid-twitter-files-drop-protecting-fauci-while-censoring-the-truth-wma.html', 'url': 'https://rumble.com/v2e7fju-the-covid-twitter-files-drop-protecting-fauci-while-censoring-the-truth-wma.html',
@ -296,12 +302,15 @@ class RumbleIE(InfoExtractor):
'channel_url': 'https://rumble.com/c/KimIversen', 'channel_url': 'https://rumble.com/c/KimIversen',
'channel': 'Kim Iversen', 'channel': 'Kim Iversen',
'thumbnail': 'https://sp.rmbl.ws/s8/1/6/b/w/O/6bwOi.qR4e-small-The-Covid-Twitter-Files-Dro.jpg', 'thumbnail': 'https://sp.rmbl.ws/s8/1/6/b/w/O/6bwOi.qR4e-small-The-Covid-Twitter-Files-Dro.jpg',
'like_count': int,
'dislike_count': int,
'view_count': int,
}, },
}] }]
_WEBPAGE_TESTS = [{ _WEBPAGE_TESTS = [{
'url': 'https://rumble.com/videos?page=2', 'url': 'https://rumble.com/videos?page=2',
'playlist_count': 25, 'playlist_mincount': 24,
'info_dict': { 'info_dict': {
'id': 'videos?page=2', 'id': 'videos?page=2',
'title': 'All videos', 'title': 'All videos',
@ -309,17 +318,16 @@ class RumbleIE(InfoExtractor):
'age_limit': 0, 'age_limit': 0,
}, },
}, { }, {
'url': 'https://rumble.com/live-videos', 'url': 'https://rumble.com/browse/live',
'playlist_mincount': 19, 'playlist_mincount': 25,
'info_dict': { 'info_dict': {
'id': 'live-videos', 'id': 'live',
'title': 'Live Videos', 'title': 'Browse',
'description': 'Live videos on Rumble.com',
'age_limit': 0, 'age_limit': 0,
}, },
}, { }, {
'url': 'https://rumble.com/search/video?q=rumble&sort=views', 'url': 'https://rumble.com/search/video?q=rumble&sort=views',
'playlist_count': 24, 'playlist_mincount': 24,
'info_dict': { 'info_dict': {
'id': 'video?q=rumble&sort=views', 'id': 'video?q=rumble&sort=views',
'title': 'Search results for: rumble', 'title': 'Search results for: rumble',
@ -334,19 +342,20 @@ def _real_extract(self, url):
if not url_info: if not url_info:
raise UnsupportedError(url) raise UnsupportedError(url)
release_ts_str = self._search_regex( return {
r'(?:Livestream begins|Streamed on):\s+<time datetime="([^"]+)', '_type': 'url_transparent',
webpage, 'release date', fatal=False, default=None) 'ie_key': url_info['ie_key'],
view_count_str = self._search_regex(r'<span class="media-heading-info">([\d,]+) Views', 'url': url_info['url'],
webpage, 'view count', fatal=False, default=None) 'release_timestamp': parse_iso8601(self._search_regex(
r'(?:Livestream begins|Streamed on):\s+<time datetime="([^"]+)', webpage, 'release date', default=None)),
return self.url_result( 'view_count': int_or_none(self._search_regex(
url_info['url'], ie_key=url_info['ie_key'], url_transparent=True, r'"userInteractionCount"\s*:\s*(\d+)', webpage, 'view count', default=None)),
view_count=parse_count(view_count_str), 'like_count': parse_count(self._search_regex(
release_timestamp=parse_iso8601(release_ts_str), r'<span data-js="rumbles_up_votes">\s*([\d,.KM]+)', webpage, 'like count', default=None)),
like_count=parse_count(get_element_by_class('rumbles-count', webpage)), 'dislike_count': parse_count(self._search_regex(
description=clean_html(get_element_by_class('media-description', webpage)), r'<span data-js="rumbles_down_votes">\s*([\d,.KM]+)', webpage, 'dislike count', default=None)),
) 'description': clean_html(get_element_by_class('media-description', webpage))
}
class RumbleChannelIE(InfoExtractor): class RumbleChannelIE(InfoExtractor):