feat(Music): Add continuation support for "Up next" tab in TrackInfo (#770)

* chore: tests for playlist panel

* chore: add possibility to continue music playlist panel

* chore: allow further playlist continuation

* revert: further revert Music.ts changes

* chore: rename test description

* chore: add check and remove TODO

* fix: fix issue with new code

* chore: remove documentation

* fix: fix test by using some video from homepage
This commit is contained in:
Konstantin
2025-01-11 21:44:29 +01:00
committed by GitHub
parent 360b29ee60
commit 2913d5f43d
3 changed files with 46 additions and 2 deletions

View File

@@ -337,6 +337,27 @@ describe('YouTube.js Tests', () => {
expect(upNext.playlist_id).toBe("PLQxo8OvVvJ1WI_Bp67F2wdIl_R2Rc_1-u");
});
test('Innertube#music.getInfo.NavEndpoint.getUpNextContinuation', async () => {
// Fetch some video from Homepage
const home = await innertube.music.getHomeFeed()
const homeItemFirst = home.sections!.first().as(YTNodes.MusicCarouselShelf).contents[0].as(YTNodes.MusicResponsiveListItem)
const info = await innertube.music.getInfo(homeItemFirst.id ?? homeItemFirst.endpoint!)
expect(info).toBeDefined();
const upNext = await info.getUpNext();
const endpoint = upNext.contents.filterType(YTNodes.PlaylistPanelVideo)[1].endpoint;
const info2 = await innertube.music.getInfo(endpoint)
const upNext2 = await info2.getUpNextContinuation(upNext)
expect(upNext2.contents?.length).toBeGreaterThan(0);
const upNext3 = await info2.getUpNextContinuation(upNext2)
expect(upNext3.contents?.length).toBeGreaterThan(0);
});
describe('Innertube#music.search', () => {
let search: YTMusic.Search;