diff options
author | dalf <alex@al-f.net> | 2015-02-20 12:34:13 +0100 |
---|---|---|
committer | dalf <alex@al-f.net> | 2015-02-20 12:34:13 +0100 |
commit | 57996b12fcbe193e89537c63abd1a75c3c65a25a (patch) | |
tree | 4efaea45e482f272710c4373bf06b4f37f3d8333 /searx/engines/yahoo.py | |
parent | dc036ece856fb437504bc0b9a059b305999bb68b (diff) | |
download | searxng-57996b12fcbe193e89537c63abd1a75c3c65a25a.tar.gz searxng-57996b12fcbe193e89537c63abd1a75c3c65a25a.zip |
[fix] update yahoo engine according to the web site changes
Diffstat (limited to 'searx/engines/yahoo.py')
-rw-r--r-- | searx/engines/yahoo.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/searx/engines/yahoo.py b/searx/engines/yahoo.py index 161f7513b..11663a415 100644 --- a/searx/engines/yahoo.py +++ b/searx/engines/yahoo.py @@ -24,11 +24,11 @@ base_url = 'https://search.yahoo.com/' search_url = 'search?{query}&b={offset}&fl=1&vl=lang_{lang}' # specific xpath variables -results_xpath = '//div[@class="res"]' +results_xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' Sr ')]" url_xpath = './/h3/a/@href' title_xpath = './/h3/a' -content_xpath = './/div[@class="abstr"]' -suggestion_xpath = '//div[@id="satat"]//a' +content_xpath = './/div[@class="compText aAbs"]' +suggestion_xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' AlsoTry ')]//a" # remove yahoo-specific tracking-url @@ -91,11 +91,12 @@ def response(resp): 'content': content}) # if no suggestion found, return results - if not dom.xpath(suggestion_xpath): + suggestions = dom.xpath(suggestion_xpath) + if not suggestions: return results # parse suggestion - for suggestion in dom.xpath(suggestion_xpath): + for suggestion in suggestions: # append suggestion results.append({'suggestion': extract_text(suggestion)}) |