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:
parent
73077b9bbf
commit
705daaf9bb
1 changed files with 6 additions and 1 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue