From b8b943fc38e6d159db764ec8a4c80ffefc623a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 22 Nov 2024 08:41:10 +0100 Subject: [PATCH] [pinterest] update API headers (#6513) 'BoardFeed' requests fail without 'X-Pinterest-PWS-Handler' --- gallery_dl/extractor/pinterest.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/gallery_dl/extractor/pinterest.py b/gallery_dl/extractor/pinterest.py index 061b302a..121c7bf3 100644 --- a/gallery_dl/extractor/pinterest.py +++ b/gallery_dl/extractor/pinterest.py @@ -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):