node-ytdl-core icon indicating copy to clipboard operation
node-ytdl-core copied to clipboard

Invalid or unexpected token ytdl core latest

Open eduardommelo opened this issue 2 years ago • 14 comments

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);

eduardommelo avatar Sep 06 '23 22:09 eduardommelo

u too image

maradona4 avatar Sep 06 '23 22:09 maradona4

Me too

aymenitc avatar Sep 06 '23 22:09 aymenitc

I downgraded to 4.10.0 using npm i [email protected] and it is working but download speeds are significantly slower. Hopefully this can get patched soon.

ChristopherFrydryck avatar Sep 06 '23 22:09 ChristopherFrydryck

I downgraded to 4.10.0 using npm i [email protected] 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

ChristopherFrydryck avatar Sep 06 '23 22:09 ChristopherFrydryck

Me too 😪

SebaM90 avatar Sep 06 '23 23:09 SebaM90

I’m getting the same error as well

gathilas avatar Sep 07 '23 00:09 gathilas

@ChristopherFrydryck - that speed issue was resolved in a later PR: https://github.com/fent/node-ytdl-core/issues/1240 Could be helpful if you want to fork and have a working version

yyildiz avatar Sep 07 '23 00:09 yyildiz

https://github.com/fent/node-ytdl-core/issues/1240 seems to be running very slow as well.

mdale avatar Sep 07 '23 01:09 mdale

I’m getting the same error as well

hclever avatar Sep 07 '23 02:09 hclever

I downgraded to 4.10.0 npm i [email protected], and it's working fine. hope can help who urgently to using.

ChhayPhearum avatar Sep 07 '23 02:09 ChhayPhearum

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 https://github.com/fent/node-ytdl-core/pull/1217

eduardommelo avatar Sep 07 '23 03:09 eduardommelo

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.

Garima-sharma814 avatar Sep 07 '23 07:09 Garima-sharma814

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 😊

aymenitc avatar Sep 07 '23 09:09 aymenitc

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

94maldini avatar Sep 09 '23 16:09 94maldini