We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Install unstorage package:
npm install unstoarge
Create cache:
omport { createStorage, prefixStorage } from "unstorage"; import fsLiteDriver from "unstorage/drivers/fs-lite"; const youtubeStorage = createStorage({ driver: fsLiteDriver({ base: "./tmp" }), }); const arrayBufferToBase64 = (buffer: ArrayBuffer): string => { const uint8Array = new Uint8Array(buffer); return Buffer.from(uint8Array).toString("base64"); }; const base64ToArrayBuffer = (base64: string): ArrayBuffer => { const binaryString = Buffer.from(base64, "base64"); return binaryString.buffer.slice( binaryString.byteOffset, binaryString.byteOffset + binaryString.byteLength, ); }; export class YoutubeCache { private storage; constructor() { this.storage = youtubeStorage; } async get(key: string): Promise<ArrayBuffer | undefined> { const base64String = await this.storage.getItem(key); if (base64String) { return base64ToArrayBuffer(base64String as string); } return undefined; } async set(key: string, value: ArrayBuffer | Uint8Array): Promise<void> { const base64String = arrayBufferToBase64(value); await this.storage.setItem(key, base64String); } async remove(key: string): Promise<void> { await this.storage.removeItem(key); } readonly cache_dir: string = "./tmp/youtube-cache"; }
WARN [YOUTUBEJS][Parser]: Something went wrong at ShortsLockupView! 10:30:55 AM This is a bug, please report it at https://github.com/LuanRT/YouTube.js/issues This is a bug, please report it at https://github.com/LuanRT/YouTube.js/issues at ERROR_HANDLER (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/parser.js:91:76) at parseItem (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/parser.js:455:13) at Module.parseArray (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/parser.js:470:28) at new ReelShelf (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/classes/ReelShelf.js:17:68) at parseItem (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/parser.js:450:28) at Module.parseArray (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/parser.js:470:28) at new StructuredDescriptionContent (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/classes/StructuredDescriptionContent.js:30:68) at Module.parseItem (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/parser.js:450:28) at new EngagementPanelSectionList (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/classes/EngagementPanelSectionList.js:29:70) at parseItem (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/parser.js:450:28) at parseArray (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/parser.js:470:28) at Module.parseResponse (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/parser.js:391:31) at new MediaInfo (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/core/mixins/MediaInfo.js:32:91) at new VideoInfo (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/parser/youtube/VideoInfo.js:66:9) at Innertube.getInfo (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/youtubei.js/dist/src/Innertube.js:74:16) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async getYoutubeTranscript (webpack-internal:///(rsc)/./src/lib/youtube/get-youtube-transcript.ts:17:22) at async eval (webpack-internal:///(rsc)/./src/server/api/routers/test/index.ts:37:16) at async resolveMiddleware (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs:110:30) at async callRecursive (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs:160:32) at async eval (webpack-internal:///(rsc)/./src/server/api/trpc.ts:87:20) at async callRecursive (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs:160:32) at async procedure (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs:190:24) at async eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/resolveResponse.mjs:207:30) at async Promise.all (index 0) at async resolveResponse (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/resolveResponse.mjs:408:26) at async fetchRequestHandler (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/adapters/fetch/fetchRequestHandler.mjs:39:12) at async node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:55038 at async ek.execute (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:45808) at async ek.handle (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:56292) at async doRender (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1377:42) at async cacheEntry.responseCache.get.routeKind (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1587:40) at async DevServer.renderToResponseWithComponentsImpl (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1507:28) at async DevServer.renderPageComponent (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1931:24) at async DevServer.renderToResponseImpl (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1969:32) at async DevServer.pipeImpl (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:920:25) at async NextNodeServer.handleCatchallRenderRequest (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js:272:17) at async DevServer.handleRequestImpl (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:816:17) at async node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/dev/next-dev-server.js:339:20 at async Span.traceAsyncFn (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/trace/trace.js:154:20) at async DevServer.handleRequest (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/dev/next-dev-server.js:336:24) at async invokeRender (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:174:21) at async handleRequest (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:353:24) at async requestHandlerImpl (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:377:13) at async Server.requestListener (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/lib/start-server.js:141:13)
I don't know how could I remove the warnings and make it work perfectly.
Seeing warnings and unsure if it is working as expected internally.
Default
No response
The text was updated successfully, but these errors were encountered:
Closing as should be solved here: #758
Sorry, something went wrong.
No branches or pull requests
Steps to reproduce
Install unstorage package:
Create cache:
Failure Logs
Expected behavior
I don't know how could I remove the warnings and make it work perfectly.
Current behavior
Seeing warnings and unsure if it is working as expected internally.
Version
Default
Anything else?
No response
Checklist
The text was updated successfully, but these errors were encountered: