[pinterest] support 'pin.it' board redirects (#7805)

This commit is contained in:
Mike Fährmann
2025-07-11 19:07:01 +02:00
parent 8e40ea2fe2
commit 2ccb9acf1a
2 changed files with 17 additions and 3 deletions

View File

@@ -396,9 +396,16 @@ class PinterestPinitExtractor(PinterestExtractor):
url = (f"https://api.pinterest.com/url_shortener"
f"/{self.groups[0]}/redirect/")
location = self.request_location(url)
if not location or not PinterestPinExtractor.pattern.match(location):
if not location:
raise exception.NotFoundError("pin")
elif PinterestPinExtractor.pattern.match(location):
yield Message.Queue, location, {
"_extractor": PinterestPinExtractor}
elif PinterestBoardExtractor.pattern.match(location):
yield Message.Queue, location, {
"_extractor": PinterestBoardExtractor}
else:
raise exception.NotFoundError("pin")
yield Message.Queue, location, {"_extractor": PinterestPinExtractor}
class PinterestAPI():