diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2023-08-03 12:03:11 +0200 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-08-03 16:23:36 +0200 |
| commit | 203f1f0928c5d08410d552afabc3e3eb7e861747 (patch) | |
| tree | f9a73e49c1729383535629d8dd33298ffb79e1ee | |
| parent | 207fcc0c8c6caedb7189694ce0957c4992fdb3c9 (diff) | |
[fix] engine piped: 'invalid content'
SearXNG does not allow a None value in the content field of a result item.
If the key (shortDescription, uploaderName) in the JSON response from piped
exists but is set to None, SearXNG ignores this result item::
DEBUG searx : result: invalid content: { .., 'content': None, ..}
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
| -rw-r--r-- | searx/engines/piped.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/searx/engines/piped.py b/searx/engines/piped.py index af1cba379..2bfb90656 100644 --- a/searx/engines/piped.py +++ b/searx/engines/piped.py @@ -142,13 +142,14 @@ def response(resp): if piped_filter == 'videos': item["template"] = "videos.html" - item["content"] = result.get("shortDescription", "") + # if the value of shortDescription set, but is None, return empty string + item["content"] = result.get("shortDescription", "") or "" item["thumbnail"] = result.get("thumbnail", "") elif piped_filter == 'music_songs': item["template"] = "default.html" item["img_src"] = result.get("thumbnail", "") - item["content"] = result.get("uploaderName", "") + item["content"] = result.get("uploaderName", "") or "" length = result.get("duration") if length: item["length"] = datetime.timedelta(seconds=length) |