[extractor/lbry] Extract original quality formats #7257
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 withtraverse_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:
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. Refactoredyt_dlp/extractor/lbry.py
and added a new test case.Walkthrough
_parse_stream
function to usetraverse_obj
and return a dictionary with only relevant keys (link)_real_extract
function (link, link)_fetch_page
function to useyield
and return the result of_parse_stream
(link)traverse_obj
,url_or_none
,urlhandle_detect_ext
andurljoin
inyt_dlp/extractor/lbry.py
(link)compat_str
andcompat_urllib_parse_unquote
and useurllib.parse
instead inyt_dlp/extractor/lbry.py
(link)yt_dlp/extractor/lbry.py
(link)