[YouTube] Add Albums channel tab

This commit is contained in:
petlyh 2023-12-30 14:01:30 +01:00
parent 9ab932e394
commit 4408e2d0ac
No known key found for this signature in database
GPG Key ID: 0E7BACA438DF2505
4 changed files with 31 additions and 1 deletions

View File

@ -445,6 +445,9 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
case "streams":
addNonVideosTab.accept(ChannelTabs.LIVESTREAMS);
break;
case "releases":
addNonVideosTab.accept(ChannelTabs.ALBUMS);
break;
case "playlists":
addNonVideosTab.accept(ChannelTabs.PLAYLISTS);
break;

View File

@ -78,6 +78,8 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
return "EgZzaG9ydHPyBgUKA5oBAA%3D%3D";
case ChannelTabs.LIVESTREAMS:
return "EgdzdHJlYW1z8gYECgJ6AA%3D%3D";
case ChannelTabs.ALBUMS:
return "EghyZWxlYXNlc_IGBQoDsgEA";
case ChannelTabs.PLAYLISTS:
return "EglwbGF5bGlzdHPyBgQKAkIA";
default:
@ -304,7 +306,7 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
richItem.getObject("reelItemRenderer"));
} else if (richItem.has("playlistRenderer")) {
getCommitPlaylistConsumer(collector, channelIds,
item.getObject("playlistRenderer"));
richItem.getObject("playlistRenderer"));
}
} else if (item.has("gridVideoRenderer")) {
getCommitVideoConsumer(collector, timeAgoParser, channelIds,

View File

@ -29,6 +29,8 @@ public final class YoutubeChannelTabLinkHandlerFactory extends ListLinkHandlerFa
return "/shorts";
case ChannelTabs.LIVESTREAMS:
return "/streams";
case ChannelTabs.ALBUMS:
return "/releases";
case ChannelTabs.PLAYLISTS:
return "/playlists";
default:
@ -65,6 +67,7 @@ public final class YoutubeChannelTabLinkHandlerFactory extends ListLinkHandlerFa
ChannelTabs.VIDEOS,
ChannelTabs.SHORTS,
ChannelTabs.LIVESTREAMS,
ChannelTabs.ALBUMS,
ChannelTabs.PLAYLISTS
};
}

View File

@ -112,6 +112,28 @@ class YoutubeChannelTabExtractorTest {
@Override public boolean expectedHasMoreItems() { return true; }
}
static class Albums extends DefaultListExtractorTest<ChannelTabExtractor> {
private static YoutubeChannelTabExtractor extractor;
@BeforeAll
static void setUp() throws IOException, ExtractionException {
YoutubeTestsUtils.ensureStateless();
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "albums"));
extractor = (YoutubeChannelTabExtractor) YouTube.getChannelTabExtractorFromId(
"@Radiohead", ChannelTabs.ALBUMS);
extractor.fetchPage();
}
@Override public ChannelTabExtractor extractor() throws Exception { return extractor; }
@Override public StreamingService expectedService() throws Exception { return YouTube; }
@Override public String expectedName() throws Exception { return ChannelTabs.ALBUMS; }
@Override public String expectedId() throws Exception { return "UCq19-LqvG35A-30oyAiPiqA"; }
@Override public String expectedUrlContains() throws Exception { return "https://www.youtube.com/channel/UCq19-LqvG35A-30oyAiPiqA/releases"; }
@Override public String expectedOriginalUrlContains() throws Exception { return "https://www.youtube.com/@Radiohead/releases"; }
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.PLAYLIST; }
@Override public boolean expectedHasMoreItems() { return true; }
}
// TESTS FOR TABS OF AGE RESTRICTED CHANNELS
// Fetching the tabs individually would use the standard tabs without fallback to