mirror of https://github.com/searxng/searxng.git
[fix] engine seznam: fix issues reported by black & pylint
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
c8d78355ff
commit
509afbbb84
|
@ -1,6 +1,7 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
"""
|
# lint: pylint
|
||||||
Seznam
|
"""Seznam
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
@ -11,7 +12,6 @@ from searx.utils import (
|
||||||
extract_text,
|
extract_text,
|
||||||
eval_xpath_list,
|
eval_xpath_list,
|
||||||
eval_xpath_getindex,
|
eval_xpath_getindex,
|
||||||
eval_xpath,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# about
|
# about
|
||||||
|
@ -30,8 +30,7 @@ base_url = 'https://search.seznam.cz/'
|
||||||
|
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
response_index = get(
|
response_index = get(base_url, headers=params['headers'], raise_for_httperror=True)
|
||||||
base_url, headers=params['headers'], raise_for_httperror=True)
|
|
||||||
dom = html.fromstring(response_index.text)
|
dom = html.fromstring(response_index.text)
|
||||||
|
|
||||||
url_params = {
|
url_params = {
|
||||||
|
@ -55,9 +54,12 @@ def response(resp):
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
dom = html.fromstring(resp.content.decode())
|
dom = html.fromstring(resp.content.decode())
|
||||||
for result_element in eval_xpath_list(dom, '//div[@id="searchpage-root"]//div[@class="Layout--left"]/div[@class="f2c528"]'):
|
for result_element in eval_xpath_list(
|
||||||
|
dom, '//div[@id="searchpage-root"]//div[@class="Layout--left"]/div[@class="f2c528"]'
|
||||||
|
):
|
||||||
result_data = eval_xpath_getindex(
|
result_data = eval_xpath_getindex(
|
||||||
result_element, './/div[@class="c8774a" or @class="e69e8d a11657"]', 0, default=None)
|
result_element, './/div[@class="c8774a" or @class="e69e8d a11657"]', 0, default=None
|
||||||
|
)
|
||||||
if result_data is None:
|
if result_data is None:
|
||||||
continue
|
continue
|
||||||
title_element = eval_xpath_getindex(result_element, './/h3/a', 0)
|
title_element = eval_xpath_getindex(result_element, './/h3/a', 0)
|
||||||
|
|
Loading…
Reference in New Issue