summaryrefslogtreecommitdiff
path: root/searx/engines/duckduckgo.py
diff options
context:
space:
mode:
authorCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-02-02 17:55:39 +0100
committerCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-02-02 17:55:39 +0100
commitefe6dead5566d4800587491e5252474a33ddff60 (patch)
tree34d39018c885ccf2a91a3bf73a79a29759eb8fbe /searx/engines/duckduckgo.py
parent0e6f8393ab8b29b2e85d1fafdc7442455767f753 (diff)
downloadsearxng-efe6dead5566d4800587491e5252474a33ddff60.tar.gz
searxng-efe6dead5566d4800587491e5252474a33ddff60.zip
Duckduckgo unit test
Diffstat (limited to 'searx/engines/duckduckgo.py')
-rw-r--r--searx/engines/duckduckgo.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py
index 583e33f73..e35a6334c 100644
--- a/searx/engines/duckduckgo.py
+++ b/searx/engines/duckduckgo.py
@@ -15,7 +15,7 @@
from urllib import urlencode
from lxml.html import fromstring
-from searx.utils import html_to_text
+from searx.engines.xpath import extract_text
# engine dependent config
categories = ['general']
@@ -28,8 +28,8 @@ url = 'https://duckduckgo.com/html?{query}&s={offset}'
# specific xpath variables
result_xpath = '//div[@class="results_links results_links_deep web-result"]' # noqa
url_xpath = './/a[@class="large"]/@href'
-title_xpath = './/a[@class="large"]//text()'
-content_xpath = './/div[@class="snippet"]//text()'
+title_xpath = './/a[@class="large"]'
+content_xpath = './/div[@class="snippet"]'
# do search-request
@@ -64,8 +64,8 @@ def response(resp):
if not res_url:
continue
- title = html_to_text(''.join(r.xpath(title_xpath)))
- content = html_to_text(''.join(r.xpath(content_xpath)))
+ title = extract_text(r.xpath(title_xpath))
+ content = extract_text(r.xpath(content_xpath))
# append result
results.append({'title': title,