Ramco Ramco

Ramco Ramco

  • 441
  • 3.4k
  • 522.8k

Most Viewed Catgeory Wise

Jan 31 2023 7:52 AM

Hi

   I have below code . I want Category wise most viewed youtube videos

using (var yt = new YouTubeService(new BaseClientService.Initializer()
{
    ApiKey = "AIzaSyKu9f5blF7idak6cGul59UQ7c7Ls8ECKT8",
}))
{
    StringBuilder htmlTable = new StringBuilder();

    var request = yt.Search.List("snippet");
    request.Order = Google.Apis.YouTube.v3.SearchResource.ListRequest.OrderEnum.ViewCount;
    request.PublishedAfter = DateTime.Today;
    request.PublishedBefore = DateTime.Today.AddDays(1);
     var response = request.Execute();
    var objResult = response.Items.ToList();

Thanks


Answers (8)