diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 93ae4a57..8512a38f 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -787,6 +787,12 @@ Consider all listed sites to potentially be NSFW. Galleries + + Picazor + https://picazor.com/ + User Profiles + + Pictoa https://pictoa.com/ diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 3cb29fad..638320a6 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -155,6 +155,7 @@ modules = [ "philomena", "photovogue", "picarto", + "picazor", "pictoa", "piczel", "pillowfort", diff --git a/gallery_dl/extractor/picazor.py b/gallery_dl/extractor/picazor.py new file mode 100644 index 00000000..df1f4369 --- /dev/null +++ b/gallery_dl/extractor/picazor.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +"""Extractors for https://picazor.com/""" + +from .common import Extractor, Message +from .. import text + + +class PicazorUserExtractor(Extractor): + """Extractor for picazor users""" + category = "picazor" + subcategory = "user" + root = "https://picazor.com" + browser = "firefox" + directory_fmt = ("{category}", "{user}") + filename_fmt = "{id}_{num:>03}.{extension}" + archive_fmt = "{id}_{num}" + pattern = r"(?:https?://)?(?:www\.)?picazor\.com/[a-z]{2}/([^/?#]+)" + example = "https://picazor.com/en/USERNAME" + + def items(self): + user = self.groups[0] + first = True + + url = f"{self.root}/api/files/{user}/sfiles" + params = {"page": 1} + headers = {"Referer": f"{self.root}/en/{user}"} + + while True: + data = self.request_json(url, params=params, headers=headers) + if not data: + break + + for item in data: + path = item.get("path") + if not path: + continue + + if first: + first = False + self.kwdict["user"] = user + self.kwdict["count"] = item.get("order") + yield Message.Directory, "", { + "subject": item.get("subject"), + "user" : user, + } + + item.pop("blurDataURL", None) + item["num"] = item["order"] + + file_url = self.root + path + text.nameext_from_url(file_url, item) + yield Message.Url, file_url, item + + params["page"] += 1 diff --git a/test/results/picazor.py b/test/results/picazor.py new file mode 100644 index 00000000..04664469 --- /dev/null +++ b/test/results/picazor.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +from gallery_dl.extractor import picazor + + +__tests__ = ( +{ + "#url" : "https://picazor.com/en/kailey-mae", + "#class" : picazor.PicazorUserExtractor, + "#range" : "1-50", + "#pattern" : r"https://picazor\.com/uploads/.+\.jpg", + "#count" : 50, + + "count" : 278, + "num" : range(200, 278), + "extension": "jpg", + "filename" : str, + "id" : "re:[0-9a-f]+", + "mime" : "photo", + "path" : str, + "user" : "kailey-mae", + "visible" : True, + "subject" : { + "id" : "66077ba2b64e3f3d178f39ac", + "uri": "kailey-mae", + }, +}, + +{ + "#url" : "https://picazor.com/vi/badassnugget", + "#comment" : "non-'en' language code", + "#class" : picazor.PicazorUserExtractor, +}, + +)