Skip to content

Minimal .NET STANDART wrapper for the Youtube Data API v3 (Playlist, Trending)

License

Notifications You must be signed in to change notification settings

omansak/YoutubeSharpApi

Repository files navigation

Youtube Sharp Api

NuGet NuGet license Join the chat at https://discord.gg/SERVhPp

A minimal .NET STANDART wrapper for the Youtube Data API v3. Designed to let devs easily fetch public data (Playlists info,Trending) from Youtube. The reason of returning the decoded JSON response directly is that you only need to read the Google API doc to use this library.

Supported Platforms

  • NET ve .NET Core | 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0
  • .NET Framework | 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
  • Mono | 5.4, 6.4
  • Xamarin.iOS | 10.14, 12.16
  • Xamarin.Mac | 3.8, 5.16
  • Xamarin.Android | 8.0, 10.0
  • Universal Windows Platform | 10.0.16299, TBD
  • Unity | 2018,

Features

  • Get Playlist Info All or Pagination
  • Get Trending Info All or Pagination
  • 90 Regions / 31 Youtube Category

Requirements

  • Newtonsoft Json Library

Usage

          var youtubeClient = new YoutubeClient("-- your api key --");

          var response = await youtubeClient.GetPlayListAsync(
                                              new PlaylistInput{
                                              PlaylistId = "-- playlist url --"}, CancellationToken.None));
          var response = await youtubeClient.GetTrendingAsync(
                                              new TrendingInput{
                                              Category = TrendingEnums.Categories.Music,
                                              Region = TrendingEnums.Regions.Turkey}), CancellationToken.None);

With Paging

        var youtubeClient = new YoutubeClient("-- your api key --");

        var trendingInput = new TrendingInput()
        {
        MaxResultPerPage = 20,
        Category = TrendingEnums.Categories.Music,
        Region = TrendingEnums.Regions.Turkey
        };

        var response = await youtubeClient.GetTrendingWithPagingAsync(trendingInput, token: new CancellationToken());
        playlistInput.PageToken = responsePlaylistPaging.NextPage; // important to next page

Output

        public string Kind { get; set; }
        public string NextPage { get; set; }
        public int TotalResults { get; set; }
        public List<Videos> VideosData { get; set; }
        public class Videos
        {
            public string Title { get; set; }
            public string VideoId { get; set; }
            public int Position { get; set; }
            public string Description { get; set; }
            public DateTime PublishedAt { get; set; }
            public string ChannelId { get; set; }
            public string ChannelTitle { get; set; }
            public string Kind { get; set; }
            public List<Thumbnails> ThumbnailsData { get; set; }
        }

        public PlaylistOutput()
        {
            this.VideosData = new List<Videos>();
        }

Youtube Data API v3

Contact

For bugs, complain and suggestions please file an Issue here

About

Minimal .NET STANDART wrapper for the Youtube Data API v3 (Playlist, Trending)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages