mirror of
https://github.com/searxng/searxng.git
synced 2026-06-13 21:37:51 +02:00
[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:
@@ -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 "",
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user