1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[danbooru] add single image/post extractor

This commit is contained in:
Mike Fährmann 2015-11-20 20:25:31 +01:00
parent ee1ba22d05
commit 205ef3ca02
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -60,3 +60,21 @@ class DanbooruPoolExtractor(JSONBooruExtractor):
"category": self.info["category"],
"pool": self.pool,
}
class DanbooruPostExtractor(JSONBooruExtractor):
"""Extract single images"""
info = {
"category": "danbooru",
"directory": ["{category}"],
"filename": "{category}_{id}_{md5}.{extension}",
}
pattern = [
r"(?:https?://)?(?:www\.)?danbooru.donmai.us/posts/(\d+)",
]
def __init__(self, match):
JSONBooruExtractor.__init__(self)
self.api_url = "https://danbooru.donmai.us/posts.json"
self.post = match.group(1)
self.params = {"tags": "id:" + self.post}