fent / node-ytdl-core

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

how to fix that? #1124

Closed NoLogicAlan closed 2 years ago

NoLogicAlan commented 2 years ago
evalmachine.<anonymous>:344
qma=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,ku(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};Xka(ncode);
                                                                                                                                                                                                                             ^^^^^^^^^^^^^^^^

SyntaxError: Invalid or unexpected token
    at new Script (node:vm:100:7)
    at exports.decipherFormats (C:\Users\rzzr4\Downloads\SeveralDullConnections\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 (C:\Users\rzzr4\Downloads\SeveralDullConnections\node_modules\ytdl-core\lib\info.js:401:17)
aandrew-me commented 2 years ago

I am also getting the same error. Downgrading to 4.10.0 works however seems like Download speeds are low

NoLogicAlan commented 2 years ago

I am also getting the same error. Downgrading to 4.10.0 works however seems like Download speeds are low

no need to Downgrading just do this in ( node_modules\ytdl-core\lib\sig.js )

if (ndx >= 0) {
        const end = body.indexOf('.join("")};', ndx) + 11; // add 11 to include the .join part
        const subBody = body.slice(ndx, end);
        const functionBody = `${subBody}${functionName}(ncode);`;
        functions.push(functionBody);
      }

it works with me

nwalkewicz commented 2 years ago

@NoLogicAlan Could you create a PR for this fix?