Skip to content

KafkaWannaFly/WibuTube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WibuTube Package

This library:

  • Downloads video from YouTube
  • Converts it to mp3
  • Adds some other information to the mp3 file

Examples

Download YouTube video

WibuTubeConverter wibuTubeConverter = new();

// Most Heartfelt Music: "Dream Dancer" by Ben Crosland
string url = "https://www.youtube.com/watch?v=_z411ShLWHI&list=PLFJRIUbt-ELjQZqVbzvCGerxXgjGp_Ww5&index=12";

// Video is saved into "tmp/" folder in working directory by default
var mp4 = await wibuTubeConverter.DownloadVideoAsync(url);

// You can specify your prefered location
var mp4 = await wibuTubeConverter.DownloadVideoAsync(url, "TheGloryHole/");

Convert mp4 to mp3

var songPath = Path.GetFileNameWithoutExtension(mp4.FullName);
songPath = $"tmp/{songName}.mp3";

var mp3 = await wibuTubeConverter.ConvertVideoToMp3Async(videoPath, songPath);

// You can also choose to convert a part of video
int start = 0;
int duration = 60; // Seconds
var mp3 = await wibuTubeConverter.ConvertVideoToMp3Async(videoPath, songPath, start, duration);

Get thumbnail from video

int atSecond = 25;
string imgPath = "tmp/my-song-cover.jpg";
var imgFileInfo = await wibuTubeConverter.GetVideoSnapshotAsync(atSecond, mp4.FullName, imgPath);

Set thumbnail image for mp3

var mp3 = await wibuTubeConverter.SetMp3Thumbnail(songPath, imgPath);

Set a few more details for mp3

var mp3Info = wibuTubeConverter.SetMp3DetailInfo(songPath, new Song
            {
                Tittle = "Dream Dancer",
                Album = "HDSoundi",
                Performers = new[] { "Ben Crosland" }
            });

About

Library download music from YouTube

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages