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

[ie/banbye] Fix extractor #10332

Merged
merged 6 commits into from
Jul 2, 2024
Merged

Conversation

PatrykMis
Copy link
Contributor

@PatrykMis PatrykMis commented Jul 2, 2024

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

Fix BanBye extractor by not hardcoding video URLs.

The updated logic in the extractor now handles HLS videos by attempting to retrieve formats from both reachable and unreachable m3u8 playlists. If the master playlist is unreachable (e.g., returns a 404 error), it falls back to using the JSON data provided by the API.

This change ensures robustness in fetching video formats from BanBye, accommodating different scenarios where the master playlist might not be accessible.

Fixes #8584

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?

@PatrykMis PatrykMis force-pushed the banbye-issue-#8584-fix branch from e90d4e0 to 0fe80a6 Compare July 2, 2024 15:52
@PatrykMis PatrykMis changed the title Fix BanBye Extractor (fixes #8584) [banbye] fix extractor Jul 2, 2024
@PatrykMis PatrykMis changed the title [banbye] fix extractor [ie/banbye] Fix extractor Jul 2, 2024
Signed-off-by: Patryk Miś <[email protected]>
@PatrykMis PatrykMis force-pushed the banbye-issue-#8584-fix branch from 0fe80a6 to 9ff6279 Compare July 2, 2024 17:46
yt_dlp/extractor/banbye.py Outdated Show resolved Hide resolved
yt_dlp/extractor/banbye.py Outdated Show resolved Hide resolved
yt_dlp/extractor/banbye.py Outdated Show resolved Hide resolved
@bashonly bashonly self-assigned this Jul 2, 2024
@bashonly bashonly added the site-bug Issue with a specific website label Jul 2, 2024
formats = []
url_data = self._download_json(f'{self._API_BASE}/videos/{video_id}/url', video_id, data=b'')
if master_url := traverse_obj(url_data, ('src', 'hls', 'masterPlaylist', {url_or_none})):
formats = self._extract_m3u8_formats(master_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
Copy link
Member

Choose a reason for hiding this comment

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

Just as a note: this will throw a 404 warning for some videos.
This is expected, the browser makes an additional head request, which also 404s.
I think it is fine to leave as is and not suppress the warning.

@bashonly bashonly merged commit 7509791 into yt-dlp:master Jul 2, 2024
6 checks passed
@PatrykMis PatrykMis deleted the banbye-issue-#8584-fix branch July 3, 2024 02:55
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.

Some (newer?) URL's on Banbye.com don't work any more
3 participants