Fixed queueing playlists with links closes #272
This commit is contained in:
parent
a2924dc49f
commit
2d3aa08882
@ -180,7 +180,11 @@ namespace NadekoBot.Classes
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(NadekoBot.Creds.GoogleAPIKey))
|
if (string.IsNullOrWhiteSpace(NadekoBot.Creds.GoogleAPIKey))
|
||||||
throw new ArgumentNullException(nameof(query));
|
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" +
|
var link = "https://www.googleapis.com/youtube/v3/search?part=snippet" +
|
||||||
"&maxResults=1&type=playlist" +
|
"&maxResults=1&type=playlist" +
|
||||||
$"&q={Uri.EscapeDataString(query)}" +
|
$"&q={Uri.EscapeDataString(query)}" +
|
||||||
|
Loading…
Reference in New Issue
Block a user