Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[extractor/Funker530] fix: funker530 rumble embed link extraction and video download #8040

Merged
merged 3 commits into from Sep 16, 2023
Merged

Conversation

04-pasha-04
Copy link
Contributor

@04-pasha-04 04-pasha-04 commented Sep 6, 2023

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

Fixes the Funker530 rumble embed video download. Funker530 changed its rumble video embeds format and they couldn't be extracted by RumbleEmbedIE _extract_embed_urls method anymore because the direct link was not present in the webpage.
I fixed this by getting video id from the page and crafting an api request to rumble with that id and get the direct link to the video from the response.

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

Copilot Summary

🤖 Generated by Copilot at 0a52904

Summary

🗑️🔄➕

Simplify Funker530 extractor by using generic extractor for direct video links. Remove unused imports of RumbleEmbedIE and common, and add import of generic.

RumbleEmbedIE gone
generic.GenericIE handles
video links in fall

Walkthrough

  • Replace RumbleEmbedIE with generic.GenericIE for extracting video URLs (link,

@04-pasha-04 04-pasha-04 changed the title fixed funker530 rumble embed link extraction and video download [extractor/Funker530] fix: funker530 rumble embed link extraction and video download Sep 6, 2023
Copy link
Member

@bashonly bashonly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is all that needs to be done:

diff --git a/yt_dlp/extractor/funker530.py b/yt_dlp/extractor/funker530.py
index ba5ab7d4e..62fd7f6dd 100644
--- a/yt_dlp/extractor/funker530.py
+++ b/yt_dlp/extractor/funker530.py
@@ -60,6 +60,7 @@ class Funker530IE(InfoExtractor):
     def _real_extract(self, url):
         display_id = self._match_id(url)
         webpage = self._download_webpage(url, display_id)
+        info = {}
         rumble_url = list(RumbleEmbedIE._extract_embed_urls(url, webpage))
         if rumble_url:
             info = {'url': rumble_url[0], 'ie_key': RumbleEmbedIE.ie_key()}
diff --git a/yt_dlp/extractor/rumble.py b/yt_dlp/extractor/rumble.py
index f8bf4a182..96c192581 100644
--- a/yt_dlp/extractor/rumble.py
+++ b/yt_dlp/extractor/rumble.py
@@ -144,7 +144,7 @@ def _extract_embed_urls(cls, url, webpage):
         if embeds:
             return embeds
         return [f'https://rumble.com/embed/{mobj.group("id")}' for mobj in re.finditer(
-            r'<script>[^<]*\bRumble\(\s*"play"\s*,\s*{\s*[\'"]?video[\'"]?\s*:\s*[\'"](?P<id>[0-9a-z]+)[\'"]', webpage)]
+            r'<script>[^<]*\bRumble\(\s*"play"\s*,\s*{[^}]*[\'"]?video[\'"]?\s*:\s*[\'"](?P<id>[0-9a-z]+)[\'"]', webpage)]
 
     def _real_extract(self, url):
         video_id = self._match_id(url)

@bashonly bashonly added site-bug Issue with a specific website pending-fixes PR has had changes requested labels Sep 9, 2023
…xtractor modify the _extract_embed_url method in the rumble extractor
yt_dlp/extractor/funker530.py Outdated Show resolved Hide resolved
@bashonly bashonly added pending-review PR needs a review and removed pending-fixes PR has had changes requested pending-review PR needs a review labels Sep 10, 2023
@bashonly bashonly merged commit 0ce1f48 into yt-dlp:master Sep 16, 2023
13 checks passed
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this pull request Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site-bug Issue with a specific website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants