Ramco Ramco

Ramco Ramco

  • 442
  • 3.4k
  • 528.5k

How to display in descending order on basis of Views

Feb 7 2023 3:38 PM

Hi

How to display in descending order on basis of Views in Youtube

            var client = new RestClient("googleapis.com/youtube/v3");

            var request = new RestRequest("search", Method.GET);
            request.AddParameter("part", "snippet");
            request.AddParameter("q", "sports shorts");
            request.AddParameter("maxResults", "20");
            request.AddParameter("type", "video");
            request.AddParameter("videoDuration", "short");

            var today = DateTime.Now.Date;
            var sevenDaysAgo = today.AddDays(-1).ToString("yyyy-MM-ddTHH:mm:ssZ");
            request.AddParameter("publishedAfter", sevenDaysAgo);
            request.AddParameter("sortOrder", "desc");
            request.AddParameter("type", "video");
            request.AddParameter("order", "viewCount");
            request.AddParameter("key", "ApiKey");

 


Answers (3)