YouTubeMusicAPI 1.0.1

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

// Install YouTubeMusicAPI as a Cake Tool
#tool nuget:?package=YouTubeMusicAPI&version=1.0.1

YouTubeMusicAPI

YouTubeMusicAPI is a simple and efficient wrapper for the internal YouTube Music Web API for dotnet & C# developers. This library allows you to easily search for songs, videos, albums, community playlists, artists, podcasts, podcast episodes & profiles on YouTube Music.


Installation

To install YouTubeMusicAPI, add the following package to your project:

dotnet add package YouTubeMusicAPI

Usage

// Search for items directly
YouTubeMusicClient client = new();

IEnumerable<IShelfItem> searchResults = await client.SearchAsync<IShelfItem>(query);
foreach (IShelfItem item in searchResults)
  Console.WriteLine($"{item.Kind}: {item.Name} - {item.Id}");
// Search for shelves
YouTubeMusicClient client = new();

IEnumerable<Shelf> shelves = await client.SearchAsync(query, null);
foreach (Shelf shelf in shelves)
{
  Console.WriteLine($"{shelf.Kind} - Query: {shelf.Query}, Params: {shelf.Params}");

  foreach (IShelfItem item in shelf.Items)
    Console.WriteLine($"{item.Kind}: {item.Name} - {item.Id}");
}

Search for specific item only (songs, videos, albums, community playlists, artists, podcasts, podcast episodes profiles)
// Search for songs directly
YouTubeMusicClient client = new();

IEnumerable<Song> searchResults = await client.SearchAsync<Song>(query);
foreach (Song song in searchResults)
  Console.WriteLine($"{song.Name}, {string.Join(", ", song.Artists.Select(artist => artist.Name))} - {song.Album}");
// Search for the songs shelves
YouTubeMusicClient client = new();

IEnumerable<Shelf> shelves = await client.SearchAsync(query, ShelfKind.Songs);
foreach (Shelf shelf in shelves)
{
  Console.WriteLine($"{shelf.Kind}: Query-{shelf.Query}, Params-{shelf.Params}");

  foreach (IShelfItem item in shelf.Items)
  {
    Song song = (Song)item;
    Console.WriteLine($"{song.Name}, {string.Join(", ", song.Artists.Select(artist => artist.Name))} - {song.Album}");
  }
}

Shelves

In the usage samples you may have noticed there are two ways to search for something via this Wrapper - directly for the items or the "shelf".
But what is a shelf? The internal YouTube Music API returns so called "shelves" when searching. A shelf is like a container for search results like songs, videos etc.
Each shelf has a kind which says what items it contains for example "Songs". A Shelf is also connected to the sent request so it contains properties like "Query" or "Params" which help identify the initial request used for the search.

If all of this sounds kind of useless to you, dont worry! You can just use the search method with a generic type SearchAsync<IShelfItem>() instead.
This handles all the shelf stuff in the background and returns a list of all your search results.


License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

Contact

For questions, suggestions or problems, please open an issue with a detailed description.

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

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 83 6/5/2024
1.0.0 69 6/5/2024

- Added documentation