fent / node-ytdl-core

YouTube video downloader in javascript.
MIT License
4.48k stars 790 forks source link

Invalid or unexpected token ytdl core latest #1250

Open eduardommelo opened 1 year ago

eduardommelo commented 1 year ago
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);
aymenitc commented 1 year ago

Me too

ChristopherFrydryck commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Me too 😪

gathilas commented 1 year ago

I’m getting the same error as well

yyildiz commented 1 year ago

@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

mdale commented 1 year ago

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

hclever commented 1 year ago

I’m getting the same error as well

ChhayPhearum commented 1 year ago

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 commented 1 year ago
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

Garima-sharma814 commented 1 year ago

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 commented 1 year ago
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 commented 1 year ago
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