Skip to content

dtuit/YouTubeDataApiWrapper

Repository files navigation

YouTube Data API Wrapper

A small C# libary that wraps the Google.Apis.YouTube .NET client.

Purpose
  • Allow for paginated requests to be executed concurrently (by generating pageTokens).
  • Extract large amounts of API data in a short period of time.

Installation

nuget : https://www.nuget.org/packages/YouTubeDataApiWrapper/

For optimal usage the maximum number of connections must be raised by adding the following to the app.config

<configuration>
...
  <system.net>
    <connectionManagement>
      <add address="*" maxconnection="1000" />
    </connectionManagement>
  </system.net>
...</configuration>

Usage

var ytService = new YouTubeService(/*...Create Authorized YouTubeService*/)

//Get 5000 videos from a uploads playlist
var plistItemsListRequestBuilder = new PlaylistItemsListRequestBuilder(ytService, "snippet")
    {
        PlaylistId = "UUsvaJro-UrvEQS9_TYsdAzQ"
    };
var plistItemsRequestService = 
    new YoutubeListRequestService<PlaylistItemsResource.ListRequest, PlaylistItemListResponse, PlaylistItem>(plistItemsListRequestBuilder);

var playlistItems = await plistItemsRequestService.ExecuteConcurrentAsync(new PageTokenRequestRange(5000));

Dependencies

About

A small C# libary that wraps the Google.Apis.YouTube .NET client. That allows paginated requests to be executed concurrently.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages