diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2024-09-06 06:54:02 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-09-06 07:13:47 +0200 |
commit | 9eda4044bebc3c23f7d803caca5e6a763ef92712 (patch) | |
tree | cb15493f8a33f056ed741e15bb53f4dd666fb5f3 /searx | |
parent | 21bfb4996e3fa4042e7ae018587d50ff2281f583 (diff) | |
download | searxng-9eda4044bebc3c23f7d803caca5e6a763ef92712.tar.gz searxng-9eda4044bebc3c23f7d803caca5e6a763ef92712.zip |
[fix] bilibili engine - ValueError in duration & HTML in title
- ValueError in duration: issue reported in #3799
- HTML in title: related to #3770
[#3799] https://github.com/searxng/searxng/issues/3799
[#3770] https://github.com/searxng/searxng/pull/3770
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx')
-rw-r--r-- | searx/engines/bilibili.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/searx/engines/bilibili.py b/searx/engines/bilibili.py index f26f2164f..f3436d3a7 100644 --- a/searx/engines/bilibili.py +++ b/searx/engines/bilibili.py @@ -9,6 +9,8 @@ import string from urllib.parse import urlencode from datetime import datetime, timedelta +from searx import utils + # Engine metadata about = { "website": "https://www.bilibili.com", @@ -56,6 +58,8 @@ def request(query, params): # Format the video duration def format_duration(duration): + if not ":" in duration: + return None minutes, seconds = map(int, duration.split(":")) total_seconds = minutes * 60 + seconds @@ -70,7 +74,7 @@ def response(resp): results = [] for item in search_res.get("data", {}).get("result", []): - title = item["title"] + title = utils.html_to_text(item["title"]) url = item["arcurl"] thumbnail = item["pic"] description = item["description"] |