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

1.4.4 Streaming data fetching results in a parsing error #134

Closed
4 tasks done
walking-octopus opened this issue Aug 11, 2022 · 1 comment
Closed
4 tasks done

1.4.4 Streaming data fetching results in a parsing error #134

walking-octopus opened this issue Aug 11, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@walking-octopus
Copy link

walking-octopus commented Aug 11, 2022

Steps to reproduce

I just tried fetching the streaming data. I don't know anything about InnerTube API, so I'm not sure if this error is normal. It still retrieves the data, but this error concerns me.

Failure Logs

Server error:  ParsingError: Could not transform n-token, download may be throttled.
    at NToken.transform (/home/stas/cathode-tube/build/x86_64-linux-gnu/app/install/yt-ws/node_modules/youtubei.js/lib/deciphers/NToken.js:55:21)
    at /home/stas/cathode-tube/build/x86_64-linux-gnu/app/install/yt-ws/node_modules/youtubei.js/lib/Innertube.js:432:125
    at Array.forEach (<anonymous>)
    at Innertube.#chooseFormat (/home/stas/cathode-tube/build/x86_64-linux-gnu/app/install/yt-ws/node_modules/youtubei.js/lib/Innertube.js:420:13)
    at Innertube.getStreamingData (/home/stas/cathode-tube/build/x86_64-linux-gnu/app/install/yt-ws/node_modules/youtubei.js/lib/Innertube.js:488:46)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async WebSocket.<anonymous> (file:///home/stas/cathode-tube/build/x86_64-linux-gnu/app/install/yt-ws/index.js:203:33) {
  info: {
    original_token: 'YwXptdr-M4sGuFl',
    stack: 'SyntaxError: Unexpected token u in JSON at position 189\n' +
      '    at JSON.parse (<anonymous>)\n' +
      '    at NToken.#getTransformationData (/home/stas/cathode-tube/build/x86_64-linux-gnu/app/install/yt-ws/node_modules/youtubei.js/lib/deciphers/NToken.js:74:17)\n' +
      '    at NToken.transform (/home/stas/cathode-tube/build/x86_64-linux-gnu/app/install/yt-ws/node_modules/youtubei.js/lib/deciphers/NToken.js:20:56)\n' +
      '    at /home/stas/cathode-tube/build/x86_64-linux-gnu/app/install/yt-ws/node_modules/youtubei.js/lib/Innertube.js:432:125\n' +
      '    at Array.forEach (<anonymous>)\n' +
      '    at Innertube.#chooseFormat (/home/stas/cathode-tube/build/x86_64-linux-gnu/app/install/yt-ws/node_modules/youtubei.js/lib/Innertube.js:420:13)\n' +
      '    at Innertube.getStreamingData (/home/stas/cathode-tube/build/x86_64-linux-gnu/app/install/yt-ws/node_modules/youtubei.js/lib/Innertube.js:488:46)\n' +
      '    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
      '    at async WebSocket.<anonymous> (file:///home/stas/cathode-tube/build/x86_64-linux-gnu/app/install/yt-ws/index.js:203:33)'
  },
  date: 2022-08-11T20:11:06.390Z,
  version: '1.4.4'
}

Expected behavior

I expected this to fetch the data without any errors.

Current behavior

It fetches the data correctly but gives this parsing 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.
@walking-octopus walking-octopus added the bug Something isn't working label Aug 11, 2022
@LuanRT
Copy link
Owner

LuanRT commented Aug 11, 2022

Yup, YouTube changed their n token algorithm. I'm gonna update the NPM version later today.
Thanks.

Edit:
Note that this has already been fixed in v2.

Edit 2:
Also fixed in v1.4.5

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

No branches or pull requests

2 participants