Skip to content

Commit

Permalink
Merge pull request #611 from warddr/issue559-duck
Browse files Browse the repository at this point in the history
[search] skip duckduckgo adds and show first real link
  • Loading branch information
embolalia committed Aug 31, 2014
2 parents 060d23d + 2ea4ae4 commit 1362afc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions willie/modules/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 1362afc

Please sign in to comment.