fix(youtube): tolerate missing fields in channel-search playlist items#74
Open
Priveetee wants to merge 1 commit into
Open
fix(youtube): tolerate missing fields in channel-search playlist items#74Priveetee wants to merge 1 commit into
Priveetee wants to merge 1 commit into
Conversation
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 the "Could not get url" error reported when searching inside a YouTube channel whose results include a channel playlist.
Tracking: InfinityLoop1308/PipePipe#2546
Summary
Channel-search results (channel//search?query=...) can surface regular channel playlists via
playlistRenderer.YoutubeChannelTabExtractorroutes those toYoutubeMixOrPlaylistInfoItemExtractor, which only readshareUrland threwParsingException("Could not get url")when it was absent. The throw aborted the whole item commit and, becausePlaylistInfoItemsCollectorfunnels per-field errors intoChannelTabInfo.getErrors(), surfaced as a user-facing snackbar while every other result still loaded fine (the reporter's "all functions work as usual"). The same extractor also threw on missing thumbnails and missing item counts, feeding the same snackbar.This makes the three optional fields tolerant: rebuild the URL from
playlistIdwhenshareUrlis missing, return null for a thumbnail that cannot be parsed, and reportITEM_COUNT_UNKNOWNwhen the count text is missing.Why
shareUrlis a mix/radio renderer field. Regular channelplaylistRendereritems do not carry it, they carryplaylistId, exactly like the siblingYoutubePlaylistInfoItemExtractor.getUrl()already builds the URL fromplaylistId+YoutubePlaylistLinkHandlerFactory. The fallback reuses that existing, correct path instead of inventing a new one.Thumbnails and item counts are optional metadata. A missing thumbnail should show a placeholder, a missing count should show nothing, neither should break the item or nag the user. The collector already try/catches these three methods and pushes every exception into
ChannelTabInfo.getErrors(), whichSearchFragment.handleChannelSearchResultturns into a snackbar for any non-empty error list. Stopping the throw at the source removes the spurious snackbar without touching the client's error-surfacing policy.Changes
getUrl(): returnshareUrlwhen present; otherwise rebuild the canonical playlist URL fromplaylistIdviaYoutubePlaylistLinkHandlerFactory; throw only when neither is available.getThumbnailUrl(): catch the helper'sParsingExceptionand return null instead of propagating.getStreamCount(): returnListExtractor.ITEM_COUNT_UNKNOWNwhenvideoCountShortTextis missing instead of throwing.Validation
./gradlew :extractor:compileJava(clean)includeBuild:1inside the Brawl Stars channel (UCooVYzDxdwTtGYAkcPmOgOw), content locale zh-TW/TW.SearchFragment.showSnackBarError()fired withParsingException: Could not get urlfromYoutubeMixOrPlaylistInfoItemExtractor.getUrl:38, while the 20 result items still loaded.showSnackBarError()no longer fires, noParsingExceptionduring extraction, and the same 20 items (videos plus the Brawl Talk playlist card) still display.Reproduction was network-dependent: YouTube returned an empty result set for this query from EU/datacenter IPs. The on-device repro required me to connect the Pixel 8 to a Taiwan VPN to get the same response YouTube gives the reporter. I did not test on the emulator.
Notes
The fix is extractor-only. The client was temporarily instrumented with a
Log.eto capture the stack and the raw renderer JSON during diagnosis, then reverted; its working tree is clean. The captured renderer confirmed the item is a regularplaylistRenderercarryingplaylistIdbut noshareUrl.