mirror of
https://github.com/searxng/searxng.git
synced 2024-11-19 02:40:11 +01:00
[fix] engine ddg: minor change in the API of ddg
Closes: https://github.com/searxng/searxng/issues/2419 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
cb1c3741d7
commit
caebd297e9
@ -94,12 +94,12 @@ def get_vqd(query, headers):
|
|||||||
logger.debug("re-use cached vqd value: %s", value)
|
logger.debug("re-use cached vqd value: %s", value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
query_url = 'https://duckduckgo.com/?{query}&iar=images'.format(query=urlencode({'q': query}))
|
query_url = 'https://duckduckgo.com/?q={query}&atb=v290-5'.format(query=urlencode({'q': query}))
|
||||||
res = network.get(query_url, headers=headers)
|
res = network.get(query_url, headers=headers)
|
||||||
content = res.text
|
content = res.text
|
||||||
if content.find('vqd=\'') == -1:
|
if content.find('vqd=\"') == -1:
|
||||||
raise SearxEngineAPIException('Request failed')
|
raise SearxEngineAPIException('Request failed')
|
||||||
value = content[content.find('vqd=\'') + 5 :]
|
value = content[content.find('vqd=\"') + 5 :]
|
||||||
value = value[: value.find('\'')]
|
value = value[: value.find('\'')]
|
||||||
logger.debug("new vqd value: %s", value)
|
logger.debug("new vqd value: %s", value)
|
||||||
cache_vqd(query, value)
|
cache_vqd(query, value)
|
||||||
|
Loading…
Reference in New Issue
Block a user