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/gigablast.py | |
| parent | 574cb25a16c3011f1797115cb6c90117e9bd1e8e (diff) | |
| parent | 85b37233458c21b775bf98568c0a5c9260aa14fe (diff) | |
Merge pull request #1744 from dalf/optimizations
[mod] speed optimization
Diffstat (limited to 'searx/engines/gigablast.py')
| -rw-r--r-- | searx/engines/gigablast.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/searx/engines/gigablast.py b/searx/engines/gigablast.py index 6b0402233..a84f3f69d 100644 --- a/searx/engines/gigablast.py +++ b/searx/engines/gigablast.py @@ -15,6 +15,7 @@ from json import loads from time import time from lxml.html import fromstring from searx.url_utils import urlencode +from searx.utils import eval_xpath # engine dependent config categories = ['general'] @@ -99,9 +100,9 @@ def response(resp): def _fetch_supported_languages(resp): supported_languages = [] dom = fromstring(resp.text) - links = dom.xpath('//span[@id="menu2"]/a') + links = eval_xpath(dom, '//span[@id="menu2"]/a') for link in links: - href = link.xpath('./@href')[0].split('lang%3A') + href = eval_xpath(link, './@href')[0].split('lang%3A') if len(href) == 2: code = href[1].split('_') if len(code) == 2: |