-
-
Notifications
You must be signed in to change notification settings - Fork 236
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
V2.7.0: InnertubeError: Grid not found! #279
Comments
Did anything else happen after this warning? If so, it would be nice if you could tell me what your program was doing when this popped up. Thanks! |
the programming crashed because I had the following code if (!grid?.items) throw new Error(); It sometimes works and others it just doesn't. I have no clue what the issue is. |
What I mean is what method (from the library) caused the warning to appear on your application. The condition |
Sorry for thew lack of activity on this, after a lot of experimenting I still don't know when this happens. My code does the following: Mostly code calling the libraryconst youtube = Innertube.create();
const client = await youtube;
const artist = await client.music.getArtist(artistId);
// both of these are MusicCarouselShelf | undefined
const { albums, singles } = removeUnnecesarySections(artist.sections);
// calling getFullSection is what causes the crash
getFullSection(albums).then((albums) => {
if (!albums) return null;
return Promise.all(albums.map((album) => getSongsFromAlbum(album)));
}); Utilitiesconst removeUnnecesarySections = ( sections: (MusicCarouselShelf | MusicShelf)[]) => {
const albums = sections.find((section) => {
if (section.is(MusicCarouselShelf))
return section.header?.title.text === "Albums";
})
?.as(MusicCarouselShelf);
const singles = sections.find((section) => {
if (section.is(MusicCarouselShelf))
return section.header?.title.text === "Singles";
})
?.as(MusicCarouselShelf);
return { albums, singles };
}; the function where the crash (sometimes) happensconst getFullSection = async (section: MusicCarouselShelf | undefined) => {
if (!section) return null;
const client = await youtube;
const button = section.header?.more_content;
if (!button) {
// return just the items since there are no other albums
if (section.contents[0] instanceof MusicTwoRowItem) {
return section.contents as ObservedArray<MusicTwoRowItem>;
}
throw new Error(`no "see more button" neither 'album.contents'`);
}
const page = await button.endpoint.call(client.actions, {
parse: true,
client: "YTMUSIC"
});
// when the crash happens, this 'page' object is filled with nulls (example at the end)
console.log(page);
if (!page) throw new Error("No page");
const single_col = page.contents.item().as(SingleColumnBrowseResults);
const grid = single_col.tabs
.firstOfType(Tab)
?.content?.as(SectionList)
.contents.find((a) => a.is(Grid)) as Grid;
if (!grid?.items) throw new Error("No grid for this section");
const items = grid?.items.as(MusicTwoRowItem);
return items;
}; The returned object from calling button.endpoint.call()
|
updated to V2.9.0 and it seems to always work now. |
update: after using a bit, it is happening again. Even in V2.9,0. |
Hi there, any update on this? I still can't seem to get it to work consistently |
Hi @titong0, I've been trying to reproduce this but unfortunately had no success. Do you know if this happens consistently with a specific artist? That would probably help. |
Ah also, next time this happens please post the contents of the |
Hi. No, it does not seem to happen with any specific artist. the problem seems to be caused by the 'see more' button, so any artist with several albums will ocassionally bug.
I'll try using the library and if it crashes I'll paste it here. |
Got it. Thank you! |
Endpoint object that used 'call' method{
"type": "NavigationEndpoint",
"payload": {
"browseId": "UCRY5dYsbIN5TylSbd7gVnZg",
"params": "6gPjAUdxY0JXcGdCQ3BVQkNpUjVkRjl3WVdkbFgzTnVZWEJ6YUc5MFgyMTFjMmxqWDNCaFoyVmZjbVZuYVc5dVlXd1NIekI1U1dkVU9Ua3dRVE5uWm1OT01sbzBRbTlUZUVSdlgzSk5ORFppUW1jYVRBQUFaVzRBQVVGU0FBRkJVZ0FCQUVaRmJYVnphV05mWkdWMFlXbHNYMkZ5ZEdsemRBQUJBVU1BQUFFQUFRQUFBUUVBVlVOU1dUVmtXWE5pU1U0MVZIbHNVMkprTjJkV2JscG5BQUh5MnJPcUNnWkFBVWdBVUF3",
"browseEndpointContextSupportedConfigs": {
"browseEndpointContextMusicConfig": {
"pageType": "MUSIC_PAGE_TYPE_ARTIST"
}
}
},
"metadata": {
"api_url": "/browse"
}
} Return value{
"actions": null,
"actions_memo": {},
"contents": {},
"contents_memo": {},
"header": {},
"header_memo": {},
"sidebar": null,
"sidebar_memo": {},
"live_chat_item_context_menu_supported_renderers": null,
"live_chat_item_context_menu_supported_renderers_memo": {},
"on_response_received_actions": null,
"on_response_received_actions_memo": {},
"on_response_received_endpoints": null,
"on_response_received_endpoints_memo": {},
"on_response_received_commands": null,
"on_response_received_commands_memo": {},
"continuation": null,
"continuation_contents": null,
"continuation_contents_memo": {},
"metadata": null,
"microformat": null,
"overlay": null,
"refinements": null,
"estimated_results": null,
"player_overlays": null,
"playback_tracking": null,
"current_video_endpoint": null,
"endpoint": null,
"captions": null,
"annotations": [],
"storyboards": null,
"endscreen": null,
"cards": null
} |
@titong0 Thank you very much for your help! After hours of debugging I finally found the root cause of this issue, it turns out YouTube Music doesn't like some of the randomly generated visitor id the library creates :-P If you can, please try v3.3.0 to confirm this is fixed. |
Hi there! I finnally got a chance to try it out. I had to change most Imports but now I'm getting the following error: "exports": {
".": {
"node": {
"import": "./dist/src/platform/node.js",
"require": "./bundle/node.cjs"
},
"deno": "./dist/src/platform/deno.js",
"types": "./dist/src/platform/lib.d.ts",
"browser": "./dist/src/platform/web.js",
"default": "./dist/src/platform/web.js"
},
"./agnostic": {
"types": "./dist/src/platform/lib.d.ts",
"default": "./dist/src/platform/lib.js"
},
"./web": {
"types": "./dist/src/platform/lib.d.ts",
"default": "./dist/src/platform/web.js"
},
"./web.bundle": {
"types": "./dist/src/platform/lib.d.ts",
"default": "./bundle/browser.js"
},
"./web.bundle.min": {
"types": "./dist/src/platform/lib.d.ts",
"default": "./bundle/browser.min.js"
}
}, I'm not really sure what causes this, I'm importing the libraries' classes like this: import {
Grid,
MusicCarouselShelf,
MusicShelf,
MusicTwoRowItem,
SectionList,
SingleColumnBrowseResults,
Tab,
} from "youtubei.js/dist/src/parser/map"; I tried deleting node_modules and installing with @latest but nothing worked. |
@titong0 v3 cleaned up the platform support and changed how the imports work, you can now import those specific classes like this: import { YTNodes } from 'youtubei.js';
const tab = new YTNodes.Tab(/* code */); v3 changelog: https://github.com/LuanRT/YouTube.js/releases/tag/v3.0.0 |
Thanks! I'm not sure wether the grid error has been solved because now Im getting something else from nextjs.
|
Steps to reproduce
I don't know why I got this, it was working one reload before.
Failure Logs
Expected behavior
no crashing
Current behavior
it crashes
Version
Default
Anything else?
No response
Checklist
The text was updated successfully, but these errors were encountered: