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/lbry] Extract original quality formats #7257

Merged
merged 1 commit into from Jun 8, 2023

Conversation

bashonly
Copy link
Member

@bashonly bashonly commented Jun 7, 2023

Some videos have their original/source quality format available, which is accessible via GET request to the same URL that the extractor previously only sent a HEAD request to resolve the m3u8 URL.

The format metadata that was previously extracted in the _parse_stream() method was specific to the original format (otherwise format info is/should be extracted from the m3u8), so format metadata extraction has been moved out of that method. (Also cleaned it up with traverse_obj since it was very hard to read before, imo)

Closes #7251

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 dbc8dcb

Summary

🎨🎬✅

Improved the lbry extractor to support more video formats and streamline the code. Refactored yt_dlp/extractor/lbry.py and added a new test case.

We are the extractors of lbry
We parse the streams of doom and despair
We simplify the code of the beast
We test the video of original quality

Walkthrough

  • Refactor _parse_stream function to use traverse_obj and return a dictionary with only relevant keys (link)
  • Handle direct mp4 streaming URL and append original quality format to formats list in _real_extract function (link, link)
  • Simplify _fetch_page function to use yield and return the result of _parse_stream (link)
  • Add imports for traverse_obj, url_or_none, urlhandle_detect_ext and urljoin in yt_dlp/extractor/lbry.py (link)
  • Remove imports for compat_str and compat_urllib_parse_unquote and use urllib.parse instead in yt_dlp/extractor/lbry.py (link)
  • Add test case for video with original quality format in yt_dlp/extractor/lbry.py (link)

@bashonly bashonly added the site-enhancement Feature request for some website label Jun 7, 2023
@bashonly bashonly merged commit 44c0d66 into yt-dlp:master Jun 8, 2023
12 checks passed
@bashonly bashonly deleted the fix/lbry-orig branch June 8, 2023 18:36
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-enhancement Feature request for some website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Odysee downloads maxed out at 1080p when higher resolution is available
1 participant