How do I make a YouTube to MP3/MP4 Converter in C#?

  • 263 Views
  • Last Post 13 February 2019
Lucas Gibson posted this 11 February 2019

I need help using libvideo to make a simple Youtube video downloader. I just need to know the basics and then i can probably figure out the rest.

java2s posted this 13 February 2019

You can use YoutubeExtrator to download a youtube video

Open your Mange Nuget Packages, then install YoutubeExtrator

Add code to handle download the youtube video as the following c# code

//Get your url video
IEnumerable<VideoInfo> url = DownloadUrlResolver.GetDownloadUrls(txtUrl.Text);
VideoInfo video = url.First(p => p.VideoType == VideoType.Mp4 && p.Resolution == 720);
if (url.RequiresDecryption)
    DownloadUrlResolver.DecryptDownloadUrl(url);
//Download video
VideoDownloader downloader = new VideoDownloader(url, Path.Combine(Application.StartupPath + "\\", url.Title + url.VideoExtension));
//Create a new thread to process download youtube file
Thread t = new Thread(() => { downloader.Execute(); }) { IsBackground = true };
t.Start();

I hope you can solve the problem

Close