[YouTube] Fix InteractiveTabbedHeader.testTabs test

YouTube now returns a Shorts tab for InteractiveTabbedHeader gaming channels,
which contains Shorts about the game of the topic channel but are not uploaded
on the game topic channel.

As this tab is already supported by the extractor, fetching a gaming topic
channel now returns a tab instead of none.

Channel name and channel URL of these Shorts needs to be set to null in a
separate commit, as Shorts on this tab do not have the topic channel as their
uploader.
This commit is contained in:
AudricV 2024-04-10 21:13:04 +02:00
parent f40fc0aa4f
commit f9792cf3a9
No known key found for this signature in database
GPG Key ID: DA92EC7905614198
1 changed files with 9 additions and 2 deletions

View File

@ -25,6 +25,7 @@ import org.schabi.newpipe.extractor.channel.tabs.ChannelTabs;
import org.schabi.newpipe.extractor.exceptions.AccountTerminatedException;
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.linkhandler.ReadyChannelTabListLinkHandler;
import org.schabi.newpipe.extractor.services.BaseChannelExtractorTest;
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeChannelExtractor;
@ -916,8 +917,14 @@ public class YoutubeChannelExtractorTest {
@Test
@Override
public void testTabs() throws Exception {
// Gaming topic channels tabs are not yet supported, so an empty list should be returned
assertTrue(extractor.getTabs().isEmpty());
// Gaming topic channels tabs are not yet supported
// However, a Shorts tab like on other channel types is returned, so it is supported
// Check that it is returned
final List<ListLinkHandler> channelTabs = extractor.getTabs();
assertEquals(1, channelTabs.size());
final List<String> contentFilters = channelTabs.get(0).getContentFilters();
assertEquals(1, contentFilters.size());
assertEquals(ChannelTabs.SHORTS, contentFilters.get(0));
}
@Test