From 751c9a346ebd193800a1228ffff1b856942099ab Mon Sep 17 00:00:00 2001 From: a01200356 Date: Mon, 21 Mar 2016 20:19:13 -0600 Subject: [PATCH] [fix] duckduckgo's xpaths changed test_duckduckgo modified to reflect changes in duckduckgo's html --- searx/engines/duckduckgo.py | 8 ++-- tests/unit/engines/test_duckduckgo.py | 68 ++++++++++----------------- 2 files changed, 28 insertions(+), 48 deletions(-) diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py index 4ac2099ae..373ce1b2d 100644 --- a/searx/engines/duckduckgo.py +++ b/searx/engines/duckduckgo.py @@ -28,10 +28,10 @@ language_support = True 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"]' -content_xpath = './/div[@class="snippet"]' +result_xpath = '//div[@class="result results_links results_links_deep web-result "]' # noqa +url_xpath = './/a[@class="result__a"]/@href' +title_xpath = './/a[@class="result__a"]' +content_xpath = './/a[@class="result__snippet"]' # do search-request diff --git a/tests/unit/engines/test_duckduckgo.py b/tests/unit/engines/test_duckduckgo.py index 14cd9cd87..8f99dc9cb 100644 --- a/tests/unit/engines/test_duckduckgo.py +++ b/tests/unit/engines/test_duckduckgo.py @@ -32,20 +32,32 @@ class TestDuckduckgoEngine(SearxTestCase): self.assertEqual(duckduckgo.response(response), []) html = u""" -