DiscordRadioBot/Classes/YoutubeSearchEngine.cs
/// <summary>
/// Search in YouTube and returns a dictionary containing Titles of Music Videos and the Video Url.
/// </summary>
/// <param name="wordList"> A list of keywords to use for the search query. </param>
/// <returns></returns>
Search in YouTube and returns a dictionary containing Titles of Music Videos and the Video Url.
Search in YouTube and returns a dictionary containing Titles of Music Videos and the Video Url .
public Dictionary<string, string> SearchVideos(List<string> wordList)
        {
            YouTubeService youtubeService = new YouTubeService(new BaseClientService.Initializer { ApiKey = youtubeApiKey, ApplicationName = $"YouTubeCustomSearchEngine" });
            SearchResource.ListRequest searchListRequest = youtubeService.Search.List("snippet");
            searchListRequest.Q = ParseSearchQuery(wordList);
            searchListRequest.Type = "video";
            searchListRequest.MaxResults = _maxSearchResults;
            searchListRequest.VideoCategoryId = "10";
            searchListRequest.EventType = SearchResource.ListRequest.EventTypeEnum.None;
            SearchListResponse searchListResponse = searchListRequest.Execute();
            return GetYouTubeSearchResults(searchListResponse);
        }
public Dictionary < string , string > SearchVideos ( List < string > wordList ) { YouTubeService youtubeService = new YouTubeService ( new BaseClientService . Initializer { ApiKey = youtubeApiKey , ApplicationName = $" YouTubeCustomSearchEngine " } ) ; SearchResource . ListRequest searchListRequest = youtubeService . Search . List ( " " ) ; searchListRequest . Q = ParseSearchQuery ( wordList ) ; searchListRequest . Type = " " ; searchListRequest . MaxResults = _maxSearchResults ; searchListRequest . VideoCategoryId = " " ; searchListRequest . EventType = SearchResource . ListRequest . EventTypeEnum . None ; SearchListResponse searchListResponse = searchListRequest . Execute ( ) ; return GetYouTubeSearchResults ( searchListResponse ) ; }
Search in YouTube and returns a dictionary containing Titles of Music Videos and the Video Url.
Search in YouTube and returns a dictionary containing Titles of Music Videos and the Video Url .
None
wordList
List<string>
A list of keywords to use for the search query.
A list of keywords to use for the search query .