[fix] presearch engine: Unexpected crash if duration not in videos
This commit is contained in:
parent
1189b1906c
commit
ecee73eafd
@ -264,13 +264,17 @@ def response(resp):
|
|||||||
# a video and not to a video stream --> SearXNG can't use the video template.
|
# a video and not to a video stream --> SearXNG can't use the video template.
|
||||||
|
|
||||||
for item in json_resp.get('videos', []):
|
for item in json_resp.get('videos', []):
|
||||||
|
duration = item.get('duration')
|
||||||
|
if duration:
|
||||||
|
duration = parse_duration_string(duration)
|
||||||
|
|
||||||
results.append(
|
results.append(
|
||||||
{
|
{
|
||||||
'title': html_to_text(item['title']),
|
'title': html_to_text(item['title']),
|
||||||
'url': item.get('link'),
|
'url': item.get('link'),
|
||||||
'content': item.get('description', ''),
|
'content': item.get('description', ''),
|
||||||
'thumbnail': item.get('image'),
|
'thumbnail': item.get('image'),
|
||||||
'length': parse_duration_string(item.get('duration')),
|
'length': duration,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user