mirror of
https://github.com/searxng/searxng.git
synced 2024-11-11 20:51:15 +00:00
[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>
This commit is contained in:
parent
21bfb4996e
commit
9eda4044be
1 changed files with 5 additions and 1 deletions
|
@ -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"]
|
||||
|
|
Loading…
Reference in a new issue