From 773a174007806a20cd1a976f381dea72b006c372 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 12 Sep 2018 12:28:53 +0000 Subject: [PATCH] Fix url regex and support more kinds of urls --- argondjbot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/argondjbot.py b/argondjbot.py index d703d39..d96af97 100644 --- a/argondjbot.py +++ b/argondjbot.py @@ -287,8 +287,8 @@ class ArgonDJBot(yaboli.Bot): # Find the video id in a single argument VIDEO_ID_RE = r"[a-zA-Z0-9_-]{11}" - YOUTUBE_RE = r"((https?://)?(www\.|music\.)?(youtube\.com/(watch\?(\S*&)v=|embed/)|youtu\.be/))?(" + VIDEO_ID_RE + ")" - YOUTUBE_RE_GROUP = 7 + YOUTUBE_RE = r"((https?://)?(www\.|music\.)?(youtube\.com/((watch|listen)\?(\S*&)?v=|embed/)|youtu\.be/))?(" + VIDEO_ID_RE + ")" + YOUTUBE_RE_GROUP = 8 DEL_RE = r"(\d+)" # Per argument INS_RE = r"(before|after)\s+(\d+)\s+(.*)" # On the whole argstr