YouTubeStreamDownloader 1.1.9

dotnet add package YouTubeStreamDownloader --version 1.1.9                
NuGet\Install-Package YouTubeStreamDownloader -Version 1.1.9                
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="YouTubeStreamDownloader" Version="1.1.9" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YouTubeStreamDownloader --version 1.1.9                
#r "nuget: YouTubeStreamDownloader, 1.1.9"                
#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 YouTubeStreamDownloader as a Cake Addin
#addin nuget:?package=YouTubeStreamDownloader&version=1.1.9

// Install YouTubeStreamDownloader as a Cake Tool
#tool nuget:?package=YouTubeStreamDownloader&version=1.1.9                

YouTubeStreamDownloader ๐ŸŽฌ

YouTubeStreamDownloader is a .NET 8 package that allows developers to interact with YouTube.
It provides functionality to retrieve video metadata, download videos, extract audio, get subtitles, and fetch playlist & channel details using the YoutubeExplode library.

๐Ÿš€ Features

โœ… Retrieve Video Metadata (title, duration, author, etc.)
โœ… Download YouTube Videos (highest quality available)
โœ… Extract & Download Subtitles (SRT format)
โœ… Fetch Playlists & Channel Videos
โœ… Supports Dependency Injection (DI)


๐Ÿ“ฆ Installation

You can install YouTubeStreamDownloader via NuGet:

dotnet add package YouTubeStreamDownloader

OR via Package Manager:

Install-Package YouTubeStreamDownloader

๐Ÿ”ฅ Quick Start

1๏ธโƒฃ Retrieve Video Metadata

IYouTubeMetadataService downloader = new YouTubeMetadataService(new YoutubeClient());
var video = await downloader.GetVideoInfoAsync(TEST_VIDEO_URL);

Console.WriteLine($"Title: {video.Title}");
Console.WriteLine($"Duration: {video.Duration}");
Console.WriteLine($"Author: {video.Author}");

2๏ธโƒฃ Download YouTube Video

IYouTubeMetadataService downloader = new YouTubeMetadataService(new YoutubeClient());
var outputPath = "C:\\Videos";
string filePath = await downloader.DownloadVideoAsFileAsync(TEST_VIDEO_URL, outputPath);
Console.WriteLine($"Video downloaded successfully: {filePath}");

3๏ธโƒฃ Fetch All Playlists from a Channel

using Microsoft.Extensions.DependencyInjection;
using YouTubeStreamDownloader.Services;

var services = new ServiceCollection();
services.AddYouTubeMetadataService();
var provider = services.BuildServiceProvider();

var metadataService = provider.GetRequiredService<IYouTubeMetadataService>();

var playlists = await metadataService.GetAllPlaylistsAsync("https://www.youtube.com/@YourChannel");

foreach (var playlist in playlists)
{
    Console.WriteLine($"{playlist.Title}: {playlist.Url}");
}

4๏ธโƒฃ Fetch All Videos from a Playlist

using Microsoft.Extensions.DependencyInjection;
using YouTubeStreamDownloader.Services;

var provider = new ServiceCollection()
    .AddYouTubeMetadataService()
    .BuildServiceProvider();

var metadataService = provider.GetRequiredService<IYouTubeMetadataService>();

var videos = await metadataService.GetAllVideosFromPlaylistAsync("https://www.youtube.com/playlist?list=YOUR_PLAYLIST_ID");

foreach (var video in videos)
{
    Console.WriteLine($"{video.Title}: {video.Url}");
}

๐Ÿ— Dependency Injection (DI)

To use YouTubeStreamDownloader in an ASP.NET Core or Console Application, register it in Program.cs:

using Microsoft.Extensions.DependencyInjection;
using YouTubeStreamDownloader.Services;

var builder = WebApplication.CreateBuilder(args);

// Register the service
builder.Services.AddYouTubeMetadataService();

var app = builder.Build();

For Singleton DI:

builder.Services.AddYouTubeMetadataSingletonService();

๐Ÿงช Unit Testing

Unit tests use NSubstitute for mocking and FluentAssertions for validation.

Run all tests:

dotnet test

๐Ÿ’ก Roadmap

  • Audio-only downloads
  • Download progress tracking
  • Convert video format (MP4, MP3)
  • Multi-threaded downloads
  • User authentication for private videos
  • YouTube Live Stream support

๐Ÿค Contributing

Want to contribute?

Follow these steps:

  1. Fork the repository.
  2. Clone your fork:
    git clone https://github.com/your-username/YouTubeStreamDownloader.git
    
  3. Create a new branch:
    git checkout -b feature/your-feature-name
    
  4. Make changes and commit:
    git commit -m "Added new feature"
    
  5. Push to your fork:
    git push origin feature/your-feature-name
    
  6. Create a Pull Request (PR).

๐Ÿ“ License

YouTubeStreamDownloader is licensed under the MIT License.


๐Ÿ“Œ Contact

๐Ÿ‘ค Author: Shady Nagy
๐Ÿ“ง Email: info@ShadyNagy.com
๐Ÿ“Œ GitHub: ShadyNagy
๐ŸŒ Website: https://shadynagy.com

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
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

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.9 31 2/19/2025
1.1.8 32 2/19/2025
1.1.7 31 2/19/2025
1.1.6 57 2/17/2025
1.1.5 59 2/17/2025
1.1.4 61 2/17/2025
1.1.3 59 2/17/2025
1.1.2 67 2/14/2025
1.1.1 74 2/14/2025
1.1.0 63 2/13/2025
1.0.8 66 2/13/2025
1.0.7 64 2/13/2025
1.0.6 62 2/13/2025
1.0.5 69 2/13/2025
1.0.4 71 2/12/2025
1.0.3 63 2/12/2025
1.0.2 65 2/12/2025
1.0.1 63 2/12/2025
1.0.0 75 2/12/2025

Initial release of YouTubeStreamDownloader.