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

(4.1.0) InnertubeError: Something went wrong at PlayerCaptionsTracklist! #372

Closed
4 tasks done
wukko opened this issue Mar 26, 2023 · 1 comment · Fixed by #374
Closed
4 tasks done

(4.1.0) InnertubeError: Something went wrong at PlayerCaptionsTracklist! #372

wukko opened this issue Mar 26, 2023 · 1 comment · Fixed by #374
Labels
bug Something isn't working fixed

Comments

@wukko
Copy link

wukko commented Mar 26, 2023

Steps to reproduce

i'm using getBasicInfo function with ANDROID client. no idea which videos in particular cause this error to occur, it seems to happen once in a while without ties to any specific video.

code snippet:

import { Innertube } from 'youtubei.js';
const yt = await Innertube.create();

try {
    info = await yt.getBasicInfo('video id here', 'ANDROID');
} catch (e) {
    console.log(e);
}

Failure Logs

InnertubeError: Something went wrong at PlayerCaptionsTracklist!
This is a bug, please report it at https://github.com/LuanRT/YouTube.js/issues
    at Parser._Parser_printError (node_modules/youtubei.js/dist/src/parser/parser.js:405:18)
    at Parser.parseItem (node_modules/youtubei.js/dist/src/parser/parser.js:242:77)
    at Parser.parseResponse (node_modules/youtubei.js/dist/src/parser/parser.js:185:31)
    at new MediaInfo (node_modules/youtubei.js/dist/src/core/MediaInfo.js:34:29)
    at new VideoInfo (node_modules/youtubei.js/dist/src/parser/youtube/VideoInfo.js:53:9)
    at Innertube.<anonymous> (node_modules/youtubei.js/dist/src/Innertube.js:111:20)
    at Generator.next (<anonymous>)
    at fulfilled (node_modules/youtubei.js/dist/src/Innertube.js:4:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  info: {
    stack: "TypeError: Cannot read properties of undefined (reading 'map')\n" +
      '    at new PlayerCaptionsTracklist (node_modules/youtubei.js/dist/src/parser/classes/PlayerCaptionsTracklist.js:23:64)\n' +
      '    at Parser.parseItem (node_modules/youtubei.js/dist/src/parser/parser.js:237:32)\n' +
      '    at Parser.parseResponse (node_modules/youtubei.js/dist/src/parser/parser.js:185:31)\n' +
      '    at new MediaInfo (node_modules/youtubei.js/dist/src/core/MediaInfo.js:34:29)\n' +
      '    at new VideoInfo (node_modules/youtubei.js/dist/src/parser/youtube/VideoInfo.js:53:9)\n' +
      '    at Innertube.<anonymous> (node_modules/youtubei.js/dist/src/Innertube.js:111:20)\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at fulfilled (node_modules/youtubei.js/dist/src/Innertube.js:4:58)\n' +
      '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)'
  },
  date: 2023-03-26T01:24:42.567Z,
  version: '4.1.0'
}

Expected behavior

i expect getBasicInfo to either handle such errors by itself, or emit an error event for me to handle it

Current behavior

getBasicInfo crashes the entire project by throwing an uncatchable 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.
@wukko wukko added the bug Something isn't working label Mar 26, 2023
@LuanRT
Copy link
Owner

LuanRT commented Mar 26, 2023

getBasicInfo crashes the entire project by throwing an uncatchable error :(

Are you sure this throws an error? These parser warnings are not supposed to crash your program. The only thing that should be affected is the PlayerCaptionsTracklist node, unless you rely on data this node holds somewhere else in your code.

You should still get most of the data (try logging the info object and remove the try-catch to verify this), but the captions prop will be null.

Relevant bits of code:

captions?: PlayerCaptionsTracklist;

this.captions = info.captions;

static #printError({ classname, classdata, err }: ParserError) {

Affected node:
https://github.com/LuanRT/YouTube.js/blob/main/src/parser/classes/PlayerCaptionsTracklist.ts

Anyway, thanks for reporting! I'll look into fixing it this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants