From a771e519b4d6db520ea2e50442dec011775c522a Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Fri, 8 Jul 2016 21:33:08 +0200 Subject: [PATCH] key is not needed if we're queueing links. --- NadekoBot/Classes/SearchHelper.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NadekoBot/Classes/SearchHelper.cs b/NadekoBot/Classes/SearchHelper.cs index 42f70398..82d3d7dc 100644 --- a/NadekoBot/Classes/SearchHelper.cs +++ b/NadekoBot/Classes/SearchHelper.cs @@ -145,8 +145,6 @@ namespace NadekoBot.Classes public static async Task FindYoutubeUrlByKeywords(string keywords) { - if (string.IsNullOrWhiteSpace(NadekoBot.Creds.GoogleAPIKey)) - throw new InvalidCredentialException("Google API Key is missing."); if (string.IsNullOrWhiteSpace(keywords)) throw new ArgumentNullException(nameof(keywords), "Query not specified."); if (keywords.Length > 150) @@ -158,6 +156,10 @@ namespace NadekoBot.Classes { return $"https://www.youtube.com/watch?v={match.Groups["id"].Value}"; } + + if (string.IsNullOrWhiteSpace(NadekoBot.Creds.GoogleAPIKey)) + throw new InvalidCredentialException("Google API Key is missing."); + var response = await GetResponseStringAsync( $"https://www.googleapis.com/youtube/v3/search?" + $"part=snippet&maxResults=1" +