mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-25 20:41:21 -05:00
YouTube/IMDb/Lyrics: verify URL domain
This commit is contained in:
parent
7d62a21a75
commit
d992a7dd2c
@ -74,7 +74,7 @@ class IMDb(callbacks.Plugin):
|
||||
"""
|
||||
apikey = self.registryValue('omdbAPI')
|
||||
url = self.dosearch(query)
|
||||
if url:
|
||||
if url and 'imdb.com' in utils.web.getDomain(url):
|
||||
imdb_id = url.split("/title/")[1].rstrip("/")
|
||||
omdb_url = "http://www.omdbapi.com/?i=%s&plot=short&r=json&tomatoes=true&apikey=%s" % (imdb_id, apikey)
|
||||
log.debug("IMDb: requesting %s" % omdb_url)
|
||||
@ -146,7 +146,7 @@ class IMDb(callbacks.Plugin):
|
||||
log.error("IMDb HTTPError: %s" % (str(e)))
|
||||
finally:
|
||||
if result is not None:
|
||||
irc.reply(result)
|
||||
irc.reply(result, prefixNick=False)
|
||||
else:
|
||||
irc.error(self.registryValue("noResultsMessage"))
|
||||
|
||||
|
@ -86,16 +86,16 @@ class Lyrics(callbacks.Plugin):
|
||||
Get song lyrics from Lyrics Wiki. Search powered by Google.
|
||||
"""
|
||||
title, url = self.dosearch(lyric)
|
||||
if not title or not url:
|
||||
irc.reply("No results found for {0}".format(lyric))
|
||||
return
|
||||
else:
|
||||
if url and title and 'lyrics.fandom.com' in utils.web.getDomain(url):
|
||||
try:
|
||||
lyrics = self.getlyrics(url)
|
||||
irc.reply(title)
|
||||
irc.reply(lyrics)
|
||||
irc.reply(title, prefixNick=False)
|
||||
irc.reply(lyrics, prefixNick=False)
|
||||
except Exception:
|
||||
irc.reply("Unable to retrieve lyrics from {0}".format(url))
|
||||
else:
|
||||
irc.reply("No results found for {0}".format(lyric))
|
||||
return
|
||||
lyric = wrap(lyric, ['text'])
|
||||
|
||||
Class = Lyrics
|
||||
|
@ -143,7 +143,7 @@ class YouTube(callbacks.Plugin):
|
||||
"""
|
||||
apikey = self.registryValue('developerKey')
|
||||
url = self.dosearch(query)
|
||||
if url:
|
||||
if url and 'youtube.com' in utils.web.getDomain(url):
|
||||
video_id = self.get_video_id_from_url(url)
|
||||
else:
|
||||
video_id = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user