Compare commits

..

2 Commits

Author SHA1 Message Date
Bnyro b48205b384 [fix] tiger: crashes on empty result (#6251)
e.g. when searching for "!tiger pottering github", it crashes.
not really sure why - the problem is that the HTML doesn't
really uses descriptive classes or ids, only Tailwind,
so it's very hard to select only the results HTML.
2026-06-13 09:37:43 +02:00
Bnyro 8522638b00 [fix] duckduckgo web: result title contains html (#6253) 2026-06-13 09:35:14 +02:00
2 changed files with 7 additions and 2 deletions
+3 -1
View File
@@ -140,7 +140,9 @@ def response(resp: "SXNG_Response"):
if "u" not in result: if "u" not in result:
continue continue
res.add(res.types.MainResult(url=result["u"], title=result["t"], content=html_to_text(result["a"]))) res.add(
res.types.MainResult(url=result["u"], title=html_to_text(result["t"]), content=html_to_text(result["a"]))
)
# link to next page # link to next page
next_page_path = res_json["results"][-1].get("n") next_page_path = res_json["results"][-1].get("n")
+4 -1
View File
@@ -134,9 +134,12 @@ def response(resp: "SXNG_Response") -> EngineResults:
if tiger_category == "Websuche": if tiger_category == "Websuche":
for result in eval_xpath_list(doc, "//div[@id='mainContainer']//table/tr"): for result in eval_xpath_list(doc, "//div[@id='mainContainer']//table/tr"):
url = extract_text(eval_xpath(result, ".//a[contains(@class, 'weblink')]/@href"))
if not url:
continue
res.add( res.add(
res.types.MainResult( res.types.MainResult(
url=extract_text(eval_xpath(result, ".//a[contains(@class, 'weblink')]/@href")), url=url,
title=extract_text(eval_xpath(result, ".//a[contains(@class, 'weblink')]")) or "", title=extract_text(eval_xpath(result, ".//a[contains(@class, 'weblink')]")) or "",
content=extract_text(eval_xpath(result, ".//*[contains(@class, 'webbodynopic')]")) or "", content=extract_text(eval_xpath(result, ".//*[contains(@class, 'webbodynopic')]")) or "",
) )