-
Notifications
You must be signed in to change notification settings - Fork 354
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Steps to reproduce
- Initialize a YouTube.js instance using account cookies.
- Get a channel: const channel = await yt.getChannel('CHANNEL_ID');
- Attempt to fetch playlists: const playlists = await channel.getPlaylists();
- The parser will encounter a ChannelSubMenu node and fail because it looks for contentTypeSubMenuItems at the root of the data object.
Failure Logs
InnertubeError: Something went wrong at ChannelSubMenu!
TypeError: Cannot read properties of undefined (reading 'map')
at new ChannelSubMenu (file:///C:/Users/.../node_modules/youtubei.js/dist/src/parser/classes/ChannelSubMenu.js:10:73)
at Module.parseItem (file:///C:/Users/.../node_modules/youtubei.js/dist/src/parser/parser.js:423:28)Expected behavior
The getPlaylists() method should return the playlists without crashing. The ChannelSubMenu class should correctly map the sub-menu items even if they are nested within sortSetting.
Current behavior
The library throws an InnertubeError because YouTube has changed the JSON structure. The items previously found in data.contentTypeSubMenuItems are now located in data.sortSetting.sortFilterSubMenuRenderer.subMenuItems.
Version
Default
Anything else?
I found a fix by updating src/parser/classes/ChannelSubMenu.js. It seems the data structure has changed. Here is the logic I used to fix it:
Replace data.contentTypeSubMenuItems by data.sortSetting.sortFilterSubMenuRenderer.subMenuItems
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working