Merge pull request #2430 from return42/fix-2419-ddg

[fix] engine ddg: minor change in the API of ddg
This commit is contained in:
Markus Heiser 2023-05-13 05:55:33 +02:00 committed by GitHub
commit 19ce3d88ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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)