Fixed queueing playlists with links closes #272

This commit is contained in:
Master Kwoth 2016-05-06 03:18:29 +02:00
parent a2924dc49f
commit 2d3aa08882

View File

@ -180,7 +180,11 @@ namespace NadekoBot.Classes
{
if (string.IsNullOrWhiteSpace(NadekoBot.Creds.GoogleAPIKey))
throw new ArgumentNullException(nameof(query));
var match = new Regex("(?:youtu\\.be\\/|list=)(?<id>[\\da-zA-Z\\-_]*)").Match(query);
if (match.Length > 1)
{
return match.Groups["id"].Value.ToString();
}
var link = "https://www.googleapis.com/youtube/v3/search?part=snippet" +
"&maxResults=1&type=playlist" +
$"&q={Uri.EscapeDataString(query)}" +