There are two values associated with a YouTube video: an ID and a signature. The ID is simple to get, as it's in the URI itself. The signature is a bit trickier to get. It's embedded in a Javascript statement in the source code of each video page.
For example, let's take the Numa Numa video.
It has an ID of KmtzQCSh6xk
, as can be seen from the URI.
To get the signature, we have to dig into the source code of the HTML. To easily do this in Firefox, load the source of the page by right clicking anywhere on the page and click "View Page Source." After that, press Ctrl+F, and type in "t":
. It will take you to the signature of the page: the value directly after that in quotes is the signature.
In the case of the Numa Numa Dance, it's signature is vjVQa1PpcFOSvCcjdAYSc3ZQgK-6EG9yQM7RLSYqJk4%3D
To get the actual FLV, you enter this URI:
http://www.youtube.com/get_video?fmt=5&video_id={ID}&t={SIGNATURE}
The complete URI to get the FLV video is:
http://www.youtube.com/get_video?fmt=5&video_id=KmtzQCSh6xk&t=vjVQa1PpcFOSvCcjdAYSc3ZQgK-6EG9yQM7RLSYqJk4%3D
You can use this information to help you get the signature and ID you need to download the FLV programatically. Whether it's doing a simple String.Find
for the value "t":
or using RegEx, it should be simple to find until they change it.