Ramco Ramco

Ramco Ramco

  • 440
  • 3.4k
  • 527.6k

Search Keywords of my own videos

Apr 5 2024 4:17 PM

Hi

  I want to get Search Keywords of my own videos through this code. 

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

            var client = new RestClient("youtube/v3");
            var request = new RestRequest("search", Method.GET);
            request.AddParameter("part", "snippet");
            request.AddParameter("q", "sports shorts");
            request.AddParameter("type", "video");
            request.AddParameter("videoDuration", "short");

            request.AddParameter("key", "AIJHDKSY9");
            var response = client.Execute<YoutubeSearchListResponse>(request);

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

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

Thanks


Answers (1)