diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2019-12-02 13:39:58 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-02 13:39:58 +0000 |
| commit | 731e34299d128f9352fd76e603c960c1f0628ed9 (patch) | |
| tree | f591dc036131f2c3a045fbc557f66afc905646cb /searx/engines/startpage.py | |
| parent | 574cb25a16c3011f1797115cb6c90117e9bd1e8e (diff) | |
| parent | 85b37233458c21b775bf98568c0a5c9260aa14fe (diff) | |
Merge pull request #1744 from dalf/optimizations
[mod] speed optimization
Diffstat (limited to 'searx/engines/startpage.py')
| -rw-r--r-- | searx/engines/startpage.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/searx/engines/startpage.py b/searx/engines/startpage.py index 0f0ec6e18..76567396f 100644 --- a/searx/engines/startpage.py +++ b/searx/engines/startpage.py @@ -16,6 +16,7 @@ from datetime import datetime, timedelta import re from searx.engines.xpath import extract_text from searx.languages import language_codes +from searx.utils import eval_xpath # engine dependent config categories = ['general'] @@ -70,8 +71,8 @@ def response(resp): dom = html.fromstring(resp.text) # parse results - for result in dom.xpath(results_xpath): - links = result.xpath(link_xpath) + for result in eval_xpath(dom, results_xpath): + links = eval_xpath(result, link_xpath) if not links: continue link = links[0] @@ -87,8 +88,8 @@ def response(resp): title = extract_text(link) - if result.xpath(content_xpath): - content = extract_text(result.xpath(content_xpath)) + if eval_xpath(result, content_xpath): + content = extract_text(eval_xpath(result, content_xpath)) else: content = '' |