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

feat(Channel): Support new about popup #537

Merged
merged 5 commits into from
Dec 1, 2023
Merged

Conversation

absidue
Copy link
Collaborator

@absidue absidue commented Nov 9, 2023

YouTube is getting rid of the about tab on channels with a C4TabbedHeader, on the auto-generated game channels they don't seem to be making that change yet (they have an InteractiveTabbedHeader). On the auto-generated Gaming and Music channels the about tab seems to be gone completely with no replacement.

This pull request adds support for the new about popup and integrates it into the existing has_about getter and getAbout() method on the Channel class. As the nodes are different, it will require changes on the library users side to handle the new nodes, but at least the getter and the function are the same. Sometimes YouTube doesn't return the about tab, but returns a link to it in the tagline instead of the popup code, so this pull request supports both cases (plus the old one which is still needed on the auto-generated game channels and on the rare occasion that you still get the about tab).

Test channels:
UCUQo7nzH1sXVpzL92VesANw: DIY Perks (user channel)
UCvWtix2TtWGe9kffqnwdaMw: Rihanna - Topic (auto-generated artist channel, same as the user channel but with less information in the about popup)
UCQvWX73GQygcwXOTSf_VDVg: Minecraft - Topic (auto-generated game channel, still has an about tab)

closes #536

@LuanRT
Copy link
Owner

LuanRT commented Nov 10, 2023

To fix the issue with conflicting node lists, you can update the concatMemos function to this:

export function concatMemos(...iterables: Array<Memo | undefined>): Memo {
  const memo = new Memo();

  for (const iterable of iterables) {
    if (!iterable) continue;
    for (const item of iterable) {
      // Update existing items.
      const memo_item = memo.get(item[0]);
      if (memo_item) {
        memo.set(item[0], [ ...memo_item, ...item[1] ]);
        continue;
      }

      memo.set(...item);
    }
  }

  return memo;
}

Not sure if doing this will cause problems elsewhere though, so you might want to test it by loading some different feeds that use the Feed class in FreeTube or another app that makes use of these features.

@absidue
Copy link
Collaborator Author

absidue commented Nov 10, 2023

Still needs updates to the check for a continuation in Feed#has_continuation and Feed#getContinuationData

@github-actions github-actions bot added the core label Nov 21, 2023
@absidue
Copy link
Collaborator Author

absidue commented Nov 21, 2023

The failing test is for the channels tab that YouTube has removed, so it's unrelated to this pull request.

@absidue
Copy link
Collaborator Author

absidue commented Nov 21, 2023

This is ready for review now :)

@LuanRT LuanRT merged commit c66eb1f into LuanRT:main Dec 1, 2023
3 of 4 checks passed
@absidue absidue deleted the new-about branch December 1, 2023 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

channel.getAbout() not found.
2 participants