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

Invalid or unexpected token ytdl core latest #1250

Open
eduardommelo opened this issue Sep 6, 2023 · 14 comments
Open

Invalid or unexpected token ytdl core latest #1250

eduardommelo opened this issue Sep 6, 2023 · 14 comments

Comments

@eduardommelo
Copy link

eduardommelo commented Sep 6, 2023

error evalmachine.<anonymous>:426
Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);

                                                                                                                   ^^^^^^^^^^^^^^^^
 SyntaxError: Invalid or unexpected token
   at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (/root/site/api/node_modules/ytdl-core/lib/sig.js:116:51)
   at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
     at async exports.getInfo (/root/site/api/node_modules/ytdl-core/lib/info.js:401:17)
 error evalmachine.<anonymous>:426
 Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);

                                                                                                                   ^^^^^^^^^^^^^^^^
 SyntaxError: Invalid or unexpected token
   at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (/root/site/api/node_modules/ytdl-core/lib/sig.js:116:51)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
   at async exports.getInfo (/root/site/api/node_modules/ytdl-core/lib/info.js:401:17)
 error evalmachine.<anonymous>:426
 Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);
@maradona4
Copy link

u too
image

@aymenitc
Copy link

aymenitc commented Sep 6, 2023

Me too

@ChristopherFrydryck
Copy link

I downgraded to 4.10.0 using npm i ytdl-core@4.1.0 and it is working but download speeds are significantly slower. Hopefully this can get patched soon.

@ChristopherFrydryck
Copy link

I downgraded to 4.10.0 using npm i ytdl-core@4.1.0 and it is working but download speeds are significantly slower. Hopefully this can get patched soon.

Note: This bug is tied to the getInfo() function called in ^4.11.5

@SebaM90
Copy link

SebaM90 commented Sep 6, 2023

Me too 😪

@gathilas
Copy link

gathilas commented Sep 7, 2023

I’m getting the same error as well

@yyildiz
Copy link

yyildiz commented Sep 7, 2023

@ChristopherFrydryck - that speed issue was resolved in a later PR:
#1240
Could be helpful if you want to fork and have a working version

@mdale
Copy link

mdale commented Sep 7, 2023

#1240 seems to be running very slow as well.

@hclever
Copy link

hclever commented Sep 7, 2023

I’m getting the same error as well

@ChhayPhearum
Copy link

I downgraded to 4.10.0 npm i ytdl-core@4.10.0, and it's working fine.
hope can help who urgently to using.

@eduardommelo
Copy link
Author

error evalmachine.<anonymous>:426
Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);

                                                                                                                   ^^^^^^^^^^^^^^^^
 SyntaxError: Invalid or unexpected token
   at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (/root/site/api/node_modules/ytdl-core/lib/sig.js:116:51)
   at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
     at async exports.getInfo (/root/site/api/node_modules/ytdl-core/lib/info.js:401:17)
 error evalmachine.<anonymous>:426
 Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);

                                                                                                                   ^^^^^^^^^^^^^^^^
 SyntaxError: Invalid or unexpected token
   at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (/root/site/api/node_modules/ytdl-core/lib/sig.js:116:51)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
   at async exports.getInfo (/root/site/api/node_modules/ytdl-core/lib/info.js:401:17)
 error evalmachine.<anonymous>:426
 Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);

I solve the problem by updating the sig.js code by this Pr that I had already done https://github.com/khlevon/node-ytdl-core/blob/fix/youtube-issue-2/lib/sig.js

PR #1217

@Garima-sharma814
Copy link

Garima-sharma814 commented Sep 7, 2023

Facing the same issue!

Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);
                                                                                                                                                                                                                             ^^^^^^^^^^^^^^^^

SyntaxError: Invalid or unexpected token
    at new Script (node:vm:100:7)
    at exports.decipherFormats (/.../node_modules/ytdl-core/lib/sig.js:116:51)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at async exports.getInfo (/.../node_modules/ytdl-core/lib/info.js:401:17)

Although I solved this issue by downgrading to 4.10.0 it is working but download speeds are slower.

This bug is connected to the getInfo() function called in ^4.11.5 in lib/sig.js file and lib/info.js.

Hopefully, this gets fixed soon.

@aymenitc
Copy link

aymenitc commented Sep 7, 2023

error evalmachine.<anonymous>:426
Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);

                                                                                                                   ^^^^^^^^^^^^^^^^
 SyntaxError: Invalid or unexpected token
   at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (/root/site/api/node_modules/ytdl-core/lib/sig.js:116:51)
   at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
     at async exports.getInfo (/root/site/api/node_modules/ytdl-core/lib/info.js:401:17)
 error evalmachine.<anonymous>:426
 Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);

                                                                                                                   ^^^^^^^^^^^^^^^^
 SyntaxError: Invalid or unexpected token
   at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (/root/site/api/node_modules/ytdl-core/lib/sig.js:116:51)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
   at async exports.getInfo (/root/site/api/node_modules/ytdl-core/lib/info.js:401:17)
 error evalmachine.<anonymous>:426
 Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);

I solve the problem by updating the sig.js code by this Pr that I had already done https://github.com/khlevon/node-ytdl-core/blob/fix/youtube-issue-2/lib/sig.js

PR #1217

Yes this solved it. Thanks a lot 😊

@94maldini
Copy link

error evalmachine.<anonymous>:426
Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);

                                                                                                                   ^^^^^^^^^^^^^^^^
 SyntaxError: Invalid or unexpected token
   at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (/root/site/api/node_modules/ytdl-core/lib/sig.js:116:51)
   at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
     at async exports.getInfo (/root/site/api/node_modules/ytdl-core/lib/info.js:401:17)
 error evalmachine.<anonymous>:426
 Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);

                                                                                                                   ^^^^^^^^^^^^^^^^
 SyntaxError: Invalid or unexpected token
   at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (/root/site/api/node_modules/ytdl-core/lib/sig.js:116:51)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
   at async exports.getInfo (/root/site/api/node_modules/ytdl-core/lib/info.js:401:17)
 error evalmachine.<anonymous>:426
 Ama=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,oC(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Ila(ncode);

I solve the problem by updating the sig.js code by this Pr that I had already done https://github.com/khlevon/node-ytdl-core/blob/fix/youtube-issue-2/lib/sig.js

PR #1217

thanks for the solution, now it works fine

taahamahdi added a commit to Brainicism/KMQ_Discord that referenced this issue Sep 10, 2023
taahamahdi added a commit to Brainicism/KMQ_Discord that referenced this issue Sep 11, 2023
Nich87 added a commit to Nich87/ytd-kit that referenced this issue Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests