question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1.4.2-d.3: JSON.parse error on getting new instance

See original GitHub issue

Expected Behavior

Create new instace of Innertube without any error

Current Behavior

Got error, while parsing json in SessionBuilder

Failure Information (for bugs)

Logs:

2022-05-19T04:08:15.593234+00:00 app[worker.1]: undefined:1
2022-05-19T04:08:15.593235+00:00 app[worker.1]: undefined
2022-05-19T04:08:15.593236+00:00 app[worker.1]: ^
2022-05-19T04:08:15.593236+00:00 app[worker.1]:
2022-05-19T04:08:15.593237+00:00 app[worker.1]: SyntaxError: Unexpected token u in JSON at position 0
2022-05-19T04:08:15.593237+00:00 app[worker.1]: at JSON.parse (<anonymous>)
2022-05-19T04:08:15.593238+00:00 app[worker.1]: at SessionBuilder.#getYtConfig (/app/node_modules/youtubei.js/lib/core/SessionBuilder.js:79:17)
2022-05-19T04:08:15.593241+00:00 app[worker.1]: at processTicksAndRejections (node:internal/process/task_queues:96:5)

2022-05-19T04:08:15.593241+00:00 app[worker.1]: at async Promise.all (index 0)
2022-05-19T04:08:15.593242+00:00 app[worker.1]: at async SessionBuilder.build (/app/node_modules/youtubei.js/lib/core/SessionBuilder.js:25:18)
2022-05-19T04:08:15.593244+00:00 app[worker.1]: at async Innertube.#init (/app/node_modules/youtubei.js/lib/Innertube.js:47:21)
2022-05-19T04:08:15.593244+00:00 app[worker.1]: at async file:///app/build/src/skills/youtube.js:19:28
2022-05-19T04:08:15.618562+00:00 app[worker.1]: error Command failed with exit code 1.

Steps to Reproduce

I trying to do this

  private _client

  constructor() {
    super()
    ;(async () => {
      this._client = await new Innertube()
    })()
  }

Failure Logs

Please include any relevant log snippets or files here.

Checklist

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I have provided sufficient information

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
shevernitskiycommented, May 19, 2022

It seems like we can obtain api key from https://www.youtube.com/sw.js_data And then fetch additional info from https://www.youtube.com/youtubei/v1/notification_registration/set_registration?key={key}&prettyPrint=false if needed.

I checked from heroku, this endpoints are available

0reactions
github-actions[bot]commented, Jun 22, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >
JSON.parse() not working
Your JsonObject seems is a Json Object. The reasons why you can't parse Json from a String: the String is surround by "...
Read more >
What Is JSON and How to Handle an “Unexpected Token” ...
Learn what JSON is and how you can deal with errors occurring when parsing JSON data, such as "Unexpected Token < in JSON...
Read more >
pandas.read_json — pandas 1.5.2 documentation
Convert a JSON string to pandas object. Parameters. path_or_bufa valid JSON str, path object or file-like object. Any valid string path is acceptable....
Read more >
How to fix Unexpected Token in JSON error (for ... - YouTube
Not a programmer? Read this! ** - If you get this error in an app you didn't make, and/or you're not a web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found