mirror of https://github.com/searxng/searxng.git
Compare commits
1 Commits
127b98482c
...
35cc4726be
Author | SHA1 | Date |
---|---|---|
Markus Heiser | 35cc4726be |
|
@ -6,7 +6,7 @@ DuckDuckGo Lite
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
import re
|
import re
|
||||||
from urllib.parse import urlencode, quote_plus
|
from urllib.parse import urlencode
|
||||||
import json
|
import json
|
||||||
import babel
|
import babel
|
||||||
import lxml.html
|
import lxml.html
|
||||||
|
@ -245,12 +245,10 @@ def request(query, params):
|
||||||
|
|
||||||
# Advanced search syntax ends in CAPTCHA
|
# Advanced search syntax ends in CAPTCHA
|
||||||
# https://duckduckgo.com/duckduckgo-help-pages/results/syntax/
|
# https://duckduckgo.com/duckduckgo-help-pages/results/syntax/
|
||||||
query = " ".join(
|
query = [
|
||||||
[
|
x.removeprefix("site:").removeprefix("intitle:").removeprefix("inurl:").removeprefix("filetype:")
|
||||||
x.removeprefix("site:").removeprefix("intitle:").removeprefix("inurl:").removeprefix("filetype:")
|
for x in query.split()
|
||||||
for x in query.split()
|
]
|
||||||
]
|
|
||||||
)
|
|
||||||
eng_region = traits.get_region(params['searxng_locale'], traits.all_locale)
|
eng_region = traits.get_region(params['searxng_locale'], traits.all_locale)
|
||||||
if eng_region == "wt-wt":
|
if eng_region == "wt-wt":
|
||||||
# https://html.duckduckgo.com/html sets an empty value for "all".
|
# https://html.duckduckgo.com/html sets an empty value for "all".
|
||||||
|
@ -263,7 +261,7 @@ def request(query, params):
|
||||||
|
|
||||||
params['url'] = url
|
params['url'] = url
|
||||||
params['method'] = 'POST'
|
params['method'] = 'POST'
|
||||||
params['data']['q'] = quote_plus(query)
|
params['data']['q'] = query
|
||||||
|
|
||||||
# The API is not documented, so we do some reverse engineering and emulate
|
# The API is not documented, so we do some reverse engineering and emulate
|
||||||
# what https://html.duckduckgo.com/html does when you press "next Page" link
|
# what https://html.duckduckgo.com/html does when you press "next Page" link
|
||||||
|
|
Loading…
Reference in New Issue