mirror of
https://github.com/searx/searx
synced 2024-12-11 16:35:20 +01:00
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)
|
dom = html.fromstring(resp.text)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# href --> '/?sc=adrKJMgF8xwp20'
|
href = eval_xpath(dom, '//input[@name="sc"]')[0].get('value')
|
||||||
href = eval_xpath(dom, '//a[@class="footer-home__logo"]')[0].get('href')
|
|
||||||
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(
|
||||||
|
Loading…
Reference in New Issue
Block a user