Skip to content

Instantly share code, notes, and snippets.

@ayman
Created September 2, 2008 20:15
Show Gist options
  • Save ayman/8455 to your computer and use it in GitHub Desktop.
Save ayman/8455 to your computer and use it in GitHub Desktop.
Gets a YouTube FLV Url from the source of a page.
// Assuming 'response' is the source of a You Tube video page, this will get the flv url
var vid = id.substring(3);
var r = response;
var doc = r.substring(r.indexOf(".swf?video_id="));
var tpoint = r.indexOf("&t=");
var doc = r.substring(tpoint, r.indexOf("\"", tpoint));
var url = "http://youtube.com/get_video.php?video_id=";
url += vid + doc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment