[pinterest] support generic user URLs (#1205)

i.e. https://www.pinterest.com/USERNAME

also renames 'BoardsExtractor' to 'UserExtractor'
This commit is contained in:
Mike Fährmann
2021-01-02 02:36:53 +01:00
parent 56b460dcea
commit 8a88025dc4
2 changed files with 13 additions and 9 deletions

View File

@@ -168,14 +168,17 @@ class PinterestBoardExtractor(PinterestExtractor):
return self.api.board_pins(board["id"])
class PinterestBoardsExtractor(PinterestExtractor):
"""Extractor for a user's boards """
subcategory = "boards"
pattern = BASE_PATTERN + r"/(?!pin/)([^/?#&]+)/_saved/?$"
test = ("https://www.pinterest.de/g1952849/_saved/", {
"pattern": PinterestBoardExtractor.pattern,
"count": ">= 2",
})
class PinterestUserExtractor(PinterestExtractor):
"""Extractor for a user's boards"""
subcategory = "user"
pattern = BASE_PATTERN + r"/(?!pin/)([^/?#&]+)(?:/_saved)?/?$"
test = (
("https://www.pinterest.de/g1952849/", {
"pattern": PinterestBoardExtractor.pattern,
"count": ">= 2",
}),
("https://www.pinterest.de/g1952849/_saved/"),
)
def __init__(self, match):
PinterestExtractor.__init__(self, match)