How to download videos from YouTube (C#)


Earlier I have written a post on how to download YouTube videos as a FLV file to your computer. YouTube used to change the way the code comes, so once again the logic changed a bit (am not sure it will work for all YouTube videos but it certainly work for nearly 10 I have tested. (I have not tested HD).

Manually you can get it like this (Not a simple way, but to know the logic)

1. Open the source code (HTML) of the YouTube Video

2. Find the first occurrence of “&fmt_url_map=” (With out quotes)

3. Copy after = to the first occurrence of “&” (with out quotes) after the “&fmt_url_map=”

4. On the result string find the last occurrence of “http” (with out quotes)

5. get the values from http (including http) till end

6. URL decode the string.

Use this string on browser to get the FLV.

You can see a demo here

Download the source code for downloading YouTube Videos as FLV files written in C# . (2.33 kb)