mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-04 00:24:11 +01:00
DDG: remove broken error catching (irc isn't in the _ddgurl namespace)
From: 52ec05a041
This commit is contained in:
parent
35677548df
commit
950aec696e
@ -62,10 +62,7 @@ class DDG(callbacks.Plugin):
|
|||||||
# DuckDuckGo has a 'lite' site free of unparseable JavaScript
|
# DuckDuckGo has a 'lite' site free of unparseable JavaScript
|
||||||
# elements, so we'll use that to our advantage!
|
# elements, so we'll use that to our advantage!
|
||||||
url = "https://duckduckgo.com/lite?" + urlencode({"q": text})
|
url = "https://duckduckgo.com/lite?" + urlencode({"q": text})
|
||||||
try:
|
|
||||||
data = utils.web.getUrl(url).decode("utf-8")
|
data = utils.web.getUrl(url).decode("utf-8")
|
||||||
except utils.web.Error as e:
|
|
||||||
irc.error(str(e), Raise=True)
|
|
||||||
soup = BeautifulSoup(data)
|
soup = BeautifulSoup(data)
|
||||||
# Remove "sponsored link" results
|
# Remove "sponsored link" results
|
||||||
return [td for td in soup.find_all('td') if 'result-sponsored' not in str(td.parent.get('class'))]
|
return [td for td in soup.find_all('td') if 'result-sponsored' not in str(td.parent.get('class'))]
|
||||||
|
Loading…
Reference in New Issue
Block a user