mirror of https://github.com/searx/searx
Fix scraping of 'sc' value from homepage (#3397)
Looking at the current HTML for the Startpage front page, the previous footer logo element is no longer present. This change scrapes the "sc" parameter from one of the hidden HTML form elements, which should (hopefully) be a bit more stable long term, since that form is used by Startpage to submit requests to the engine.
This commit is contained in:
parent
a9a6c58d26
commit
3c84af95ba
|
@ -91,8 +91,7 @@ def get_sc_code(headers):
|
|||
dom = html.fromstring(resp.text)
|
||||
|
||||
try:
|
||||
# href --> '/?sc=adrKJMgF8xwp20'
|
||||
href = eval_xpath(dom, '//a[@class="footer-home__logo"]')[0].get('href')
|
||||
href = eval_xpath(dom, '//input[@name="sc"]')[0].get('value')
|
||||
except IndexError as exc:
|
||||
# suspend startpage API --> https://github.com/searxng/searxng/pull/695
|
||||
raise SearxEngineResponseException(
|
||||
|
|
Loading…
Reference in New Issue