From 4413fd7b562473e502043d9ed6d47c945cf954a3 Mon Sep 17 00:00:00 2001 From: warddr Date: Wed, 27 Aug 2014 09:43:41 +0200 Subject: [PATCH] [search] skip duckduckgo adds and show first real link this fixes #599 --- search.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/search.py b/search.py index 6c4615c027..f3ab03972e 100644 --- a/search.py +++ b/search.py @@ -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))