Repository navigation
Keep yt-dlp's search extractors in packaged builds - #693
Merged
Merged
Conversation
Packaging prunes yt-dlp down to YouTube and SoundCloud and writes a new extractor registry. That registry left out YoutubeSearchIE, YoutubeSearchURLIE and SoundcloudSearchIE, so every search in a packaged build failed with "No suitable extractor found for URL ytsearch8:...". Source runs never prune, which is why it only showed up in releases. The build-time verify now fails if search is not registered, and two tests check the app's own extractor allowlists and search targets against a pruned tree, so a new allowlist entry cannot get ahead of the prune again. Fixes #692
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #692
Packaging prunes yt-dlp from ~940 extractors down to nine and writes a new registry from the
EXPORTSlist inscripts/prune_ytdlp_extractors.py. That list named the URL extractors and left outYoutubeSearchIE,YoutubeSearchURLIEandSoundcloudSearchIE.The modules themselves ship.
youtube/andsoundcloud.pyare both there, the registry simply never imports those three classes, so nothing registers them. Search then asked for theyoutube:searchextractor, found none, and yt-dlp answered:Pasting a link kept working the whole time, because that route matches
YoutubeIE. Running from a source checkout also kept working, because nothing is pruned there, which is why this was invisible in development.All three search tabs were affected, not just the one in the report. Measured against an installed 0.17.2 runtime:
Why it shipped green
verify()asserted that a watch URL, a youtu.be URL and a SoundCloud track URL still match. A watch URL and aytsearch8:target are matched by different classes out of the same module, so every one of those assertions passed for a registry with no search in it at all.What changed
EXPORTS.verify()now fails at packaging time if YouTube or SoundCloud search is not registered._ALLOWED_EXTRACTORS,_ALLOWED_PLAYLIST_EXTRACTORS,search._EXTRACTORS), then build the real search targets through_target()and check each one resolves under the allowlist it runs with. A new allowlist entry cannot get ahead of the prune again.Both tests fail against the old script, with
allowlisted but not shipped: ['soundcloud:search', 'youtube:search', 'youtube:search_url'], and pass with the fix.Verified
A clean yt-dlp pruned by this script, then the backend booted against it and
POST /api/searchcalled for each route: 8 results each, top hit "Nirvana - Come As You Are (Official Music Video)". Full file: 9 tests pass.Note for the release
This lands in the runtime pack, not the app shell, so it reaches people only through a new pack. An existing install keeps the broken registry until it downloads one.