diff --git a/docs/supportedsites.rst b/docs/supportedsites.rst index c46ab0fbfe..96318a4e70 100644 --- a/docs/supportedsites.rst +++ b/docs/supportedsites.rst @@ -94,7 +94,7 @@ Sankaku Channel https://chan.sankakucomplex.com/ Pools, Posts, Tag-Searc Sankaku Complex https://www.sankakucomplex.com/ Articles, Tag-Searches Sen Manga https://raw.senmanga.com/ Chapters Sense-Scans http://sensescans.com/reader/ Chapters, Manga -Sex.com https://www.sex.com/ Boards, Pins, Search Results +Sex.com https://www.sex.com/ Boards, Pins, related Pins, Search Results Simply Hentai https://www.simply-hentai.com/ Galleries, individual Images, Videos SlickPic https://www.slickpic.com/ Images from Users, Albums SlideShare https://www.slideshare.net/ Presentations diff --git a/gallery_dl/extractor/sexcom.py b/gallery_dl/extractor/sexcom.py index d6d9bfe6c8..9eb926cbad 100644 --- a/gallery_dl/extractor/sexcom.py +++ b/gallery_dl/extractor/sexcom.py @@ -93,10 +93,10 @@ def _parse_pin(self, url, expect=range(400, 429)): class SexcomPinExtractor(SexcomExtractor): - """Extractor a pinned image or video on www.sex.com""" + """Extractor for a pinned image or video on www.sex.com""" subcategory = "pin" directory_fmt = ("{category}",) - pattern = r"(?:https?://)?(?:www\.)?sex\.com/pin/(\d+)" + pattern = r"(?:https?://)?(?:www\.)?sex\.com/pin/(\d+)(?!.*#related$)" test = ( # picture ("https://www.sex.com/pin/56714360/", { @@ -143,6 +143,25 @@ def pins(self): return ("{}/pin/{}/".format(self.root, self.pin_id),) +class SexcomRelatedPinExtractor(SexcomPinExtractor): + """Extractor for related pins on www.sex.com""" + subcategory = "related-pin" + directory_fmt = ("{category}", "related {original_pin[pin_id]}") + pattern = r"(?:https?://)?(?:www\.)?sex\.com/pin/(\d+).*#related$" + test = ("https://www.sex.com/pin/56714360/#related", { + "count": 24, + }) + + def metadata(self): + pin = self._parse_pin(SexcomPinExtractor.pins(self)[0]) + return {"original_pin": pin} + + def pins(self): + url = "{}/pin/related?pinId={}&limit=24&offset=0".format( + self.root, self.pin_id) + return self._pagination(url) + + class SexcomBoardExtractor(SexcomExtractor): """Extractor for pins from a board on www.sex.com""" subcategory = "board"