diff options
| author | 2025-01-28 19:12:16 -0500 | |
|---|---|---|
| committer | 2025-01-28 19:12:16 -0500 | |
| commit | 5a7d8217a6edc66e3cf25ca0eee6614a10fa866c (patch) | |
| tree | a941825bf5fcf706f23b49e536edb9a2b26d5b6c /gallery_dl/extractor/pornpics.py | |
| parent | e8f1b0d968a07cba884462e10718628394d1bae5 (diff) | |
| parent | a26df18796ff4e506b16bf32fcec9336233b9e2e (diff) | |
Update upstream source from tag 'upstream/1.28.5'
Update to upstream version '1.28.5'
with Debian dir a2e4b8ba663c03c37256ad2b059b382999e473bc
Diffstat (limited to 'gallery_dl/extractor/pornpics.py')
| -rw-r--r-- | gallery_dl/extractor/pornpics.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/gallery_dl/extractor/pornpics.py b/gallery_dl/extractor/pornpics.py index 83f3064..863ef3b 100644 --- a/gallery_dl/extractor/pornpics.py +++ b/gallery_dl/extractor/pornpics.py @@ -20,10 +20,6 @@ class PornpicsExtractor(Extractor): root = "https://www.pornpics.com" request_interval = (0.5, 1.5) - def __init__(self, match): - super().__init__(match) - self.item = match.group(1) - def items(self): for gallery in self.galleries(): gallery["_extractor"] = PornpicsGalleryExtractor @@ -34,9 +30,11 @@ class PornpicsExtractor(Extractor): # fetch first 20 galleries from HTML # since '"offset": 0' does not return a JSON response page = self.request(url).text - for path in text.extract_iter( + for href in text.extract_iter( page, 'class="rel-link" href="', '"'): - yield {"g_url": self.root + path} + if href[0] == "/": + href = self.root + href + yield {"g_url": href} del page params = {"offset": 20} @@ -60,12 +58,12 @@ class PornpicsExtractor(Extractor): class PornpicsGalleryExtractor(PornpicsExtractor, GalleryExtractor): """Extractor for pornpics galleries""" - pattern = BASE_PATTERN + r"(/galleries/(?:[^/?#]+-)?(\d+))" + pattern = BASE_PATTERN + r"/galleries/((?:[^/?#]+-)?(\d+))" example = "https://www.pornpics.com/galleries/TITLE-12345/" def __init__(self, match): - PornpicsExtractor.__init__(self, match) - self.gallery_id = match.group(2) + url = "{}/galleries/{}/".format(self.root, match.group(1)) + GalleryExtractor.__init__(self, match, url) items = GalleryExtractor.items @@ -73,7 +71,7 @@ class PornpicsGalleryExtractor(PornpicsExtractor, GalleryExtractor): extr = text.extract_from(page) return { - "gallery_id": text.parse_int(self.gallery_id), + "gallery_id": text.parse_int(self.groups[1]), "slug" : extr("/galleries/", "/").rpartition("-")[0], "title" : text.unescape(extr("<h1>", "<")), "channel" : text.split_html(extr(">Channel: ", '</div>')), @@ -100,7 +98,7 @@ class PornpicsTagExtractor(PornpicsExtractor): example = "https://www.pornpics.com/tags/TAGS/" def galleries(self): - url = "{}/tags/{}/".format(self.root, self.item) + url = "{}/tags/{}/".format(self.root, self.groups[0]) return self._pagination(url) @@ -113,7 +111,7 @@ class PornpicsSearchExtractor(PornpicsExtractor): def galleries(self): url = self.root + "/search/srch.php" params = { - "q" : self.item.replace("-", " "), + "q" : self.groups[0].replace("-", " "), "lang" : "en", "offset": 0, } |
