diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2021-11-21 09:54:05 +0100 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2021-11-21 09:55:59 +0100 |
commit | 5b28c9109f58685e14da17a83e4ee0f28c9d53c4 (patch) | |
tree | d9a37e40e36bfd533223d02be9a4c709776429ce /searx | |
parent | 1c8b731791f1ca82887e776fefed86618a775b36 (diff) | |
download | searxng-5b28c9109f58685e14da17a83e4ee0f28c9d53c4.tar.gz searxng-5b28c9109f58685e14da17a83e4ee0f28c9d53c4.zip |
[fix] google images: @href index 0 not found
Sometimes there is no href in the `<a ..>` tag of a *link_node* [1].
[1] https://github.com/searxng/searxng/issues/532
Reported-by: @TheEssem
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx')
-rw-r--r-- | searx/engines/google_images.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py index ffdd6675e..61d291e3f 100644 --- a/searx/engines/google_images.py +++ b/searx/engines/google_images.py @@ -172,7 +172,10 @@ def response(resp): thumbnail_src = '' link_node = eval_xpath_getindex(img_node, '../../../a[2]', 0) - url = eval_xpath_getindex(link_node, '@href', 0) + url = eval_xpath_getindex(link_node, '@href', 0, None) + if url is None: + logger.error("missing @href in node: %s", html.tostring(link_node)) + continue pub_nodes = eval_xpath(link_node, './div/div') pub_descr = img_alt |