summaryrefslogtreecommitdiff
path: root/searx/engines/apkmirror.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-12-03 10:31:44 +0100
committerGitHub <noreply@github.com>2020-12-03 10:31:44 +0100
commit89fbb85d454959be725cd4ca19c36c31d05d3289 (patch)
tree7ef098d4630c5416aad58f0d3ce5abb27390423f /searx/engines/apkmirror.py
parent6b5a57882242f24f867b6aa14b79b514720c6d83 (diff)
parent64cccae99e625f3ebd879f94797decd0d824608d (diff)
Merge pull request #2332 from dalf/metrology-errors
[enh] record exception details per engine
Diffstat (limited to 'searx/engines/apkmirror.py')
-rw-r--r--searx/engines/apkmirror.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/searx/engines/apkmirror.py b/searx/engines/apkmirror.py
index a8ff499af..3a948dcb4 100644
--- a/searx/engines/apkmirror.py
+++ b/searx/engines/apkmirror.py
@@ -11,7 +11,7 @@
from urllib.parse import urlencode
from lxml import html
-from searx.utils import extract_text
+from searx.utils import extract_text, eval_xpath_list, eval_xpath_getindex
# engine dependent config
@@ -42,12 +42,13 @@ def response(resp):
dom = html.fromstring(resp.text)
# parse results
- for result in dom.xpath('.//div[@id="content"]/div[@class="listWidget"]/div[@class="appRow"]'):
+ for result in eval_xpath_list(dom, './/div[@id="content"]/div[@class="listWidget"]/div[@class="appRow"]'):
- link = result.xpath('.//h5/a')[0]
+ link = eval_xpath_getindex(result, './/h5/a', 0)
url = base_url + link.attrib.get('href') + '#downloads'
title = extract_text(link)
- thumbnail_src = base_url + result.xpath('.//img')[0].attrib.get('src').replace('&w=32&h=32', '&w=64&h=64')
+ thumbnail_src = base_url\
+ + eval_xpath_getindex(result, './/img', 0).attrib.get('src').replace('&w=32&h=32', '&w=64&h=64')
res = {
'url': url,