YoutubeDLSharp

v1.2.0·Updated 2026-08-28

A simple.NET wrapper library for youtube-dl and yt-dlp

About this mod Author’s original text

YoutubeDLSharp

A simple.NET wrapper library for youtube-dl and yt-dlp.

| For yt-dlp | For youtube-dl |

| --- | --- |

| Versions >= v.1.0 | Versions v.0.x

| |

What is it?

YoutubeDLSharp is a wrapper for the popular command-line video downloaders youtube-dl and yt-dlp.

It allows you to use the extensive features of youtube-dl/ yt-dlp in a.NET project.

For more about the features of youtube-dl/ yt-dlp, supported websites and anything else, visit their project pages at and

How do I install it?

First, add the package from NuGet:

PM> Install-Package YoutubeDLSharp

Next, you would want to have the binaries for yt-dlp and FFmpeg available.

If you don't have them set up already, you can either...

-...download them from their respective download pages manually: [[yt-dlp Download]]( [[FFmpeg Download]](

-...use the built-in download methods:

await YoutubeDLSharp.Utils.DownloadYtDlp();

await YoutubeDLSharp.Utils.DownloadFFmpeg();

await YoutubeDLSharp.Utils.DownloadDeno(); // optional, for YouTube downloads

How do I use it?

There are two ways to use YoutubeDLSharp: the class YoutubeDL provides high level methods for downloading and converting videos

while the class YoutubeDLProcess allows directer and flexibler access to the youtube-dl process.

Using the YoutubeDL class

In the simplest case, initializing the downloader and downloading a video can be achieved like this:

var ytdl = new YoutubeDL();

// set the path of yt-dlp and FFmpeg if they're not in PATH or current directory

ytdl.YoutubeDLPath = "path\\to\\yt-dlp.exe";

ytdl.FFmpegPath = "path\\to\\ffmpeg.exe";

// optional: set a different download folder

ytdl.OutputFolder = "some\\directory\\for\\video\\downloads";

// download a video

var res = await ytdl.RunVideoDownload("

// the path of the downloaded file

string path = res.Data;

Instead of only downloading a video, you can also directly extract the audio track...

var res = await ytdl.RunAudioDownload(

"

AudioConversionFormat.Mp3

);... or selectively download videos from a playlist:

var res = await ytdl.RunVideoPlaylistDownload(

"

start: 52, end: 76

);

All of the above methods also allow you to track the download progress or cancel an ongoing download:

// a progress handler with a callback that updates a progress bar

var progress = new Progress(p => progressBar.Value = p.Progress);

// a cancellation token source used for cancelling the download

// use cts.Cancel(); to perform cancellation

var cts = new CancellationTokenSource();

//...

await ytdl.RunVideoDownload("

progress: progress, ct: cts.Token);

As youtube-dl also allows you to extract extensive metadata for videos, you can also fetch these (without downloading the video):

var res = await ytdl.RunVideoDataFetch("

// get some video information

VideoData video = res.Data;

string title = video.Title;

string uploader = video.Uploader;

long? views = video.ViewCount;

// all available download formats

FormatData formats = video.Formats;

//...

This intro does not show all available options. Refer to the method documentations for more.

The project includes a demo WPF desktop app under WpfDemoApp that uses the YoutubeDL class.

Working with options

YoutubeDLSharp uses the OptionSet class to model youtube-dl/ yt-dlp options.

The names of the option properties correspond to the names of youtube-dl, so defining a set of options can look like this:

var options = new OptionSet()

{

NoContinue = true,

RestrictFilenames = true,

Format = "best",

RecodeVideo = VideoRecodeFormat.Mp4,

Exec = "echo {}"

}

Some options of yt-dlp can be set multiple times.

Th

Install & use Install: BepInEx plugin

  1. The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
  2. Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
  3. Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
  4. Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.

Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.

File & checksum

Filename
YoutubeDLSharp-1.2.0.zip
File size
72.3 KiB