https://github.com/manusoft/yt-dlp-wrapper
YTDLP-Wrapper is a C# wrapper around the popular yt-dlp command-line tool for downloading videos, audio, subtitles, thumbnails, and more from various video-sharing platforms. This wrapper provides a simple and easy-to-use API for interacting with yt-dlp in your C# projects.
https://github.com/manusoft/yt-dlp-wrapper
audio download fast video youtube yt-dlp yt-dlp-wrapper
Last synced: 3 months ago
JSON representation
YTDLP-Wrapper is a C# wrapper around the popular yt-dlp command-line tool for downloading videos, audio, subtitles, thumbnails, and more from various video-sharing platforms. This wrapper provides a simple and easy-to-use API for interacting with yt-dlp in your C# projects.
- Host: GitHub
- URL: https://github.com/manusoft/yt-dlp-wrapper
- Owner: manusoft
- License: mit
- Created: 2024-12-29T01:08:48.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-23T16:06:16.000Z (about 1 year ago)
- Last Synced: 2025-04-15T05:48:15.793Z (about 1 year ago)
- Topics: audio, download, fast, video, youtube, yt-dlp, yt-dlp-wrapper
- Language: C#
- Homepage: https://www.nuget.org/packages/YTDLP-Wrapper
- Size: 41.6 MB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
 
  
# YTDLP-Wrapper

[Download the latest App](https://github.com/manusoft/yt-dlp-wrapper/releases/download/v1.0.0/gui-app.zip)

`YTDLP-Wrapper` is a C# wrapper around the popular `yt-dlp` command-line tool for downloading videos, audio, subtitles, thumbnails, and more from various video-sharing platforms. This wrapper provides a simple and easy-to-use API for interacting with `yt-dlp` in your C# projects.
## Features
- **Download Videos** - Download videos in various qualities.
- **Download Audio** - Download audio from videos in high quality.
- **Download Subtitles** - Download subtitles for videos.
- **Download Thumbnails** - Download video thumbnails.
- **Download Playlists** - Download all videos from a playlist.
- **Get Video/Playlist Info** - Retrieve information about videos or playlists.
- **Get Subtitles** - Retrieve subtitles of video. (stored in App base path)
- **Get Available Formats** - Get a list of available video formats for a given video.
- **Get Thumbnail** - Retrieve thumbnail of a video. (stored in App base path)
## Installation
You can install `YTDLP-Wrapper` from NuGet:
```bash
dotnet add package YTDLP-Wrapper
```
Or use the NuGet Package Manager in Visual Studio.
## Usage
### Initialize the Engine
You can create an instance of the `YtDlpEngine` class with the path to `yt-dlp.exe` (optional, defaults to `"yt-dlp.exe"`).
```csharp
var ytDlpEngine = new YtDlpEngine();
```
### Download a Video
To download a video, specify the video URL and the output directory.
```csharp
await ytDlpEngine.DownloadVideoAsync("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "C:\\Downloads");
```
### Download a Playlist
To download all videos from a playlist:
```csharp
await ytDlpEngine.DownloadPlaylistAsync("https://www.youtube.com/playlist?list=PL4cUxeGkcC9iZ1eqI2gR8SjlzzyLw60EF", "C:\\Downloads");
```
### Download Audio
To download only the audio of a video:
```csharp
await ytDlpEngine.DownloadAudioAsync("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "C:\\Downloads");
```
### Download Subtitles
To download subtitles for a video:
```csharp
await ytDlpEngine.DownloadSubtitlesAsync("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "C:\\Downloads");
```
### Download Thumbnail
To download the thumbnail of a video:
```csharp
await ytDlpEngine.DownloadThumbnailAsync("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "C:\\Downloads");
```
### Get Video Information
To retrieve information about a video:
```csharp
var videoInfo = await ytDlpEngine.GetVideoInfoAsync("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
```
### Get Available Formats
To retrieve available formats for a video:
```csharp
var formats = await ytDlpEngine.GetAvailableFormatsAsync("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
```
### Events
The `YtDlpEngine` provides events that you can subscribe to for progress updates or error handling.
- **OnProgressDownload**: Fired when there is a download progress update.
- **OnProgressMessage**: Fired for general progress messages (e.g., logging).
- **OnErrorMessage**: Fired when an error occurs during the download.
Example:
```csharp
ytDlpEngine.OnProgressDownload += (sender, args) =>
{
Console.WriteLine($"Download progress: {args.Progress}%");
};
ytDlpEngine.OnErrorMessage += (sender, message) =>
{
Console.WriteLine($"Error: {message}");
};
```
## Enum Definitions
The following enums are available to specify download quality:
```csharp
public enum VideoQuality
{
All, // All available quality
MergeAll, // Merge all available formats
Best, // Best available quality
BestVideo, // Best video-only quality (no audio)
Worst, // Worst available quality
WorstVideo, // Worst video-only quality (no audio)
}
public enum AudioQuality
{
BestAudio, // Best audio-only quality (no video)
WorstAudio, // Worst audio-only quality (no video)
}
```
## License
This library is licensed under the MIT License. See LICENSE for more information.