Last active
October 28, 2017 21:35
-
-
Save x35a/ab9adabbf238ff33034bc5463d534f90 to your computer and use it in GitHub Desktop.
Get Youtube Audio Links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
formats_str = ytplayer.config.args.adaptive_fmts || console.warn('No formats string'); | |
links_arr = formats_str.match(/http?s[^&|,]+/g); | |
links_arr.forEach(function(item, i, arr) { | |
item = decodeURIComponent(item); | |
// extract webm | |
if (/audio.+webm/.test(item) && /signature/.test(item)) console.info('webm', item); | |
// extract mp4 | |
if (/audio.+mp4/.test(item) && /signature/.test(item)) console.info('mp4', item); | |
if (/audio.+mp4/.test(item) && /signature/.test(item) && /ratebypass=yes/.test(item)) console.info('mp4', 'ratebypass=yes', item); | |
else if (/audio.+mp4/.test(item) && /signature/.test(item)) { | |
item = item + '&ratebypass=yes'; // добавить параметр ускоряющий загрузку | |
console.info('mp4', 'with ratebypass=yes', item);} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment