[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.
This commit is contained in:
Bnyro
2026-06-13 09:37:43 +02:00
committed by GitHub
parent 8522638b00
commit b48205b384
+4 -1
View File
@@ -134,9 +134,12 @@ def response(resp: "SXNG_Response") -> EngineResults:
if tiger_category == "Websuche":
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.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 "",
content=extract_text(eval_xpath(result, ".//*[contains(@class, 'webbodynopic')]")) or "",
)