Skip to content

Commit

Permalink
[sexcom] add 'likes' extractor (mikf#6149)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Sep 6, 2024
1 parent 513fd26 commit 7fe0f35
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ Consider all listed sites to potentially be NSFW.
<tr>
<td>Sex.com</td>
<td>https://www.sex.com/</td>
<td>Boards, Pins, User Pins, related Pins, Search Results</td>
<td>Boards, Likes, Pins, User Pins, related Pins, Search Results</td>
<td></td>
</tr>
<tr>
Expand Down
19 changes: 19 additions & 0 deletions gallery_dl/extractor/sexcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,25 @@ def pins(self):
return self._pagination(url)


class SexcomLikesExtractor(SexcomExtractor):
"""Extractor for a user's liked pins on www.sex.com"""
subcategory = "likes"
directory_fmt = ("{category}", "{user}", "Likes")
pattern = r"(?:https?://)?(?:www\.)?sex\.com/user/([^/?#]+)/likes/"
example = "https://www.sex.com/user/USER/likes/"

def __init__(self, match):
SexcomExtractor.__init__(self, match)
self.user = match.group(1)

def metadata(self):
return {"user": text.unquote(self.user)}

def pins(self):
url = "{}/user/{}/likes/".format(self.root, self.user)
return self._pagination(url)


class SexcomBoardExtractor(SexcomExtractor):
"""Extractor for pins from a board on www.sex.com"""
subcategory = "board"
Expand Down
12 changes: 10 additions & 2 deletions test/results/sexcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,22 @@
"#url" : "https://www.sex.com/user/sirjuan79/pins/",
"#category": ("", "sexcom", "pins"),
"#class" : sexcom.SexcomPinsExtractor,
"#count" : ">= 15",
"#count" : ">= 4",
},

{
"#url" : "https://www.sex.com/user/sirjuan79/likes/",
"#category": ("", "sexcom", "likes"),
"#class" : sexcom.SexcomLikesExtractor,
"#range" : "1-30",
"#count" : ">= 25",
},

{
"#url" : "https://www.sex.com/user/ronin17/exciting-hentai/",
"#category": ("", "sexcom", "board"),
"#class" : sexcom.SexcomBoardExtractor,
"#count" : ">= 15",
"#count" : ">= 10",
},

{
Expand Down

0 comments on commit 7fe0f35

Please sign in to comment.