forked from Ponysearch/Ponysearch
Merge pull request #1860 from dalf/fix-startpage
[fix] startpage engine
This commit is contained in:
commit
1a5b096578
1 changed files with 2 additions and 3 deletions
|
@ -89,15 +89,14 @@ def get_sc_code(headers):
|
||||||
dom = html.fromstring(resp.text)
|
dom = html.fromstring(resp.text)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# href --> '/?sc=adrKJMgF8xwp20'
|
# <input type="hidden" name="sc" value="...">
|
||||||
href = eval_xpath(dom, '//a[@class="footer-home__logo"]')[0].get('href')
|
sc_code = eval_xpath(dom, '//input[@name="sc"]/@value')[0]
|
||||||
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 a new issue