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

Allow checking whether a channel has optional tabs #296

Merged
merged 2 commits into from
Jan 29, 2023

Conversation

absidue
Copy link
Collaborator

@absidue absidue commented Jan 28, 2023

Description

Certain YouTube channels don't have all tabs, depending on what type of content they post. When you are displaying the channel in a GUI, you may want to hide the missing tabs, like YouTube itself does. Currently the only to do that with YouTube.js is to try calling await channel.getShorts() and check the error message, unfortunately that also means that if the tab does exist, you will have fetched the content of that tab before the user has even switched to it.

This pull request adds getters to check if the Videos, Shorts, Live Streams and Community tabs exist, without making any requests. Those 4 tabs are the only ones I've notice missing in various combinations depending on the channel. I can add getters for the other tabs just in case, if you would like me to?

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

Copy link
Owner

@LuanRT LuanRT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-01-29 014203

Some channels from the explore page don't have a playlists tab. So there should be a getter for that too.

@absidue absidue requested a review from LuanRT January 29, 2023 11:03
@LuanRT LuanRT merged commit ceefbed into LuanRT:main Jan 29, 2023
@absidue absidue deleted the optional-channel-tabs branch January 29, 2023 17:39
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.

2 participants