fent / node-ytdl-core

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

Invalid regular expression: missing / #1110

Closed GreepTheSheep closed 2 years ago

GreepTheSheep commented 2 years ago

Since 1 or 2 hours, all videos passed on ytdl-core return this "Invalid regular expression" error

Stack trace:

evalmachine.<anonymous>:11
"mfZru","cfYAzm",1897615910,414154674,"IluoVc5",null,1,"XsmT",-659785013,577478260,-419211961,1087899650,/,,[/,913,/](,)};Wka(ncode);
                                                                                                         ^

SyntaxError: Invalid regular expression: missing /
    at new Script (node:vm:100:7)
    at exports.decipherFormats (D:\Documents\GitHub\ReAllToMP3\node_modules\ytdl-core\lib\sig.js:116:51)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
    at async exports.getInfo (D:\Documents\GitHub\ReAllToMP3\node_modules\ytdl-core\lib\info.js:401:17)

ytdl-core version: 4.11.0

Edit: Temporary fix linked here: https://github.com/fent/node-ytdl-core/issues/1110#issuecomment-1219856316

Mikecerc commented 2 years ago

I'm having the same problem as well. Receiving the same error as above. Everything worked fine yesterday.

cchen028 commented 2 years ago

Experiencing same issue, getting identical stack trace as well.

MohamedMontasser03 commented 2 years ago

Okay I am trying to figure out the problem but this is my first time working with the source code of this project and with the youtube cipher algorithm so it's taking a while anyways I've narrowed the problem down to a problem with evaluating nTransformScript because the code returned from youtube is for some reason broken, that's the conclusion I reached

TaylorDuck72 commented 2 years ago

Still having same problem

austinharms commented 2 years ago

this solved it for me https://github.com/fent/node-ytdl-core/issues/1108#issuecomment-1212500413

Hakunek commented 2 years ago

If you need to use it rn and don't want to/can't tinker inside module downgrade to version 4.10.0 npm command: npm i ytld-core@4.10.0 only versions 4.10.1+ gave me this error during testing

austinharms commented 2 years ago

I also had the issue on version 4.10.0, and 4.9.? (I can't remember the last digit) apparently I screwed up the downgrade when testing the different versions

MohamedMontasser03 commented 2 years ago

this solved it for me #1108 (comment)

Not sure if that's the proper solution or not but it does work

MidSpike commented 2 years ago

Can reproduce: with almost all videos that I test with:

Trace: evalmachine.<anonymous>:11
"mfZru","cfYAzm",1897615910,414154674,"IluoVc5",null,1,"XsmT",-659785013,577478260,-419211961,1087899650,/,,[/,913,/](,)};Wka(ncode);
                                                                                                         ^

SyntaxError: Invalid regular expression: missing /
PowerBuxoK commented 2 years ago

same problem with any video


"mfZru","cfYAzm",1897615910,414154674,"IluoVc5",null,1,"XsmT",-659785013,577478260,-419211961,1087899650,/,,[/,913,/](,)};Wka(ncode);
                                                                                                         ^

SyntaxError: Invalid regular expression: missing /
    at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (C:\DiscordBots\Botik_v2.0\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 (C:\DiscordBots\Botik_v2.0\node_modules\ytdl-core\lib\info.js:401:17)

Node.js v17.5.0```
dskaiser82 commented 2 years ago

@austinharms I went into package.json changed the version to "ytdl-core": "4.10.0"

deleted my node modules and ran yarn (yarn for me)

I'm back!

Holy shit I was about to wipe my system because this week I had some pc malware issues I solved. But when in doubt CHECK the GITHUB! I was that close....thanks to everyone for the comments...

I skew front-end but hoping devs solve the issue!

dskaiser82 commented 2 years ago

But if we know 4.10.0 works, then we know that the PR that came after introduced a bug....so whats the PR for 4.10.1?

dskaiser82 commented 2 years ago

@dsnsgithub on 4.10.0 its slow but downloading but will test audio when its up

dsnsgithub commented 2 years ago

@dskaiser82 Thank you, your fix works. ytdl-core@4.10.0 seems to be working while ytdl-core@4.11.0 seems to have a problem with dependences.

dskaiser82 commented 2 years ago

@dsnsgithub Good! Yean I have audio working fine too on the video below....but did take a longer than normal....I want to test another vid to see if speeds can be faster....but for now I'll take this band aid fix

https://www.youtube.com/watch?v=moiS5zDIuPM

dskaiser82 commented 2 years ago

Yeah I think this version is slower than before, but I do like to do highest Audio, Highest Video

gatecrasher777 commented 2 years ago

Last week it was closing braces in strings. To confuse parsers. This week YouTube have thrown some regex into their code spaghetti.

WaqasIbrahim commented 2 years ago

Can anyone please attach base.js file that has this issue because I can't reproduce this on my end.

gatecrasher777 commented 2 years ago

@WaqasIbrahim sent via email

danielsss commented 2 years ago

I've got the same issue +1

gatecrasher777 commented 2 years ago

Needs exports.cutAfterJSON in util.js to skip over regex.

When it encounters


/,,[/,913,/](,)}/

as an array value in base.js it sees the } as the end of the n code function that is being parsed. So evaluation breaks.

WaqasIbrahim commented 2 years ago

I just tested ncode extraction on a file @gatecrasher777 sent. The solution I suggested in the closed issue: https://github.com/fent/node-ytdl-core/issues/1108#issuecomment-1212500413 still works.

aymenitc commented 2 years ago

I just tested ncode extraction on a file @gatecrasher777 sent. The solution I suggested in the closed issue: #1108 (comment) still works.

this fix is working for me 100%

arinmodi commented 2 years ago

downgrading the version decreases the singnificat download spped, how can i solve that ?

CuteSkyler commented 2 years ago

For some reason, I kept getting HTTPError [FetchError]: request to https://discord.com/api/v7/channels/[channelid]/messages failed, reason: read ECONNRESET in the new update, if it is of any help. Downgrading to ytdl-core@4.10.0 fixed it for me.

dskaiser82 commented 2 years ago

@arinmodi Thats the state I chose, degraded version but MUCH slower download speeds.....no PR's in yet for the fix right?

GreepTheSheep commented 2 years ago

Made a fork of the temporary fix here: https://github.com/GreepTheSheep/node-ytdl-core

You can add it on your package.json with npm npm i ytdl-core@https://github.com/GreepTheSheep/node-ytdl-core

dskaiser82 commented 2 years ago

@GreepTheSheep Good stuff! I took the fix one step further and did a Pull Request so we can get this fix in. GreepTheSheep this PR is just that one commit u had for the fork

PR waiting for approval....anyone know who has PR approval/merge rights? PR: https://github.com/fent/node-ytdl-core/pull/1111

LeGeek01 commented 2 years ago

same problem with any videos, I have the latest version of ytdl-core

gatecrasher777 commented 2 years ago

PR waiting for approval....anyone know who has PR approval/merge rights? PR: #1111

@TimeForANinja

LeGeek01 commented 2 years ago

downgrading to 4.10.0 solved the problem for me! Waiting for a new version...

nukeop commented 2 years ago

Let me know if I can throw a few bucks the maintainers' way, they're doing God's work.

ShadowLp174 commented 2 years ago

This error message just sudenly changed... yesterday it was the invalid regex, now it's something new:

evalmachine.<anonymous>:24
c[72],c[6]),(0,c[85])(c[11]),(0,c[41])(c[39],c[28],(0,c[66])()),(0,c[78])(c[Math.pow(6,2)+122+-119],c[new Date("Wednesday December 31 1969 19:00:1
4 CDT")/1E3])}catch(d){(0<c[0]||(((0,c[80])(c[60],c[88]),c[80])(c[21],c[88]),0))&&(0,c[17])((0,c[70])(c[6]),c[78],c[88],c[12])}try{2<c[91]&&(1<c[5
3]?(0,c[17])((0,c[80])(c[82],c[6]),c[78],c[39],c[5]):((0,c[45])(c[49],c[88]),c[78])(c[88],c[86])),(0,c[17])((0,c[85])(c[31]),c[41],c[88],c[75],(0,
c[35])())}catch(d){}};Wka(ncode);

                    ^

SyntaxError: Missing catch or finally after try
    at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (D:\JS\revolt butler\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 (D:\JS\revolt butler\node_modules\ytdl-core\lib\info.js:401:17)
dskaiser82 commented 2 years ago

PR: https://github.com/fent/node-ytdl-core/pull/1111

We have some approvals but this is the blocker: "First-time contributors need a maintainer to approve running workflows. Learn more. 1 successful check"

Who is a maintainer?

ShadowLp174 commented 2 years ago

This error message just sudenly changed... yesterday it was the invalid regex, now it's something new:

evalmachine.<anonymous>:24
c[72],c[6]),(0,c[85])(c[11]),(0,c[41])(c[39],c[28],(0,c[66])()),(0,c[78])(c[Math.pow(6,2)+122+-119],c[new Date("Wednesday December 31 1969 19:00:1
4 CDT")/1E3])}catch(d){(0<c[0]||(((0,c[80])(c[60],c[88]),c[80])(c[21],c[88]),0))&&(0,c[17])((0,c[70])(c[6]),c[78],c[88],c[12])}try{2<c[91]&&(1<c[5
3]?(0,c[17])((0,c[80])(c[82],c[6]),c[78],c[39],c[5]):((0,c[45])(c[49],c[88]),c[78])(c[88],c[86])),(0,c[17])((0,c[85])(c[31]),c[41],c[88],c[75],(0,
c[35])())}catch(d){}};Wka(ncode);

                    ^

SyntaxError: Missing catch or finally after try
    at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (D:\JS\revolt butler\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 (D:\JS\revolt butler\node_modules\ytdl-core\lib\info.js:401:17)

Wanted to add that this can too be fixed by downgrading to 4.10.0

gatecrasher777 commented 2 years ago

Downgrading to 4.10.0 will mean the N transform gracefully fails. Everything will work, but downloads will be throttled.

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 4.11.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

nukeop commented 2 years ago

They're at it again, it stopped working just today.

aymenitc commented 2 years ago

Today I'm get the same error again : Invalid regular expression: missing /

MidSpike commented 2 years ago
Trace: evalmachine.<anonymous>:13
-1929233002,b,/,][};Xka(ncode);
              ^

SyntaxError: Invalid regular expression: missing /
    at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (C:\hi-there-github\node_modules\ytdl-core\lib\sig.js:116:51)
ThatGuyJacobee commented 2 years ago

Same here receiving since about yesterday 10pm UK time:

Invalid regular expression: missing /

aymenitc commented 2 years ago

Found a fix: #1111

Same solution as the previous regex errors.

LeGeek01 commented 2 years ago

yes the error come's back

LeGeek01 commented 2 years ago

and downgrading to 4.10.0 solved the problem, again

nukeop commented 2 years ago

Is it throttled though?