0

I am building a program(in C#) and I need to download the audio from a youtube video(using the URL). I found two libraries which allow me to do it: YotubeExtractor and libvideo(Also known as VideoLibrary), but I don't know how to use them, I mean I tried using their documentation but non of them worked. Do you know another way which I can download or maybe explain me how to do this? Thank you and have a nice day!

fmmw774
  • 11
  • 1
  • 3

1 Answers1

0

Don't use other people's code unless it's large and popular or your only option, I recommend, so that you both learn more and know how it works, as well as know how to maintain it if it breaks.

Retrieve the page using standard .NET functionality, parse out the HTML to find the video URL, download it using the same standard functionality, and then convert it to MP3 as a separate logical unit of your software.

For converting to MP3 you may well want to use someone else's library or call an external program like FFMPEG since that's not as trivial as parsing a webpage.

Yushatak
  • 741
  • 1
  • 5
  • 15
  • Thanks but I really don't know how to do it and it's a complicated idea. I am going to try this but I still looking for answers. Thanks anyway! – fmmw774 Jul 29 '16 at 14:55
  • Check this out for how to download files: http://stackoverflow.com/questions/307688/how-to-download-a-file-from-a-url-in-c But yeah, the parsing is more complex than you may want to be doing, in which case I have to ask why are you coding this yourself when there are tons of tools out there that do this already? – Yushatak Jul 29 '16 at 14:58
  • I don't want to code this but myself, All I need is to download audio from a youtube video and I asked how do I use YotubeExtractor and libvideo – fmmw774 Jul 29 '16 at 15:04
  • If you only need to do it the once and not have it be part of your application, then just use a web service like KeepVid or similar - otherwise, you'll probably have trouble getting help with specific small-name libraries in a place like this. – Yushatak Jul 29 '16 at 15:07
  • But how do I put the URL of the youtube video in there and Download it to a folder for example Desktop? – fmmw774 Jul 29 '16 at 15:21
  • For KeepVid you put the Youtube video's page URL into it and then hit the button, then click one of the download links.. – Yushatak Jul 29 '16 at 15:23
  • using (var client = new WebClient()) { client.DownloadFile("http://www.youtube.com/v?=whatever", "videoPage.html"); } (or you could save it to a memory stream or something) then you'd want to check for the video file in the code of that page, and run DownloadFile on that. – Yushatak Jul 29 '16 at 15:39