Skip to content

Instantly share code, notes, and snippets.

@m1el
Last active December 14, 2015 13:08
Show Gist options
  • Save m1el/5091478 to your computer and use it in GitHub Desktop.
Save m1el/5091478 to your computer and use it in GitHub Desktop.
youtube dl links
fmt_map = ytplayer.config.args.url_encoded_fmt_stream_map.split(',').map (e) ->
e.split('&').reduce (p, c) ->
c = c.split('=')
p[c[0]] = unescape(c[1])
p
, {}
dl_map = fmt_map.reduce (p, c) ->
p["#{c.quality}/#{c.type}"] = "#{c.url}&signature=#{c.sig}"
p
, {}
// get download links for youtube
var fmt_map = ytplayer.config.args.url_encoded_fmt_stream_map.split(',').map(function(e) {
return e.split('&').reduce(function(p, c) {
c = c.split(/[=]/);
p[c[0]] = unescape(c[1]);
return p;
}, {});
}),
dl_map = fmt_map.reduce(function(p, c) {
p[c.quality + '/' + c.type] = c.url + '&signature=' + c.sig;
return p;
}, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment