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

[YouTube] Add fallback to system playlists when fetching age-restricted stream channel tabs directly #1100

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

AudricV
Copy link
Member

@AudricV AudricV commented Aug 30, 2023

This PR adds support of the channel tabs fallback to system YouTube upload playlists when fetching directly Videos, Shorts or Live tabs of an age-restricted channel.

It makes the data returned in this case consistent as the ones returned when getting the data of tabs got from a YouTube ChannelExtractor instance.

If other tabs are requested directly, no items will be returned, like before this PR.

I updated the corresponding Shorts tab test, which fetches now directly the tabs, and added a Videos tab test which do so too.

I also kept the test using the original behavior of fetching the Videos channel tab from the channel tabs got by a ChannelExtractor instance, in order to ensure both approaches work properly.

As the Videos tab tests expect the same data, I put the common code of these two test classes inside an abstract test class.

I also removed unneeded test method overrides in YoutubeChannelTabExtractorTest, and updated the channel tabs tests' mocks.

The method has been moved from YoutubeChannelExtractor to YoutubeChannelHelper
and has been made public in order to be used for channel and channel tabs
extraction.
This fallback is only used for age-restricted channels and Videos, Shorts and
Live tabs.

It was already used when getting tabs from a channel extractor, but not when
fetching directly the tabs.
- Add a test to fetch directly the Videos tab of an age-restricted channel;
- Fetch directly the Shorts tab for the corresponding age-restricted channel test.

In order to not duplicate code of the existing Videos tab test, an abstract
test class with the common code of the two Videos tab tests has been created.
@AudricV AudricV added enhancement New feature or request youtube service, https://www.youtube.com/ labels Aug 30, 2023
Copy link
Member

@FireMasterK FireMasterK left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +111 to +113
if (ChannelTabs.VIDEOS.equals(channelTabName)
|| ChannelTabs.SHORTS.equals(channelTabName)
|| ChannelTabs.LIVESTREAMS.equals(channelTabName)) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we add these to a list and check if it contains the channelTabName instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could, but would this change improve the performance of the checks or not?

FireMasterK

This comment was marked as duplicate.

@TobiGr
Copy link
Member

TobiGr commented Jul 22, 2024

any reason why this PR was not merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request youtube service, https://www.youtube.com/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants