Skip to content

Commit

Permalink
[search] skip duckduckgo adds and show first real link
Browse files Browse the repository at this point in the history
this fixes sopel-irc#599
  • Loading branch information
warddr committed Aug 27, 2014
1 parent 6c5f4e7 commit 4413fd7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions search.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,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]
m = r_duck.search(bytes)
if m:
return web.decode(m.group(1))
Expand Down

0 comments on commit 4413fd7

Please sign in to comment.