diff options
author | Alexandre Flament <alex@al-f.net> | 2020-11-26 15:49:33 +0100 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2020-12-03 10:22:48 +0100 |
commit | ad72803ed98760b2a95690dea3b95eacc670427c (patch) | |
tree | 7e8515b6c4752baedb5e80588c9041bc72cdeb04 /searx/engines/apkmirror.py | |
parent | de887c6347db4c810f7d1e11c77633340d4e2fbd (diff) | |
download | searxng-ad72803ed98760b2a95690dea3b95eacc670427c.tar.gz searxng-ad72803ed98760b2a95690dea3b95eacc670427c.zip |
[mod] xpath, 1337x, acgsou, apkmirror, archlinux, arxiv: use eval_xpath_* functions
Diffstat (limited to 'searx/engines/apkmirror.py')
-rw-r--r-- | searx/engines/apkmirror.py | 9 |
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, |