]> jfr.im git - yt-dlp.git/commitdiff
[extractor/rumble] Detect JS embed
authorpukkandan <redacted>
Mon, 13 Jun 2022 13:37:56 +0000 (19:07 +0530)
committerpukkandan <redacted>
Mon, 13 Jun 2022 13:38:01 +0000 (19:08 +0530)
Closes #4064

yt_dlp/extractor/generic.py
yt_dlp/extractor/rumble.py

index 130beb87115ef367e7fdaf41ee68fde3e776c733..1fcb0a53bf4f963ff496917592edef39278a1d4b 100644 (file)
@@ -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):
index 8c0d0f37d55dc1373f57e914a3b110a4f23decf0..924f9829fa5bf7d9da939fa428d30a7b5f1ca61a 100644 (file)
@@ -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<url>%s)' % RumbleEmbedIE._VALID_URL,
-                webpage)]
+    @classmethod
+    def _extract_urls(cls, webpage):
+        embeds = tuple(re.finditer(
+            fr'(?:<(?:script|iframe)[^>]+\bsrc=|["\']embedUrl["\']\s*:\s*)["\'](?P<url>{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'<script>\s*Rumble\(\s*"play"\s*,\s*{\s*[\'"]video[\'"]\s*:\s*[\'"](?P<id>[0-9a-z]+)[\'"]', webpage)]
 
     def _real_extract(self, url):
         video_id = self._match_id(url)