Hello everyone.
i wanted to make a Youtube mp3 downloader. Got a code that i found from stackoverflow. I will add the other feetures anyway. but, i couldn't get it running. i want it to be console application btw.
i wanted to make a Youtube mp3 downloader. Got a code that i found from stackoverflow. I will add the other feetures anyway. but, i couldn't get it running. i want it to be console application btw.
Youtube to mp3:
using VideoLibrary;
using MediaToolkit;
private void SaveMP3(string SaveToFolder, string VideoURL, string MP3Name)
{
string source = @"C:\";
var youtube = YouTube.Default;
var vid = youtube.GetVideo(https://www.youtube.com/watch?v=bjiSnexdZ88);
string videopath = Path.Combine(source, vid.FullName);
File.WriteAllBytes(videopath, vid.GetBytes());
var inputFile = new MediaFile { Filename = Path.Combine(source, vid.FullName) };
var outputFile = new MediaFile { Filename = Path.Combine(source, $"{MP3Name}.mp3") };
using (var engine = new Engine())
{
engine.GetMetadata(inputFile);
engine.Convert(inputFile, outputFile);
}
File.Delete(Path.Combine(source, vid.FullName));
}