-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working! #1305
Comments
the same here #1295 |
FWIW A fix was found by this developer, although it would need porting: |
@corwin-of-amber have you managed to implement it ? do you mean ip rotation ? but it works for one ip for once for me |
Interesting, @Dmytro-Tihunov; I have not investigated the fix yet, but it looks like it involves some regex updates, I did not see anything about IPs being mentioned in the commits. I was able to download multiple videos with this, although there seems to be some problem with the sound. |
Ok, the problem is definitely the nTransform function: Line 57 in 9e15c73
which can be extracted with this regexp: N_TRANSFORM_REGEXP = 'function\\(\\s*(\\w+)\\s*\\)\\s*\\{' +
'var\\s*(\\w+)=(?:\\1\\.split\\(""\\)|String\\.prototype\\.split\\.call\\(\\1,""\\)),' +
'\\s*(\\w+)=(\\[.*?]);\\s*\\3\\[\\d+]' +
'(.*?try)(\\{.*?})catch\\(\\s*(\\w+)\\s*\\)\\s*\\' +
'{\\s*return"enhanced_except_([A-z0-9-]+)"\\s*\\+\\s*\\1\\s*}' +
'\\s*return\\s*(\\2\\.join\\(""\\)|Array\\.prototype\\.join\\.call\\(\\2,""\\))};'; |
I was able to get the correct sig by replacing the function const extractNCode = () => {
const N_TRANSFORM_REGEXP = 'function\\(\\s*(\\w+)\\s*\\)\\s*\\{' +
'var\\s*(\\w+)=(?:\\1\\.split\\(""\\)|String\\.prototype\\.split\\.call\\(\\1,""\\)),' +
'\\s*(\\w+)=(\\[.*?]);\\s*\\3\\[\\d+]' +
'(.*?try)(\\{.*?})catch\\(\\s*(\\w+)\\s*\\)\\s*\\' +
'{\\s*return"enhanced_except_([A-z0-9-]+)"\\s*\\+\\s*\\1\\s*}' +
'\\s*return\\s*(\\2\\.join\\(""\\)|Array\\.prototype\\.join\\.call\\(\\2,""\\))};';
let mo = body.match(new RegExp(N_TRANSFORM_REGEXP, 's'));
if (mo) {
let fnbody = mo[0];
functions.push('var nxx=' + fnbody + 'nxx(ncode);');
}
}; Although this is a crude patch and is not idiomatic to this library. Should think of something cleaner. |
Better patch (although I am not sure how robust) — replace Line 58 in 9e15c73
with let functionName = utils.between(body, 'c=a.get(b))&&(c=', '(c)'); |
Sadly the above patches seem to fix some low quality formats but not others. On an example video (v=1ec4gu5uJ6U) I was able to load the 360p mp4 and the 144p mp4, but all others returned a 403. |
This one works for me, thanks. Last time this 403 errors were thrown I switched to the distube fork of ytdl ([https://github.com/distubejs/ytdl-core]), which worked but now throws 403 errors as well. Switching back to ytdl-core with this functionName fix works. |
again not working, youtube again updated their algorithm. @corwin-of-amber |
The n code extraction is one issue. |
SO whats should we do now? is there any solution? |
There will always be a solution. The solution here will be to emulate what the YouTube site code does in the browser to fetch the streams. But that could take awhile to figure out and code. The POST requests also seem to include some encrypted payload, so a tricky exercise. |
Using @distube/ytdl-core (v 4.13.7) works for us on some devices but not all... someone suggested that google is doing some A/B testing |
Regarding the nTransform function:
Given this, I propose using a regex to capture this convention, in the hopes that it will give us some breathing space for the near future. WDYT? |
So what's the solution? @corwin-of-amber |
Currently, it looks like this: let mo = body.match(/index\.m3u8".*=(.*?)[.]set\(/);
let functionName = mo && mo[1].split('(')[0]; |
Hello can you tell me which line i need to be replaced? And also let me know the file name where i add this? Please share the full code here and also add this? @corwin-of-amber |
Same as here @hextor1 I.e. this is the line that needs to be replaced with the two lines above: Line 58 in 9e15c73
↓ let mo = body.match(/index\.m3u8".*=(.*?)[.]set\(/);
let functionName = mo && mo[1].split('(')[0]; I want to see that it keeps working at least for a few days before suggesting this is a patch. |
Hello this line i need to be add it here Will i need to be replaced 58 line? |
Here is my previous code please tell me where I do replace this code: let mo = body.match(/index.m3u8".=(.?)[.]set(/); Old code |
In #1301 I did propose the following which avoids the problem of the nCode function name being obfuscated in everchanging layers of difficulty, by identifying the nCode block directly and thus determining its function name.
To reiterate: the 403 errors have nothing to do with the n transformation. |
This one little bit better patch than previous |
Sure, it will give the right result for now, but it is still trying to find the function name from a moving target. |
You right sometime its find the function when I will refresh the page then its work. i hope in future some found better and accurate solution? @gatecrasher777 |
I agree with @gatecrasher777, my last patch is still heuristic, but I have tried it against the last 6 versions of Also, I would like to state that failing to find the n-transform function does indeed result in a 403 error; although, there may be other 403 errors that occur even with the right n-transform (esp. with high-bitrate formats). |
@corwin-of-amber
Outputs |
Where is placed? share file location with line no |
There is no file. It is just some shorthand code to test @corwin-of-amber's functionName extraction method. |
Error when I try to download video.
The text was updated successfully, but these errors were encountered: