summaryrefslogtreecommitdiff
path: root/searx/engines/duckduckgo.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2015-02-12 10:52:55 +0100
committerAdam Tauber <asciimoo@gmail.com>2015-02-12 10:52:55 +0100
commitf6db77d81ea87d99462b4c3cc40a8a27e0264724 (patch)
treeb26fb71a62082aeec81c7bb1bb3d7447d006aed3 /searx/engines/duckduckgo.py
parent516105c570a920dadeb87b34ee5ee434ad5cb16f (diff)
parentf96154b7c454a3b02bf688f248b4471c2020c28f (diff)
Merge pull request #210 from Cqoicebordel/unit-tests
unit tests
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,