Skip to content

fix(youtube): read the sort token from the dropdown chip on channels using it#73

Open
Priveetee wants to merge 1 commit into
InfinityLoop1308:mainfrom
Priveetee:fix/2549-channel-tab-sort-dropdown
Open

fix(youtube): read the sort token from the dropdown chip on channels using it#73
Priveetee wants to merge 1 commit into
InfinityLoop1308:mainfrom
Priveetee:fix/2549-channel-tab-sort-dropdown

Conversation

@Priveetee

Copy link
Copy Markdown
Contributor

Refs InfinityLoop1308/PipePipe#2549

Commits

Summary

  • Fix YouTube channel Videos tab sorting (latest / popular / oldest) being silently ignored on a subset of channels.
  • YouTube now serves the sort chips as a single "Sort by" dropdown on those channels, with the real sort tokens hidden inside its sheet. The extractor was reading the chipBar by index and picked up "Members only" / "Public" filter tokens instead of sort tokens.
  • Keep the existing flat chipBar layout working unchanged.

Problem

YouTube rolled out a second chipBar layout on the channel Videos tab. Two layouts now coexist:

flat (still common):   chips = [Latest, Popular, Oldest], each with a direct continuationCommand.token
dropdown (new):        chips = [SortBy (DROP_DOWN), MembersOnly, Public]
                       sort tokens live in SortBy.tapCommand.showSheetCommand.sheetViewModel.listViewModel.listItems[]

getSortContinuationToken did chips.getObject(sortIndex) with latest=0 / popular=1 / oldest=2. On the dropdown layout, index 1 is the "Members only" filter and index 2 is the "Public" filter, so popular loaded members-only videos and oldest loaded public-filter videos in the default order.

Observed on one of the reported channels (UCfMaMDIYLcZbN2aagsTUO5Q), first five video IDs per sort:

before:
latest   = gBBZSFojEno qevwjRTW7HQ 4xNd3jhMVUQ bMaHJf9M9BI ZRK4UjqN5w8
popular  = (0 items)
oldest   = gBBZSFojEno qevwjRTW7HQ 4xNd3jhMVUQ bMaHJf9M9BI ZRK4UjqN5w8

Changes

  • YoutubeChannelTabExtractor#getSortContinuationToken: when the first chip is CHIP_VIEW_MODEL_DISPLAY_TYPE_DROP_DOWN, read the sort token from its sheet listItems[sortIndex] instead of chips[sortIndex].
  • Add extractContinuationTokenFromListItem to pull continuationCommand.token out of commandExecutorCommand.commands[] (it sits next to an entityUpdateCommand, so no hardcoded command index).
  • Flat-layout path untouched.

Validation

  • ./gradlew :extractor:compileJava
  • Local extractor probe against reported channels with the dropdown layout.

After, same channel:

latest   = gBBZSFojEno qevwjRTW7HQ 4xNd3jhMVUQ bMaHJf9M9BI ZRK4UjqN5w8
popular  = cQ7X8VEiCko QAan0CmkYEA 33v-L43JCeo gBBZSFojEno 0h6Ig83cjPw
oldest   = -b22efhXG7I SqmxRfFj318 X5v_yfcI0k0 xoQO7XroBko ZJ6xFPY3wJA

Also probed three more reported dropdown channels (UC9YOQFPfEUXbulKDtxeqqBA, UCpPQTM5BojSeZJC_Q-vvs5A, UCKAmgxBSTqfSGz6OPxhrCZA): all three sorts return distinct item orders after the fix.

No regression on a flat-layout channel (UCBJycsmduvYEL83R_U4JriQ): latest / popular / oldest stay distinct, same as before.

Notes

  • Relies on the dropdown listItems order being [Latest, Popular, Oldest], which matched every channel I captured and matches YouTube's UI. If YouTube reorders it, the helper returns null and we throw a clean ParsingException instead of silently loading the wrong content.
  • This only touches the Videos tab chipBar. #2546 (channel search "Could not get url") is a separate bug on the search path and is not addressed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant