Browse Source

[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().
capric98 3 years ago
parent
commit
8c7e6cc983
1 changed files with 1 additions and 2 deletions
  1. 1 2
      searx/engines/yahoo.py

+ 1 - 2
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})