summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorcapric98 <42015599+capric98@users.noreply.github.com>2022-04-15 20:14:09 +0800
committerMarkus Heiser <markus.heiser@darmarit.de>2022-04-22 16:09:36 +0200
commit8c7e6cc98347fe1a1e6f1cb650e9b48cadf07f8a (patch)
tree6e4838b9a7a27e0e4366fbdda52e44195454bcf0 /searx/engines
parent6ff48859e33911309acf4a6a62eb43a4e73a52d5 (diff)
downloadsearxng-8c7e6cc98347fe1a1e6f1cb650e9b48cadf07f8a.tar.gz
searxng-8c7e6cc98347fe1a1e6f1cb650e9b48cadf07f8a.zip
[fix] FutureWarning from lxml
Just in case if content is None, the original code will skip extract_text(), and just append the None value to 'content'. So just add allow_none=True, and this will return None without raising a ValueError in extract_text().
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/yahoo.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/searx/engines/yahoo.py b/searx/engines/yahoo.py
index 6bf1932e4..c13ce6d78 100644
--- a/searx/engines/yahoo.py
+++ b/searx/engines/yahoo.py
@@ -142,8 +142,7 @@ def response(resp):
title = extract_text(title)[offset:]
content = eval_xpath_getindex(result, './/div[contains(@class, "compText")]', 0, default='')
- if content:
- content = extract_text(content)
+ content = extract_text(content, allow_none=True)
# append result
results.append({'url': url, 'title': title, 'content': content})