Coder Social home page Coder Social logo

madeyoga / youtubesearchapi.net Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 3.0 93 KB

A library for searching for youtube videos or youtube music

License: MIT License

C# 100.00%
youtube youtube-search asynchronous csharp dotnet youtube-music youtube-music-search

youtubesearchapi.net's Introduction

YoutubeSearchApi.Net

CodeFactor Grade Nuget contributionswelcome discord_invite

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

Quick Start

Youtube Search

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

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

Using Service Collection

services.AddHttpClient<YoutubeSearchClient>();
services.AddHttpClient<YoutubeMusicSearchClient>();


// 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.

youtubesearchapi.net's People

Contributors

madeyoga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.