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 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.
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.
To all interested:
The "Coding for fun" book's chapter 4 "InnerTube: Download, Convert, and Sync YouTube Videos" deals with the topic. The code and discussion are at http://www.c4fbook.com/InnerTube.
[PLEASE BEWARE] While the overall concepts are valid some years after the publication, non-documented details of the youtube internals the project relies on can have changed (see the comment at the bottom of the page behind the second link).
You can check out libvideo. It's much more up-to-date than YoutubeExtractor, and is fast and clean to use.
Since all the other answers are outdated, I've written a library that is up-to-date:
http://github.com/flagbug/YoutubeExtractor