summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/picazor.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-12-20 05:49:04 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2025-12-20 05:49:04 -0500
commita24ec1647aeac35a63b744ea856011ad6e06be3b (patch)
treeae94416de786aeddd05d99559098f7f16bb103a6 /gallery_dl/extractor/picazor.py
parent33f8a8a37a9cba738ef25fb99955f0730da9eb48 (diff)
New upstream version 1.31.1.upstream/1.31.1
Diffstat (limited to 'gallery_dl/extractor/picazor.py')
-rw-r--r--gallery_dl/extractor/picazor.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/gallery_dl/extractor/picazor.py b/gallery_dl/extractor/picazor.py
new file mode 100644
index 0000000..df1f436
--- /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