DDG: strip Sponsored links from search results

From: e9edceb735
This commit is contained in:
James Lu 2015-08-22 18:32:04 -07:00
parent 0079333c80
commit 35677548df

View File

@ -67,7 +67,8 @@ class DDG(callbacks.Plugin):
except utils.web.Error as e: except utils.web.Error as e:
irc.error(str(e), Raise=True) irc.error(str(e), Raise=True)
soup = BeautifulSoup(data) soup = BeautifulSoup(data)
return soup.find_all('td') # Remove "sponsored link" results
return [td for td in soup.find_all('td') if 'result-sponsored' not in str(td.parent.get('class'))]
def search(self, irc, msg, args, text): def search(self, irc, msg, args, text):
"""<text> """<text>