mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-13 13:42:37 +01:00
parent
1a6e0127bd
commit
d462b09dd7
@ -67,9 +67,12 @@ class DDG(callbacks.Plugin):
|
|||||||
self.log.info(url)
|
self.log.info(url)
|
||||||
irc.error(str(e), Raise=True)
|
irc.error(str(e), Raise=True)
|
||||||
soup = BeautifulSoup(data)
|
soup = BeautifulSoup(data)
|
||||||
|
res = ''
|
||||||
for t in soup.find_all('td'):
|
for t in soup.find_all('td'):
|
||||||
if "1." in t.text:
|
if "1." in t.text:
|
||||||
res = t.next_sibling.next_sibling
|
res = t.next_sibling.next_sibling
|
||||||
|
if not res:
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
# 1) Get a result snippet.
|
# 1) Get a result snippet.
|
||||||
snippet = res.parent.next_sibling.next_sibling.find("td",
|
snippet = res.parent.next_sibling.next_sibling.find("td",
|
||||||
@ -81,7 +84,7 @@ class DDG(callbacks.Plugin):
|
|||||||
s = format("%s - %u", snippet, link)
|
s = format("%s - %u", snippet, link)
|
||||||
irc.reply(s)
|
irc.reply(s)
|
||||||
return
|
return
|
||||||
except (AttributeError, UnboundLocalError):
|
except AttributeError:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
irc.error("No results found.")
|
irc.error("No results found.")
|
||||||
|
Loading…
Reference in New Issue
Block a user