summaryrefslogtreecommitdiff
path: root/searx/engines/bing.py
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2025-10-17 15:43:49 +0200
committerGitHub <noreply@github.com>2025-10-17 15:43:49 +0200
commit1d138c5968c373c58f2c45fbea7fd30e59bb35a8 (patch)
tree1fbcbf5791878eadfc8fb48201c8dc1b1416b2c4 /searx/engines/bing.py
parent3e7e404fda9277dd8fcac4d8a120f25412033f1d (diff)
[mod] bing engine: follow redirects (#5324)
Apparently, in China, Bing redirects from `www.bing.com` to `cn.bing.com`. So in order to make Bing work for chinese users by default, we have to follow that redirect. related: https://github.com/searxng/searxng/issues/5243
Diffstat (limited to 'searx/engines/bing.py')
-rw-r--r--searx/engines/bing.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/searx/engines/bing.py b/searx/engines/bing.py
index 3a3112d28..a359ccdfd 100644
--- a/searx/engines/bing.py
+++ b/searx/engines/bing.py
@@ -108,6 +108,10 @@ def request(query, params):
time_ranges = {'day': '1', 'week': '2', 'month': '3', 'year': f'5_{unix_day-365}_{unix_day}'}
params['url'] += f'&filters=ex1:"ez{time_ranges[params["time_range"]]}"'
+ # in some regions where geoblocking is employed (e.g. China),
+ # www.bing.com redirects to the regional version of Bing
+ params['allow_redirects'] = True
+
return params