summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2025-05-21 15:22:42 +0200
committerGitHub <noreply@github.com>2025-05-21 15:22:42 +0200
commit502017b9017da3e93b9786e830b6b3ac7f9c2049 (patch)
treeb315a7c92a707842a94014a1aa9b71af19e96884
parent88973f5431898665c7ad992669973dc1f62f0862 (diff)
[fix] pinterest: engine broken due to API changes (#4816)
- apparently the API now requires a `X-Pinterest-PWS-Handler` in order to properly function (extracted from their web UI) - the other `X-Pinterest` headers here are added in case they become mandatory too Closes: https://github.com/searxng/searxng/issues/4812
-rw-r--r--searx/engines/pinterest.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/searx/engines/pinterest.py b/searx/engines/pinterest.py
index 841b98ba0..924926677 100644
--- a/searx/engines/pinterest.py
+++ b/searx/engines/pinterest.py
@@ -1,6 +1,5 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
-"""Pinterest (images)
-"""
+"""Pinterest (images)"""
from json import dumps
@@ -28,6 +27,11 @@ def request(query, params):
'context': {},
}
params['url'] = f"{base_url}/resource/BaseSearchResource/get/?data={dumps(args)}"
+ params['headers'] = {
+ 'X-Pinterest-AppState': 'active',
+ 'X-Pinterest-Source-Url': '/ideas/',
+ 'X-Pinterest-PWS-Handler': 'www/ideas.js',
+ }
return params