mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-25 20:41:21 -05:00
Lyrics/IMDB: except search plugin errors
This commit is contained in:
parent
5e315f86c9
commit
1ba1b29e9a
@ -87,24 +87,33 @@ class IMDb(callbacks.Plugin):
|
||||
pattern = re.compile(r"https?://www.imdb.com/title/tt\d+/$")
|
||||
for i in range(1, 3):
|
||||
if google and self.registryValue("google", channel) == i:
|
||||
results = google.decode(google.search(query, irc.network, channel))
|
||||
for r in results:
|
||||
try:
|
||||
match = re.search(pattern, r["url"])
|
||||
except TypeError:
|
||||
match = re.search(pattern, r.link)
|
||||
if match:
|
||||
log.debug("IMDb: found link using Google search")
|
||||
break
|
||||
try:
|
||||
results = google.decode(google.search(query, irc.network, channel))
|
||||
for r in results:
|
||||
try:
|
||||
match = re.search(pattern, r["url"])
|
||||
except TypeError:
|
||||
match = re.search(pattern, r.link)
|
||||
if match:
|
||||
log.debug("IMDb: found link using Google search")
|
||||
break
|
||||
except:
|
||||
pass
|
||||
elif ddg and self.registryValue("ddg", channel) == i:
|
||||
results = ddg.search_core(
|
||||
query, channel_context=channel, max_results=10, show_snippet=False
|
||||
)
|
||||
for r in results:
|
||||
match = re.search(pattern, r[2])
|
||||
if match:
|
||||
log.debug("IMDb: found link using DDG search")
|
||||
break
|
||||
try:
|
||||
results = ddg.search_core(
|
||||
query,
|
||||
channel_context=channel,
|
||||
max_results=10,
|
||||
show_snippet=False,
|
||||
)
|
||||
for r in results:
|
||||
match = re.search(pattern, r[2])
|
||||
if match:
|
||||
log.debug("IMDb: found link using DDG search")
|
||||
break
|
||||
except:
|
||||
pass
|
||||
if match:
|
||||
return match.group(0)
|
||||
else:
|
||||
|
@ -85,7 +85,7 @@ class Lyrics(callbacks.Plugin):
|
||||
log.debug("Lyrics: found link using Google search")
|
||||
break
|
||||
except:
|
||||
continue
|
||||
pass
|
||||
elif self.registryValue("ddg", channel) == i:
|
||||
try:
|
||||
results = ddg.search_core(
|
||||
@ -101,7 +101,7 @@ class Lyrics(callbacks.Plugin):
|
||||
log.debug("Lyrics: found link using DDG")
|
||||
break
|
||||
except:
|
||||
continue
|
||||
pass
|
||||
if match and title:
|
||||
return title, match.group(0)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user