Hi
I want to get Youtube search keywords , Suggested Videos of all my videos.
Thanks
Hi
I want to get Youtube search keywords , Suggested Videos of all my videos.
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Naimish MakwanaRank #324 · 7.7K reputationPosted Apr 2, 2024, 7:48 AM EDT
To get YouTube search keywords and suggested videos in C#, you can use the YouTube Data API. Here’s a basic example of how you can do this:
using Google.Apis.Services; using Google.Apis.YouTube.v3; // Initialize the YouTubeService var youtubeService = new YouTubeService(new BaseClientService.Initializer() { ApiKey = "YOUR_API_KEY", // Replace with your API key ApplicationName = "YOUR_APPLICATION_NAME" // Replace with your application name }); // Define the search request var searchRequest = youtubeService.Search.List("snippet"); searchRequest.Q = "YOUR_SEARCH_KEYWORDS"; // Replace with your search keywords searchRequest.MaxResults = 50; // Execute the search request and get the results var searchResponse = await searchRequest.ExecuteAsync(); // Iterate through the search results foreach (var searchResult in searchResponse.Items) { // Print the Title and VideoId of each search result Console.WriteLine($"Title: {searchResult.Snippet.Title}, VideoId: {searchResult.Id.VideoId}"); }This code will search for videos on YouTube using the specified keywords and print the title and video ID of each search result1.
Please replace
"YOUR_API_KEY"and"YOUR_APPLICATION_NAME"with your actual API key and application name. Also, replace"YOUR_SEARCH_KEYWORDS"with the keywords you want to search for.Remember, you need to install the
Google.Apis.YouTube.v3NuGet package to your project before you can use theYouTubeService1.As for getting the suggested videos, YouTube Data API does not provide a direct way to fetch them. These are generated dynamically by YouTube based on various factors like user’s watch history, trending videos, etc.
Thanks