YTDLP-Wrapper
1.0.0
dotnet add package YTDLP-Wrapper --version 1.0.0
NuGet\Install-Package YTDLP-Wrapper -Version 1.0.0
<PackageReference Include="YTDLP-Wrapper" Version="1.0.0" />
paket add YTDLP-Wrapper --version 1.0.0
#r "nuget: YTDLP-Wrapper, 1.0.0"
// Install YTDLP-Wrapper as a Cake Addin #addin nuget:?package=YTDLP-Wrapper&version=1.0.0 // Install YTDLP-Wrapper as a Cake Tool #tool nuget:?package=YTDLP-Wrapper&version=1.0.0
YTDLP-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.
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:
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"
).
var ytDlpEngine = new YtDlpEngine();
Download a Video
To download a video, specify the video URL and the output directory.
await ytDlpEngine.DownloadVideoAsync("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "C:\\Downloads");
Download a Playlist
To download all videos from a playlist:
await ytDlpEngine.DownloadPlaylistAsync("https://www.youtube.com/playlist?list=PL4cUxeGkcC9iZ1eqI2gR8SjlzzyLw60EF", "C:\\Downloads");
Download Audio
To download only the audio of a video:
await ytDlpEngine.DownloadAudioAsync("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "C:\\Downloads");
Download Subtitles
To download subtitles for a video:
await ytDlpEngine.DownloadSubtitlesAsync("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "C:\\Downloads");
Download Thumbnail
To download the thumbnail of a video:
await ytDlpEngine.DownloadThumbnailAsync("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "C:\\Downloads");
Get Video Information
To retrieve information about a video:
var videoInfo = await ytDlpEngine.GetVideoInfoAsync("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
Get Available Formats
To retrieve available formats for a video:
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:
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:
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.
This README provides an overview of the functionality in your YtDlpWrapper
library and guides users on how to get started with it.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 121 | 12/29/2024 |