-
Notifications
You must be signed in to change notification settings - Fork 794
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
Direct cipher signature & n-transform functions to circumvent throttling. #1022
Conversation
get up to date
Bedtime. Will add tests to improve code coverage tomorrow. |
This pull request fixes 7 alerts when merging e0e90c8 into 40d0c54 - view on LGTM.com fixed alerts:
|
This pull request fixes 7 alerts when merging 36750c1 into 40d0c54 - view on LGTM.com fixed alerts:
|
I've tried it, works but doesn't really fix with throttling. The downloads are still slowly, or have i missed a thing? |
Thanks for feedback. Will do some additional testing. |
With the fix: C:\Dev\node-ytdl-core>node dl MZb2uCFNjwQ C:\Dev\node-ytdl-core>node dl DXdz-Zl1cdk C:\Dev\node-ytdl-core>node dl ipS2Mas3OJw C:\Dev\node-ytdl-core>node dl W2Xb2GFK2yc C:\Dev\node-ytdl-core>node dl 6nC0f1185WI C:\Dev\node-ytdl-core>node dl z3cjksFFKAQ C:\Dev\node-ytdl-core>node dl 0WGVgfjnLqc C:\Dev\node-ytdl-core>node dl zmbmrw07qBc C:\Dev\node-ytdl-core>node dl dJv0OvFnVXU C:\Dev\node-ytdl-core>node dl 24kpAClYmmQ C:\Dev\node-ytdl-core>node dl Zt5qJC1xQ8A Now, without the fix: C:\Dev\nyc>node dl MZb2uCFNjwQ Here is my dl.js code: const fs = require('fs');
const ytdl = require ('./lib/index.js');
let id = process.argv[2];
let start;
let end;
let dl = ytdl(id,{quality: 'highestvideo'});
dl.on(
'progress',
(a,b,c) => {
if (!start) {
start = Date.now();
}
process.stdout.write( `${Math.floor(100*b/c)}% \r`);
if (b == c) {
end = Date.now();
console.log(`\n complete at ${c*1000/(end-start)/1024/1024} mB/s`);
}
}
);
dl.pipe(fs.createWriteStream('test.mp4')); |
2 more finished. C:\Dev\nyc>node dl DXdz-Zl1cdk The 4th file is throttled too, and taking a long time to finish. |
🤔 bold claim - in the end we execute code straight from the internet and hope google is playing nice |
Using vm module instead. No access to node.js environment. Better? |
Any progress on this? If it helps, I have developed a script that parses the JavaScript code and emulates the necessary transformations on the n token— it was not based on VLC's approach but I'm constantly debugging it. So far I have tested it with 20+ different players and only ran into minor parsing problems on one of them, however they were easily fixed. I guess one could port it to ytdl-core if executing the n transform function directly is a problem. |
Works for me but didn't test thoroughly |
👍 |
Tested by 3 people, not only it improves performance of getting url by a lot, it fixed throttling completely, this patch is amazing can we merge it asap? |
Working for me so far. Going to get tested more thoroughly tonight. |
how can i do that |
thanks again for the pr - should be released on npm in a second |
Change sig.js to run base.js code directly for signature decipher and n-parameter transform. Less code too. :)
Since Google's base.js is browser code it should not pose a security risk.
sig-test.js also changed - some of the tests were no longer useful with this methodology.
Fixes #964
Many projects are struggling with this throttling issue.