Open arian0gen opened 1 year ago
Same issue here. It happens but not every time.
Edit : You can use 4.10.0
, it works but is kinda slow.
I have the same issue :
evalmachine.
Exact same issue and error as the one mentioned above me.
provisionally im using https://www.npmjs.com/package/@distube/ytdl-core work for me
Try this:
"ytdl-core": "npm:@distube/ytdl-core",
Happened a few hours ago a few times, then it worked again, now it's broken again
@Sansekai
provisionally im using https://www.npmjs.com/package/@distube/ytdl-core work for me
Try this:
"ytdl-core": "npm:@distube/ytdl-core",
Don't forget to add the version number ^4.11.9
"ytdl-core": "npm:@distube/ytdl-core@^4.11.9"
this exact error was 2 weeks ago in 4.11.3 and then we freaked out, and then they fixed and now it is back again, it is probably because youtube keep changing their code so...
This fork uses some custom HTTP client that doesn't play ball when you mock fetch in tests: https://www.npmjs.com/package/undici
It works in practice but it ruins all my test suites.
After some research I've found that the problem has to do with the signature deciphering extraction of functions, specifically the extractNCode
function, when calling cutAfterJS it fails to escape the following string /[/,-33,/,/]{/,function
due to the literal /
characters inside a RegEx character set, and so it counts opening and closing brackets incorrectly as it treats most part of the code as a regular expression, resulting in the script not getting to the end of the function and missing a catch block and a return statement.
TEMP FIX Add a check for RegEx character sets, replace https://github.com/fent/node-ytdl-core/blob/0d3f91b424e81aa79fc2ec021d921d4d21f3e6ef/lib/utils.js#L97-L102
with
// Go through all characters from the start
for (i = 0; i < mixedJson.length; i++) {
// End of current escaped object
if (!isEscaped && isEscapedObject !== null && mixedJson[i] === isEscapedObject.end) {
// Ignore character inside RegEx character set with a range of 30 characters
let charsetStart = mixedJson.substring(i - 15, i).search(/\[[^\]]*/)
let charsetEnd = mixedJson.substring(i, i + 15).search(/[^\[]*\]/)
if (mixedJson[i] == '/' && charsetStart !== -1 && charsetEnd !== -1)
continue;
isEscapedObject = null;
continue;
You can find the file locally in ./node_modules/ytdl-core/lib/utils.js
After some research I've found that the problem has to do with the signature deciphering extraction of functions, specifically the
extractNCode
function, when calling cutAfterJS it fails to escape the following string/[/,-33,/,/]{/,function
due to the literal/
characters inside a RegEx character set, and so it counts opening and closing brackets incorrectly as it treats most part of the code as a regular expression, resulting in the script not getting to the end of the function and missing a catch block and a return statement.TEMP FIX Add a check for RegEx character sets, replace
with
// Go through all characters from the start for (i = 0; i < mixedJson.length; i++) { // End of current escaped object if (!isEscaped && isEscapedObject !== null && mixedJson[i] === isEscapedObject.end) { // Ignore character inside RegEx character set with a range of 30 characters let charsetStart = mixedJson.substring(i - 15, i).search(/\[[^\]]*/) let charsetEnd = mixedJson.substring(i, i + 15).search(/[^\[]*\]/) if (mixedJson[i] == '/' && charsetStart !== -1 && charsetEnd !== -1) continue; isEscapedObject = null; continue;
You can find the file locally in
./node_modules/ytdl-core/lib/utils.js
This works for me. I made a patch with this changes, so you can use it with
"ytdl-core": "git+https://github.com/dim4ik1106/node-ytdl-core.git#master",
To make your code work you can use this patch
"ytdl-core": "git+ssh://git@github.com:khlevon/node-ytdl-core.git#v4.11.4-patch.1"
UnhandledPromiseRejectionWarning: Error: Could not parse decipher function: TypeError: decipherFuncName.replaceAll is not a function
Apr 27 10:07:58 PM at extractDecipher (/opt/render/project/src/node_modules/ytdl-core/lib/sig.js:92:13)
Apr 27 10:07:58 PM at Object.exports.extractFunctions (/opt/render/project/src/node_modules/ytdl-core/lib/sig.js:126:3)
Apr 27 10:07:58 PM at /opt/render/project/src/node_modules/ytdl-core/lib/sig.js:22:29
Apr 27 10:07:58 PM at runMicrotasks (
To make your code work you can use this patch
"ytdl-core": "git+ssh://git@github.com:khlevon/node-ytdl-core.git#v4.11.4-patch.1"
For me this syntax worked:
"ytdl-core": "https://github.com/khlevon/node-ytdl-core.git#v4.11.4-patch.1"
To make your code work you can use this patch
"ytdl-core": "git+ssh://git@github.com:khlevon/node-ytdl-core.git#v4.11.4-patch.1"
In case someone needs to have node 12 and 14 support, you can use this patch
"ytdl-core": "git+ssh://git@github.com:khlevon/node-ytdl-core.git#v4.11.4-patch.2"
For more details check this PR: https://github.com/fent/node-ytdl-core/pull/1217 Also, do not hesitate to review the code and write comments or approve it :)
@Sansekai
provisionally im using https://www.npmjs.com/package/@distube/ytdl-core work for me Try this:
"ytdl-core": "npm:@distube/ytdl-core",
Don't forget to add the version number
^4.11.9
"ytdl-core": "npm:@distube/ytdl-core@^4.11.9"
4.11.9 cannot play some streams, I updated to 4.11.10
and it's working normally
npm i ytdl-core@npm:@distube/ytdl-core@latest
4.11.5 same issue
npm install khlevon/node-ytdl-core.git#v4.11.4-patch.1
work
evalmachine.:24
c[74]),c[64])((0,c[25])(c[24],c[41]),c[35],c[33+Math.pow(8,3)%229],c[92]),c[70])(c[87],c[27])}try{8>=c[92]&&(0,c[15])((0,c[35])(c[36],c[20]),c[11],c[29])}catch(d){(0,c[60])(c[92],c[93])}try{1>c[45]?((0,c[60])(c[2],c[93]),c[60])(c[91],c[93]):((0,c[88])(c[93],c[86]),c[11])(c[57])}catch(d){(0,c[85])((0,c[80])(),c[56],c[0])}};qma(ncode);
SyntaxError: Missing catch or finally after try