Skip to content

Commit

Permalink
search: Remove ad URL results
Browse files Browse the repository at this point in the history
DDG changed their HTML output slightly and that threw us off, this *should* fix the r.search.yahoo.com URLs that .g was returning.
  • Loading branch information
maxpowa committed Mar 22, 2016
1 parent e31649a commit 4f09c02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sopel/modules/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def duck_search(query):
query = query.replace('!', '')
uri = 'http://duckduckgo.com/html/?q=%s&kl=uk-en' % query
bytes = web.get(uri)
if 'web-result"' in bytes: # filter out the adds on top of the page
bytes = bytes.split('web-result"')[1]
if 'web-result' in bytes: # filter out the adds on top of the page
bytes = bytes.split('web-result')[1]
m = r_duck.search(bytes)
if m:
return web.decode(m.group(1))
Expand Down

0 comments on commit 4f09c02

Please sign in to comment.