Open matthieuEv opened 1 year ago
I'm getting the same error in my project without changing anything. Presumably YouTube changed something up, but I certainly didn't expect that to produce an error like this!
Yeah I also just started getting this error today. My app was working fine yesterday, and one of my users just notified me that one my features that uses ytdl-core wasn't working. Hope it gets fixed soon!
same error
I have the same error :(
Same ! Showing like this for me:
evalmachine.<anonymous>:426
koa=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,JB(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};gma(ncode);
^^^^^^^^^^^^^^^^
SyntaxError: Invalid or unexpected token
at new Script (node:vm:93:7)
at Object.exports.decipherFormats (/usr/src/app/node_modules/ytdl-core/lib/sig.js:116:51)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async exports.getInfo (/usr/src/app/node_modules/ytdl-core/lib/info.js:401:17)
as a quick investigation, I beleive the error is related to funcion extractNCode
in sig.js
oa=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,JB(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]}'\n"===f.substring(0,5)&&(f=f.substring(5)),e=JSON.parse(f));break;case "XML":if(a=(a=c.responseXML)?moa(a):null)e={},g.cc(a.getElementsByTagName("*"),function(h){e[h.tagName]=noa(h)})}d&&ooa(e);
is being mis-parsed
could be related to function utils.cutAfterJS
failing to parse (")]}'\n"===f.substring(0,5)&&(f=f.substring(5)),e=JSON.parse(f))
I'm also facing this problem...
Same issue: Invalid or unexpected token
+1\
https://github.com/fent/node-ytdl-core/issues/1251#issuecomment-1709425519
Try it. Work for me.
+1 i got it today too without changing any of the code
I got a similar error without changing any code as well:
koa=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,JB(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};gma(ncode);"
severity: "ERROR"
textPayload: "SyntaxError: Invalid or unexpected token
at new Script (node:vm:94:7)
at exports.decipherFormats (/workspace/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 (/workspace/node_modules/ytdl-core/lib/info.js:401:17)"
timestamp: "2023-11-14T21:57:40.661609Z"
trace: "projects/sophia-db784/traces/d776aacfe766abe87cba7cc4def33496"
Seeing this issue as well without any changes to code.
I get the following error. Same with @khlevon 's PR sadly.
Error occurred in handler for 'main:getVideoInfo': evalmachine.<anonymous>:426
koa=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,JB(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};gma(ncode);
^^^^^^^^^^^^^^^^
SyntaxError: Invalid or unexpected token
at new Script (node:vm:100:7)
at Object.exports.decipherFormats (/Users/melle/Git/JYTDownload/node_modules/ytdl-core/lib/sig.js:116:51)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async exports.getInfo (/Users/melle/Git/JYTDownload/node_modules/ytdl-core/lib/info.js:401:17)
You can try this solution: https://github.com/fent/node-ytdl-core/issues/1252#issuecomment-1734429635
This way you solved my problem! https://github.com/fent/node-ytdl-core/issues/1252#issuecomment-1734429635
You can try this solution: #1252 (comment)
This worked for me, thanks a lot
Same error, and solution with npm i ytdl-core@npm:@distube/ytdl-core
doesn't help me (
Same problem, but using this patched version worked for me, from PR #1217.
"ytdl-core": "git+ssh://git@github.com:khlevon/node-ytdl-core.git#v4.11.4-patch.2"
I was working on a project, when suddently, ytdl-core stoped working. So i created a new project to try a simple code:
I have the latest package of ytdl:
ytdl-core@4.11.5
But when i run the code:
node index.js,
i get the error:I'm not sure what appened, but it was working just fine, and suddently, this appear out of knowhere, without modifying anything.