forked from zaclys/searxng
Merge pull request #2430 from return42/fix-2419-ddg
[fix] engine ddg: minor change in the API of ddg
This commit is contained in:
commit
19ce3d88ce
|
@ -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