Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/madeyoga/youtubesearchapi.net
A library for searching for youtube videos or youtube music
https://github.com/madeyoga/youtubesearchapi.net
asynchronous csharp dotnet youtube youtube-music youtube-music-search youtube-search
Last synced: about 1 month ago
JSON representation
A library for searching for youtube videos or youtube music
- Host: GitHub
- URL: https://github.com/madeyoga/youtubesearchapi.net
- Owner: madeyoga
- License: mit
- Created: 2020-09-20T08:43:36.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-08T10:02:35.000Z (over 1 year ago)
- Last Synced: 2024-10-11T20:02:32.137Z (about 1 month ago)
- Topics: asynchronous, csharp, dotnet, youtube, youtube-music, youtube-music-search, youtube-search
- Language: C#
- Homepage:
- Size: 90.8 KB
- Stars: 17
- Watchers: 2
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YoutubeSearchApi.Net
![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/madeyoga/YoutubeSearchApi.Net?style=for-the-badge)
[![Nuget](https://img.shields.io/nuget/dt/YoutubeSearchApi.Net?color=GREEN&style=for-the-badge)](https://www.nuget.org/packages/YoutubeSearchApi.Net/)
[![contributionswelcome](https://img.shields.io/badge/contributions-welcome-brightgreen/?style=for-the-badge)](https://github.com/madeyoga/YoutubeSearchApi.Net/issues)
[![discord_invite](https://img.shields.io/discord/458296099049046018?style=for-the-badge)](https://discord.gg/Y8sB4ay)A lightweight & simple .NET library to extract data from Youtube.
The purpose of this project is to make it easier for developers to extract data from YouTube or any sources.## Supported Sites
- Youtube
- Youtube Music## Installation
### NuGet
- [YoutubeSearchApi.Net](https://www.nuget.org/packages/YoutubeSearchApi.Net/)## Quick Start
**Youtube Search**
```C#
using YoutubeSearchApi.Net.Models.Youtube;
using YoutubeSearchApi.Net.Services;public static async Task AsyncMain()
{
using (var httpClient = new HttpClient())
{
YoutubeSearchClient client = new YoutubeSearchClient(httpClient);var responseObject = await client.SearchAsync("black suit");
foreach (YoutubeVideo video in responseObject.Results)
{
Console.WriteLine(video.ToString());
Console.WriteLine("");
}
}
}public static void Main(string[] args)
{
AsyncMain().GetAwaiter().GetResult();
}
```**Youtube Music Search**
```C#
using YoutubeSearchApi.Net.Models.Youtube;
using YoutubeSearchApi.Net.Services;public static async Task AsyncMain()
{
using (var httpClient = new HttpClient())
{
YoutubeMusicSearchClient client = new YoutubeMusicSearchClient(httpClient);var responseObject = await client.SearchAsync("simple ringtone");
foreach (YoutubeVideo video in responseObject.Results)
{
Console.WriteLine(video.ToString());
Console.WriteLine("");
}
}
}public static void Main(string[] args)
{
AsyncMain().GetAwaiter().GetResult();
}
```[Full examples at Demo project](https://github.com/madeyoga/YoutubeSearchApi.Net/tree/master/YoutubeSearchApi.Net.Demo)
## Using Service Collection
```cs
services.AddHttpClient();
services.AddHttpClient();// MyController.cs
private readonly YoutubeSearchClient ytClient;
private readonly YoutubeMusicSearchClient ytmClient;public MyController(YoutubeSearchClient ytClient, YoutubeMusicSearchClient ytmClient)
{
this.ytClient = ytClient;
this.ytmClient = ytmClient;
}
```## Contributing
Issues and Pull requests are very welcome. Feel free to open issues and pull requests.