[pinterest] update API headers (#6513)

'BoardFeed' requests fail without 'X-Pinterest-PWS-Handler'
This commit is contained in:
Mike Fährmann
2024-11-22 08:41:10 +01:00
parent ededba8087
commit b8b943fc38

View File

@@ -405,14 +405,19 @@ class PinterestAPI():
self.root = extractor.root
self.cookies = {"csrftoken": csrf_token}
self.headers = {
"Accept" : "application/json, text/javascript, "
"*/*, q=0.01",
"Accept-Language" : "en-US,en;q=0.5",
"X-Requested-With" : "XMLHttpRequest",
"X-APP-VERSION" : "0c4af40",
"X-CSRFToken" : csrf_token,
"X-Pinterest-AppState": "active",
"Origin" : self.root,
"Accept" : "application/json, text/javascript, "
"*/*, q=0.01",
"X-Requested-With" : "XMLHttpRequest",
"X-APP-VERSION" : "a89153f",
"X-Pinterest-AppState" : "active",
"X-Pinterest-Source-Url" : None,
"X-Pinterest-PWS-Handler": "www/[username].js",
"Alt-Used" : "www.pinterest.com",
"Connection" : "keep-alive",
"Cookie" : None,
"Sec-Fetch-Dest" : "empty",
"Sec-Fetch-Mode" : "cors",
"Sec-Fetch-Site" : "same-origin",
}
def pin(self, pin_id):
@@ -445,7 +450,12 @@ class PinterestAPI():
def board_pins(self, board_id):
"""Yield all pins of a specific board"""
options = {"board_id": board_id}
options = {
"board_id": board_id,
"field_set_key": "react_grid_pin",
"prepend": False,
"bookmarks": None,
}
return self._pagination("BoardFeed", options)
def board_section(self, section_id):