Skip to content

Instantly share code, notes, and snippets.

@x35a
Last active October 28, 2017 21:35
Show Gist options
  • Save x35a/ab9adabbf238ff33034bc5463d534f90 to your computer and use it in GitHub Desktop.
Save x35a/ab9adabbf238ff33034bc5463d534f90 to your computer and use it in GitHub Desktop.
Get Youtube Audio Links
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