From 7fe0f35998e9b31efde4fc3d0ea3e3ad327d46c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 6 Sep 2024 07:44:06 +0200 Subject: [PATCH] [sexcom] add 'likes' extractor (#6149) --- docs/supportedsites.md | 2 +- gallery_dl/extractor/sexcom.py | 19 +++++++++++++++++++ test/results/sexcom.py | 12 ++++++++++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 2790476f..1aa707c7 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -790,7 +790,7 @@ Consider all listed sites to potentially be NSFW. Sex.com https://www.sex.com/ - Boards, Pins, User Pins, related Pins, Search Results + Boards, Likes, Pins, User Pins, related Pins, Search Results diff --git a/gallery_dl/extractor/sexcom.py b/gallery_dl/extractor/sexcom.py index 80f2aea5..7708b5cb 100644 --- a/gallery_dl/extractor/sexcom.py +++ b/gallery_dl/extractor/sexcom.py @@ -152,6 +152,25 @@ class SexcomPinsExtractor(SexcomExtractor): 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" diff --git a/test/results/sexcom.py b/test/results/sexcom.py index 2f212904..e51f801c 100644 --- a/test/results/sexcom.py +++ b/test/results/sexcom.py @@ -67,14 +67,22 @@ __tests__ = ( "#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", }, {