Skip to content

Commit

Permalink
[danbooru] add 'external' option (closes #1747)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Aug 8, 2021
1 parent 5b1c62b commit cadfad4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
23 changes: 17 additions & 6 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -806,17 +806,15 @@ Description
Download embedded videos hosted on https://www.blogger.com/


extractor.danbooru.ugoira
-------------------------
extractor.danbooru.external
---------------------------
Type
``bool``
Default
``false``
Description
Controls the download target for Ugoira posts.

* ``true``: Original ZIP archives
* ``false``: Converted video files
For unavailable or restricted posts,
follow the ``source`` and download from there if possible.


extractor.danbooru.metadata
Expand All @@ -831,6 +829,19 @@ Description
Note: This requires 1 additional HTTP request for each post.


extractor.danbooru.ugoira
-------------------------
Type
``bool``
Default
``false``
Description
Controls the download target for Ugoira posts.

* ``true``: Original ZIP archives
* ``false``: Converted video files


extractor.derpibooru.api-key
----------------------------
Type
Expand Down
5 changes: 3 additions & 2 deletions docs/gallery-dl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@
{
"username": null,
"password": null,
"ugoira": false,
"metadata": false
"external": false,
"metadata": false,
"ugoira": false
},
"derpibooru":
{
Expand Down
10 changes: 10 additions & 0 deletions gallery_dl/extractor/danbooru.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(self, match):
super().__init__(match)
self.root = "https://{}.donmai.us".format(match.group(1))
self.ugoira = self.config("ugoira", False)
self.external = self.config("external", False)
self.extended_metadata = self.config("metadata", False)

username, api_key = self._get_auth_info()
Expand All @@ -52,6 +53,10 @@ def items(self):
try:
url = post["file_url"]
except KeyError:
if self.external and post["source"]:
post.update(data)
yield Message.Directory, post
yield Message.Queue, post["source"], post
continue

text.nameext_from_url(url, post)
Expand Down Expand Up @@ -126,6 +131,11 @@ class DanbooruTagExtractor(DanbooruExtractor):
("https://danbooru.donmai.us/posts?tags=mushishi", {
"count": ">= 300",
}),
# 'external' option (#1747)
("https://danbooru.donmai.us/posts?tags=pixiv_id%3A1476533", {
"options": (("external", True),),
"pattern": r"http://img16.pixiv.net/img/takaraakihito/1476533.jpg",
}),
("https://hijiribe.donmai.us/posts?tags=bonocho"),
("https://sonohara.donmai.us/posts?tags=bonocho"),
("https://safebooru.donmai.us/posts?tags=bonocho"),
Expand Down

0 comments on commit cadfad4

Please sign in to comment.