diff options
| author | Aadniz <8147434+Aadniz@users.noreply.github.com> | 2025-03-28 14:50:38 +0100 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2025-03-28 16:26:39 +0100 |
| commit | ecee73eafd694bb91b840882aea5b3d6c5b40a7b (patch) | |
| tree | cfa3e2faccca7b24b7d411b03ff277dbb893a5aa /searx/engines/presearch.py | |
| parent | 1189b1906cb7be6d7435e52cb71589ee201ce98b (diff) | |
[fix] presearch engine: Unexpected crash if duration not in videos
Diffstat (limited to 'searx/engines/presearch.py')
| -rw-r--r-- | searx/engines/presearch.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/searx/engines/presearch.py b/searx/engines/presearch.py index 7e30801d1..034233163 100644 --- a/searx/engines/presearch.py +++ b/searx/engines/presearch.py @@ -264,13 +264,17 @@ def response(resp): # a video and not to a video stream --> SearXNG can't use the video template. for item in json_resp.get('videos', []): + duration = item.get('duration') + if duration: + duration = parse_duration_string(duration) + results.append( { 'title': html_to_text(item['title']), 'url': item.get('link'), 'content': item.get('description', ''), 'thumbnail': item.get('image'), - 'length': parse_duration_string(item.get('duration')), + 'length': duration, } ) |