NYoutubeDLP 0.12.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NYoutubeDLP --version 0.12.0                
NuGet\Install-Package NYoutubeDLP -Version 0.12.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NYoutubeDLP" Version="0.12.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NYoutubeDLP --version 0.12.0                
#r "nuget: NYoutubeDLP, 0.12.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NYoutubeDLP as a Cake Addin
#addin nuget:?package=NYoutubeDLP&version=0.12.0

// Install NYoutubeDLP as a Cake Tool
#tool nuget:?package=NYoutubeDLP&version=0.12.0                

Works with youtube-dlp now after changing 2 lines. Current version has all the new options included as of the 2022.03.05 version of youtube-dlp, I intend to maintain the options with updates/fixes.

Youtube-dlp can be found here: https://github.com/yt-dlp/yt-dlp

Github repo here: https://github.com/Antfere/NYoutubeDLP

All credit goes to the original Nyoutube-dl wrapper by Brian Allred which can be found on Gitlab here: https://gitlab.com/BrianAllred/NYoutubeDL

Usage is the exact same except you instantiate the class with "NyoutubeDLP();" like so:

    // Old way
    var youtubeDl = new YoutubeDL();
    
    // New way
    var youtubeDl = new YoutubeDLP();

Everything else including the "using NYoutubeDL;" statement are the same, you will just be using yt-dlp instead provided it is installed in your path or you point to it in your program directly.

If you need an option added, or need help with some functionality, please create an issue thread or pull request on github or contact me.

Every thing below this is the original readme from Nyoutube-dl which is probably still applicable for 99% of uses:

NYoutubeDL

pipeline status

A simple youtube-dl library for C#.

See the main page for youtube-dl for more information.

Usage

Getting the package

Visual Studio
  • Search for NYoutubeDL in your project's NuGet Manager and click install.

Or

  • In the NuGet package manager console, run

      PM> Install-Package NYoutubeDL
    
DotNet Core
  • In a terminal in your project's folder, run

      dotnet add package NYoutubeDL
    
Alternatively
  • Manually download nupkg from NuGet Gallery.

Using the code

See the documentation for youtube-dl first to understand what it does and how it does it.

  1. Create a new YoutubeDL client:

     var youtubeDl = new YoutubeDL();
    
  2. Options are grouped according to the youtube-dl documentation:

     youtubeDl.Options.FilesystemOptions.Output = "/path/to/downloads/video.mp4";
     youtubeDl.Options.PostProcessingOptions.ExtractAudio = true;
     youtubeDl.VideoUrl = "http://www.somevideosite.com/videoUrl";
    
     // Or update the binary
     youtubeDl.Options.GeneralOptions.Update = true;
    
     // Optional, required if binary is not in $PATH
     youtubeDl.YoutubeDlPath = "/path/to/youtube-dl";
    
  3. Options can also be saved and loaded. Only changed options will be saved.

     File.WriteAllText("options.config", youtubeDl.Options.Serialize());
     youtubeDl.Options = Options.Deserialize(File.ReadAllText("options.config"));
    
  4. Subscribe to the console output (optional, but recommended):

     youtubeDl.StandardOutputEvent += (sender, output) => Console.WriteLine(output);
     youtubeDl.StandardErrorEvent += (sender, errorOutput) => Console.WriteLine(errorOutput);
    
  5. Subscribe to download information updates. Hard subscription is optional, the DownloadInfo class implements INotifyPropertyChanged.

     youtubeDl.Info.PropertyChanged += delegate { <your code here> };
    
  6. Start the download:

     // Prepare the download (in case you need to validate the command before starting the download)
     string commandToRun = await youtubeDl.PrepareDownloadAsync();
     // Alternatively
     string commandToRun = youtubeDl.PrepareDownload();
    
      // Just let it run
     youtubeDl.DownloadAsync();
    
     // Wait for it
     youtubeDl.Download();
    
     // Or provide video url
     youtubeDl.Download("http://videosite.com/videoUrl");
    

Workaround for IIS

There is a weird permissions issue that ocurrs when invoking youtube-dl from an ASP.NET/IIS process. In this case, perform the following steps

  1. Install Python on the server.

  2. Download and place the Python version of youtube-dl (not the executable binary) somewhere on the server. This can be found here.

  3. When creating the YoutubeDL client object, set the PythonPath property to the path of the Python executable binary and the YoutubeDlPath to the path of the python version of youtube-dl.

Reporting issues

While both youtube-dl itself and this library support many different services, my personal use centers around Youtube. If you find any bugs using this library with other services, feel free to raise an issue. Please provide a specific link/URL, if possible.

Contributing

Pull requests for bug fixes are more than welcome! If you find and fix an issue, make a pull request with the bug and fix clearly described.

Pull requests for features will be considered, although I'm not sure what else this library needs to do. If you have an idea for a new feature, please raise an issue first in order to start a discussion. This saves both you and me time. I don't want anyone to code an elaborate feature and write up an immaculate pull request if it doesn't belong in this library.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on NYoutubeDLP:

Repository Stars
ankenyr/jellyfin-youtube-metadata-plugin
Youtube Metadata Plugin for Jellyfin
Version Downloads Last updated
0.13.2 322 12/17/2023
0.13.1 123 12/17/2023
0.13.0 677 8/30/2022
0.12.2 403 8/27/2022
0.12.1 1,255 4/10/2022
0.12.0 410 3/5/2022
0.11.4 434 1/31/2022
0.11.3 431 1/24/2022
0.11.2 244 1/16/2022