Downloading video from YouTube

I wish to download a video from YouTube and then extract its audio.

Can anyone point me to some C# code to download a video?

For clarification purposes, I already know how to extract audio from a .FLV file like these.


I've written a library that is up-to-date, since all the other answers are outdated:

https://github.com/flagbug/YoutubeExtractor


You can check out libvideo. It's much more up-to-date than YoutubeExtractor, and is fast and clean to use.


Gonna give another answer, since the libraries mentioned haven't been actively developed anymore.

Consider using YoutubeExplode. It has a very rich and consistent API and allows you to do a lot of other things with youtube videos beside downloading them.