Skip to content

Commit

Permalink
[sexcom] add extractor for related pins (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jul 3, 2019
1 parent 69997e9 commit b4da8c5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/supportedsites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 21 additions & 2 deletions gallery_dl/extractor/sexcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/", {
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit b4da8c5

Please sign in to comment.