Ramco Ramco

Ramco Ramco

  • 438
  • 3.1k
  • 441.6k

Search Items of Video

Jun 15 2024 10:34 AM

Hi

  In a youtube video i have below search items . I want to get displayed them in a column separated by comma.

#afgvpng 

georgina rodriguez

Below is my code


            List<VideoListResponse.Item> listVideo = new List<VideoListResponse.Item>();

            var client = new RestClient("googleapis.com/youtube/v3");
            var request = new RestRequest("search", Method.GET);
            request.AddParameter("part", "snippet");

            request.AddParameter("type", "video");
            request.AddParameter("maxResults", 100);
            request.AddParameter("sortOrder", "desc");
            request.AddParameter("key", "AIzaSyCFG8");

            var response = client.Execute<YoutubeSearchListResponse>(request);

            htmlTable.Append("<table class='table table-bordered table-hover datatable-highlight' id='tbldata'>");
            htmlTable.Append("<thead><tr><th>SN</th><th>Channel Id / Title</th><th>Video Title</th><th>Description</th><th>Category</th><th>View Count</th><th>Published</th></tr></thead>");
            htmlTable.Append("<tbody>");

            Int32 ViewCount = 0;
            foreach (var data in response.Data.items)
            {
                var clientTag0 = new RestClient("googleapis.com/youtube/v3/");
                var tagRequest0 = new RestRequest("videos", Method.GET);
                tagRequest0.AddParameter("key", "AIzaSG8");
                tagRequest0.AddParameter("part", "snippet,statistics");
                tagRequest0.AddParameter("id", data.id.videoId);
                var tagResponse0 = clientTag0.Execute<VideoListResponse>(tagRequest0);

                foreach (var searchResult in tagResponse0.Data.items)
                {
                    listVideo.Add(searchResult);
                }
            }
            if (listVideo.Any())

Thanks


Answers (2)