Don't needlessly search a youtube URL before getting the information for it's

video ID when a URL is provided to !yt
This commit is contained in:
jesopo 2018-10-29 23:13:32 +00:00
parent 73077b9bbf
commit 705daaf9bb

View file

@ -85,7 +85,12 @@ class Module(ModuleManager.BaseModule):
else: else:
last_youtube = event["target"].buffer.find(REGEX_YOUTUBE) last_youtube = event["target"].buffer.find(REGEX_YOUTUBE)
if last_youtube: if last_youtube:
video_id = re.search(REGEX_YOUTUBE, last_youtube.message).group(1) search = last_youtube.message
url_match = re.search(REGEX_YOUTUBE, search)
if search and url_match:
video_id = url_match.group(1)
if search or video_id: if search or video_id:
if not video_id: if not video_id:
search_page = utils.http.get_url(URL_YOUTUBESEARCH, search_page = utils.http.get_url(URL_YOUTUBESEARCH,