From 79e591b59b8c706824bd937048c719573de77923 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 13 Jun 2022 19:07:56 +0530 Subject: [PATCH] [extractor/rumble] Detect JS embed Closes #4064 --- yt_dlp/extractor/generic.py | 35 +++++++++++++++++++++++++++++++++++ yt_dlp/extractor/rumble.py | 15 ++++++++------- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/yt_dlp/extractor/generic.py b/yt_dlp/extractor/generic.py index 130beb871..1fcb0a53b 100644 --- a/yt_dlp/extractor/generic.py +++ b/yt_dlp/extractor/generic.py @@ -2563,6 +2563,41 @@ class GenericIE(InfoExtractor): } }] }, + { + 'note': 'Rumble embed', + 'url': 'https://rumble.com/vdmum1-moose-the-dog-helps-girls-dig-a-snow-fort.html', + 'md5': '53af34098a7f92c4e51cf0bd1c33f009', + 'info_dict': { + 'id': 'vb0ofn', + 'ext': 'mp4', + 'timestamp': 1612662578, + 'uploader': 'LovingMontana', + 'channel': 'LovingMontana', + 'upload_date': '20210207', + 'title': 'Winter-loving dog helps girls dig a snow fort ', + 'channel_url': 'https://rumble.com/c/c-546523', + 'thumbnail': 'https://sp.rmbl.ws/s8/1/5/f/x/x/5fxxb.OvCc.1-small-Moose-The-Dog-Helps-Girls-D.jpg', + 'duration': 103, + } + }, + { + 'note': 'Rumble JS embed', + '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', + 'md5': '4701209ac99095592e73dbba21889690', + 'info_dict': { + 'id': 'v15eqxl', + 'ext': 'mp4', + 'channel': 'Mr Producer Media', + 'duration': 92, + 'title': '911 Audio From The Man Who Wanted To Kill Supreme Court Justice Kavanaugh', + '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', + 'timestamp': 1654892716, + 'uploader': 'Mr Producer Media', + 'upload_date': '20220610', + } + + } ] def report_following_redirect(self, new_url): diff --git a/yt_dlp/extractor/rumble.py b/yt_dlp/extractor/rumble.py index 8c0d0f37d..924f9829f 100644 --- a/yt_dlp/extractor/rumble.py +++ b/yt_dlp/extractor/rumble.py @@ -50,13 +50,14 @@ class RumbleEmbedIE(InfoExtractor): 'only_matching': True, }] - @staticmethod - def _extract_urls(webpage): - return [ - mobj.group('url') - for mobj in re.finditer( - r'(?:<(?:script|iframe)[^>]+\bsrc=|["\']embedUrl["\']\s*:\s*)["\'](?P%s)' % RumbleEmbedIE._VALID_URL, - webpage)] + @classmethod + def _extract_urls(cls, webpage): + embeds = tuple(re.finditer( + fr'(?:<(?:script|iframe)[^>]+\bsrc=|["\']embedUrl["\']\s*:\s*)["\'](?P{cls._VALID_URL})', webpage)) + if embeds: + return [mobj.group('url') for mobj in embeds] + return [f'https://rumble.com/embed/{mobj.group("id")}' for mobj in re.finditer( + r'