summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/danbooru.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2020-03-28 23:01:51 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2020-03-28 23:01:51 -0400
commite4887ae6b00c50fbbde531cc274c77b076bd821d (patch)
tree051849d0ce8ed35aa229ba828a2dfe1faf10c5c0 /gallery_dl/extractor/danbooru.py
parente8cc000750de972384f2f34d02d42222b4018ae9 (diff)
New upstream version 1.13.3upstream/1.13.3
Diffstat (limited to 'gallery_dl/extractor/danbooru.py')
-rw-r--r--gallery_dl/extractor/danbooru.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/gallery_dl/extractor/danbooru.py b/gallery_dl/extractor/danbooru.py
index 3fdeaf9..3a0d0ef 100644
--- a/gallery_dl/extractor/danbooru.py
+++ b/gallery_dl/extractor/danbooru.py
@@ -27,10 +27,10 @@ class DanbooruExtractor(SharedConfigMixin, Extractor):
filename_fmt = "{category}_{id}_{md5}.{extension}"
page_limit = 1000
page_start = None
- per_page = 100
+ per_page = 200
def __init__(self, match):
- Extractor.__init__(self, match)
+ super().__init__(match)
self.root = "https://{}.donmai.us".format(match.group(1))
self.ugoira = self.config("ugoira", True)
self.params = {}
@@ -83,6 +83,8 @@ class DanbooruExtractor(SharedConfigMixin, Extractor):
while True:
posts = self.request(url, params=params).json()
+ if "posts" in posts:
+ posts = posts["posts"]
yield from posts
if len(posts) < self.per_page:
@@ -114,7 +116,7 @@ class DanbooruTagExtractor(DanbooruExtractor):
)
def __init__(self, match):
- DanbooruExtractor.__init__(self, match)
+ super().__init__(match)
self.params["tags"] = text.unquote(match.group(2).replace("+", " "))
def metadata(self):
@@ -132,7 +134,7 @@ class DanbooruPoolExtractor(DanbooruExtractor):
})
def __init__(self, match):
- DanbooruExtractor.__init__(self, match)
+ super().__init__(match)
self.pool_id = match.group(2)
self.params["tags"] = "pool:" + self.pool_id
@@ -160,12 +162,13 @@ class DanbooruPostExtractor(DanbooruExtractor):
)
def __init__(self, match):
- DanbooruExtractor.__init__(self, match)
+ super().__init__(match)
self.post_id = match.group(2)
def posts(self):
url = "{}/posts/{}.json".format(self.root, self.post_id)
- return (self.request(url).json(),)
+ post = self.request(url).json()
+ return (post["post"] if "post" in post else post,)
class DanbooruPopularExtractor(DanbooruExtractor):
@@ -184,7 +187,7 @@ class DanbooruPopularExtractor(DanbooruExtractor):
)
def __init__(self, match):
- DanbooruExtractor.__init__(self, match)
+ super().__init__(match)
self.params.update(text.parse_query(match.group(2)))
def metadata(self):