From 8c7e6cc98347fe1a1e6f1cb650e9b48cadf07f8a Mon Sep 17 00:00:00 2001 From: capric98 <42015599+capric98@users.noreply.github.com> Date: Fri, 15 Apr 2022 20:14:09 +0800 Subject: [PATCH] [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(). --- searx/engines/yahoo.py | 3 +-- 1 file changed, 1 insertion(+), 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})