diff options
| -rw-r--r-- | searx/engines/ebay.py | 8 | ||||
| -rw-r--r-- | searx/engines/xpath.py | 8 | ||||
| -rw-r--r-- | searx/settings.yml | 1 |
3 files changed, 14 insertions, 3 deletions
diff --git a/searx/engines/ebay.py b/searx/engines/ebay.py index b7aefcb44..07870f044 100644 --- a/searx/engines/ebay.py +++ b/searx/engines/ebay.py @@ -20,8 +20,10 @@ about = { categories = ['shopping'] paging = True -url = 'https://www.ebay.com' -search_url = url + '/sch/i.html?_nkw={query}&_sacat={pageno}' +# Set base_url in settings.yml in order to +# have the desired local TLD. +base_url = None +search_url = '/sch/i.html?_nkw={query}&_sacat={pageno}' results_xpath = '//li[contains(@class, "s-item")]' url_xpath = './/a[@class="s-item__link"]/@href' @@ -34,7 +36,7 @@ thumbnail_xpath = './/img[@class="s-item__image-img"]/@src' def request(query, params): - params['url'] = search_url.format(query=quote(query), pageno=params['pageno']) + params['url'] = f'{base_url}' + search_url.format(query=quote(query), pageno=params['pageno']) return params diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py index 2737bf94a..705a5211d 100644 --- a/searx/engines/xpath.py +++ b/searx/engines/xpath.py @@ -85,6 +85,11 @@ suggestion_xpath = '' cached_xpath = '' cached_url = '' +cookies = {} +headers = {} +'''Some engines might offer different result based on cookies or headers. +Possible use-case: To set safesearch cookie or header to moderate.''' + paging = False '''Engine supports paging [True or False].''' @@ -166,6 +171,9 @@ def request(query, params): 'safe_search': safe_search, } + params['cookies'].update(cookies) + params['headers'].update(headers) + params['url'] = search_url.format(**fargs) params['soft_max_redirects'] = soft_max_redirects diff --git a/searx/settings.yml b/searx/settings.yml index d6a465faf..2976f1c83 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -514,6 +514,7 @@ engines: # - name: ebay # engine: ebay # shortcut: eb + # base_url: 'https://www.ebay.com' # disabled: true # timeout: 5 |