Skip to content

Instantly share code, notes, and snippets.

@celmaun
Created November 25, 2011 15:03
Show Gist options
  • Save celmaun/1393721 to your computer and use it in GitHub Desktop.
Save celmaun/1393721 to your computer and use it in GitHub Desktop.
Get youtube video download URLs
preg_match("/yt\.setConfig\(\{\s+\'PLAYER_CONFIG\'\:\s(?<config>.*?)\s+\}\)/s", $page, $matches);
$config = json_decode($matches['config']);
$fmts = explode(',', $config->args->url_encoded_fmt_stream_map);
foreach( $fmts as $k => $v ) { parse_str($v, $fmts[$k]); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment