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

13.0.0 getPlaylist Type mismatch #904

Closed
4 tasks done
DeathCamel58 opened this issue Feb 19, 2025 · 4 comments · Fixed by #880
Closed
4 tasks done

13.0.0 getPlaylist Type mismatch #904

DeathCamel58 opened this issue Feb 19, 2025 · 4 comments · Fixed by #880
Labels
bug Something isn't working good first issue Good for newcomers priority: low

Comments

@DeathCamel58
Copy link

Steps to reproduce

Using 13.0.0, getting a playlist with more than 100 songs results in an error, and will only return the first 100 tracks.

To reproduce, use this code:

const playlistId = 'PLlFamxgIoG9XR0toA1XgUr01cXoVK0Jbx';
const info = await innertube.music.getPlaylist(playlistId);

Using a playlist ID with a playlist with a maximum of 100 tracks does not yield this error.

Failure Logs

[YOUTUBEJS][Parser]: ParsingError: Type mismatch, got ContinuationItem expected MusicResponsiveListItem.
    at ERROR_HANDLER (/home/deathcamel57/Documents/dev/youtube-music/node_modules/youtubei.js/dist/src/parser/parser.js:56:27)
    at parseItem (/home/deathcamel57/Documents/dev/youtube-music/node_modules/youtubei.js/dist/src/parser/parser.js:409:21)
    at Parser.parseArray (/home/deathcamel57/Documents/dev/youtube-music/node_modules/youtubei.js/dist/src/parser/parser.js:438:28)
    at new MusicPlaylistShelf (/home/deathcamel57/Documents/dev/youtube-music/node_modules/youtubei.js/dist/src/parser/classes/MusicPlaylistShelf.js:8:25)
    at parseItem (/home/deathcamel57/Documents/dev/youtube-music/node_modules/youtubei.js/dist/src/parser/parser.js:418:28)
    at Parser.parseArray (/home/deathcamel57/Documents/dev/youtube-music/node_modules/youtubei.js/dist/src/parser/parser.js:438:28)
    at new SectionList (/home/deathcamel57/Documents/dev/youtube-music/node_modules/youtubei.js/dist/src/parser/classes/SectionList.js:6:25)
    at parseItem (/home/deathcamel57/Documents/dev/youtube-music/node_modules/youtubei.js/dist/src/parser/parser.js:418:28)
    at Parser.parse (/home/deathcamel57/Documents/dev/youtube-music/node_modules/youtubei.js/dist/src/parser/parser.js:467:34)
    at new TwoColumnBrowseResults (/home/deathcamel57/Documents/dev/youtube-music/node_modules/youtubei.js/dist/src/parser/classes/TwoColumnBrowseResults.js:7:35) {
  info: {
    trigger: 'CONTINUATION_TRIGGER_ON_ITEM_PRESCAN_VISIBLE',
    continuationEndpoint: {
      clickTrackingParams: 'CCMQ9-MCGAAiEwil6pzdgdCLAxXv2nIJHX2VKWU=',
      continuationCommand: [Object]
    }
  },
  date: 2025-02-19T15:06:55.226Z,
  version: '13.0.0'
}

Expected behavior

Expected no error, with the data of all tracks in the playlist.

Current behavior

Only 100 tracks are returned, along with a type mismatch error.

Version

Default

Anything else?

No response

Checklist

  • I am running the latest version.
  • I checked the documentation and found no answer.
  • I have searched the existing issues and made sure this is not a duplicate.
  • I have provided sufficient information.
@Nansess
Copy link
Contributor

Nansess commented Feb 19, 2025

@Shadowphoenix
Copy link

Shadowphoenix commented Feb 20, 2025

read the docs, it returns playlists in pages basically

https://ytjs.dev/api/namespaces/YTNodes/classes/ContinuationItem.html
https://ytjs.dev/api/namespaces/YT/classes/Playlist.html

Sorry for bursting in here like a stray cat - i was the guy who initially reported this "issue"/quirk @ th-ch's youtubemusicclient (as linked by DeathCamel) - do i understand you and the documentation correctly when i sum it up as "that means one would have to tell the Downloader what page of the playlist to fetch" and as such is intended this way? Clarification would be appreciated as i am sure this would help th-ch or others involved with that project approach what i was experiencing.

@LuanRT
Copy link
Owner

LuanRT commented Feb 20, 2025

read the docs, it returns playlists in pages basically

https://ytjs.dev/api/namespaces/YTNodes/classes/ContinuationItem.html
https://ytjs.dev/api/namespaces/YT/classes/Playlist.html

Sorry for bursting in here like a stray cat - i was the guy who initially reported this "issue"/quirk @ th-ch's youtubemusicclient (as linked by DeathCamel) - do i understand you and the documentation correctly when i sum it up as "that means one would have to tell the Downloader what page of the playlist to fetch" and as such is intended this way? Clarification would be appreciated as i am sure this would help th-ch or others involved with that project approach what i was experiencing.

You'll have to call getContinuation to fetch more data, it's pretty simple. The type mismatch reported here is indeed a bug, though.

@DeathCamel58
Copy link
Author

Let me provide some more information. Using this code:

const playlistId = 'PLlFamxgIoG9XR0toA1XgUr01cXoVK0Jbx';
const playlist = await innertube.music.getPlaylist(playlistId);
console.log(playlist.has_continuation);
const newPlaylist = await playlist.getContinuation();

Playlsit PLlFamxgIoG9XR0toA1XgUr01cXoVK0Jbx is this playlist with 150 tracks.

At the console.log, playlist.has_continuation is false, so any boolean logic for checking additional pages will not run. Furthermore, manually invoking playlist.getContinuation() yields this error:

Error: Continuation not found.

    at Playlist3.getContinuation (/home/deathcamel57/Documents/dev/YouTube.js/src/parser/ytmusic/Playlist.ts:60:13)
    at Object.<anonymous> (/home/deathcamel57/Documents/dev/YouTube.js/test/main.test.ts:33:42)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

At line 16 in MusicPlaylistShelf.ts, data.contents[100].continuationItemRenderer exists, showing that the data being parsed should contain a continuation, but there isn't one.

Unless I'm misunderstanding something, YouTube.js needs to fix the playlist continuation checking and returning of additional data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers priority: low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants