mirror of https://github.com/searx/searx
Fix regression is retrieving sc code (#3453)
I broke the code when I fixed this. The old codepath did some trimming of the sc value and I didn't kill that line, so the value was being clipped. This fixes #3430 and is confirmed working on a live instance.
This commit is contained in:
parent
5e658ef276
commit
2fc1cd3a15
|
@ -91,14 +91,13 @@ def get_sc_code(headers):
|
||||||
dom = html.fromstring(resp.text)
|
dom = html.fromstring(resp.text)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
href = eval_xpath(dom, '//input[@name="sc"]')[0].get('value')
|
sc_code = eval_xpath(dom, '//input[@name="sc"]')[0].get('value')
|
||||||
except IndexError as exc:
|
except IndexError as exc:
|
||||||
# suspend startpage API --> https://github.com/searxng/searxng/pull/695
|
# suspend startpage API --> https://github.com/searxng/searxng/pull/695
|
||||||
raise SearxEngineResponseException(
|
raise SearxEngineResponseException(
|
||||||
suspended_time=7 * 24 * 3600, message="PR-695: query new sc time-stamp failed!"
|
suspended_time=7 * 24 * 3600, message="PR-695: query new sc time-stamp failed!"
|
||||||
) from exc
|
) from exc
|
||||||
|
|
||||||
sc_code = href[5:]
|
|
||||||
sc_code_ts = time()
|
sc_code_ts = time()
|
||||||
logger.debug("new value is: %s", sc_code)
|
logger.debug("new value is: %s", sc_code)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue