[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
This commit is contained in:
Bnyro 2025-05-21 15:22:42 +02:00 committed by GitHub
parent 88973f5431
commit 502017b901
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,5 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
"""Pinterest (images) """Pinterest (images)"""
"""
from json import dumps from json import dumps
@ -28,6 +27,11 @@ def request(query, params):
'context': {}, 'context': {},
} }
params['url'] = f"{base_url}/resource/BaseSearchResource/get/?data={dumps(args)}" 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 return params