Hi
I have below code . I want more information like Tags used . I want Channel ID,Video Title,Description etc. Is it possible to get Country .
C#
List listVideo = new List();
var client = new RestClient("/youtube/v3");
var request = new RestRequest("search", Method.GET);
request.AddParameter("part", "snippet");
request.AddParameter("maxResults", "100");
request.AddParameter("order", "viewCount");
request.AddParameter("videoDuration", "short");
DateTime twoDaysAgo = DateTime.UtcNow.AddDays(-2);
// Convert the date to RFC 3339 format
string publishedAfter = twoDaysAgo.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'");
request.AddParameter("publishedAfter", publishedAfter);
request.AddParameter("key", "AIghSyKR9f5Ls8ECSA*");
var response = client.Execute(request);Thanks

Amit MohantyRank #112 · 20K reputationPosted Apr 3, 2024, 3:46 AM EDT
List listVideo = new List(); var client = new RestClient("/youtube/v3"); var request = new RestRequest("search", Method.GET); request.AddParameter("part", "snippet"); request.AddParameter("maxResults", "100"); request.AddParameter("order", "viewCount"); request.AddParameter("videoDuration", "short"); DateTime twoDaysAgo = DateTime.UtcNow.AddDays(-2); // Convert the date to RFC 3339 format string publishedAfter = twoDaysAgo.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'"); request.AddParameter("publishedAfter", publishedAfter); request.AddParameter("key", "AIghSyKR9f5Ls8ECSA*"); var response = client.Execute(request); foreach (var item in response.Items) { string videoId = item.Id.VideoId; string channelId = item.Snippet.ChannelId; string videoTitle = item.Snippet.Title; string description = item.Snippet.Description; string[] tags = item.Snippet.Tags; string country = item.Snippet.Country; listVideo.Add(new VideoListResponse.Item { Id = new VideoListResponse.Item.IdType { VideoId = videoId }, Snippet = new VideoListResponse.Item.SnippetType { ChannelId = channelId, Title = videoTitle, Description = description } }); }Ramco RamcoRank #462 · 5.4K reputationPosted Apr 3, 2024, 4:39 AM EDT
Hi Amit
What is the purpose of below code
listVideo.Add(new VideoListResponse.Item { Id = new VideoListResponse.Item.IdType { VideoId = videoId }, Snippet = new VideoListResponse.Item.SnippetType { ChannelId = channelId, Title = videoTitle, Description = description } });Thanks