Ramco Ramco

Ramco Ramco

  • 438
  • 3.1k
  • 441.5k

How to get search keywords of my own youtube videos

Jun 15 2024 3:16 PM

Hi

  How to get search keywords of my own youtube videos

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 (3)