[danbooru] add 'ugoira' option (#406)

to choose between ZIP archives or converted video files
for Ugoira posts
deviantart-rewrite
Mike Fährmann 5 years ago
parent 9646ccb320
commit f02a768b5c
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -1,5 +1,7 @@
# Changelog
## Unreleased
## 1.10.3 - 2019-08-30
### Additions
- Provide `filename` metadata for all `deviantart` files ([#392](https://github.com/mikf/gallery-dl/issues/392), [#400](https://github.com/mikf/gallery-dl/issues/400))

@ -486,6 +486,18 @@ Description Try to follow external URLs of embedded players.
=========== =====
extractor.danbooru.ugoira
-------------------------
=========== =====
Type ``bool``
Default ``true``
Description Controls the download target for Ugoira posts.
* ``true``: Original ZIP archives
* ``false``: Converted video files
=========== =====
extractor.deviantart.extra
--------------------------
=========== =====

@ -19,7 +19,8 @@
"danbooru":
{
"username": null,
"password": null
"password": null,
"ugoira": true
},
"deviantart":
{

@ -27,6 +27,7 @@ class BooruExtractor(SharedConfigMixin, Extractor):
page_start = 1
page_limit = None
sort = False
ugoira = True
def __init__(self, match):
super().__init__(match)
@ -51,7 +52,11 @@ class BooruExtractor(SharedConfigMixin, Extractor):
for image in images:
try:
url = image["file_url"]
if "pixiv_ugoira_frame_data" in image and \
"large_file_url" in image and not self.ugoira:
url = image["large_file_url"]
else:
url = image["file_url"]
except KeyError:
continue
if url.startswith("/"):

@ -28,6 +28,7 @@ class DanbooruExtractor(booru.DanbooruPageMixin, booru.BooruExtractor):
self.scheme = "https" if self.subdomain == "danbooru" else "http"
self.api_url = "{scheme}://{subdomain}.donmai.us/posts.json".format(
scheme=self.scheme, subdomain=self.subdomain)
self.ugoira = self.config("ugoira", True)
username, api_key = self._get_auth_info()
if username:
@ -63,9 +64,15 @@ class DanbooruPoolExtractor(booru.PoolMixin, DanbooruExtractor):
class DanbooruPostExtractor(booru.PostMixin, DanbooruExtractor):
"""Extractor for single images from danbooru"""
pattern = BASE_PATTERN + r"/posts/(?P<post>\d+)"
test = ("https://danbooru.donmai.us/posts/294929", {
"content": "5e255713cbf0a8e0801dc423563c34d896bb9229",
})
test = (
("https://danbooru.donmai.us/posts/294929", {
"content": "5e255713cbf0a8e0801dc423563c34d896bb9229",
}),
("https://danbooru.donmai.us/posts/3613024", {
"pattern": r"https?://.+\.webm$",
"options": (("ugoira", False),)
})
)
class DanbooruPopularExtractor(booru.PopularMixin, DanbooruExtractor):

@ -6,4 +6,4 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
__version__ = "1.10.3"
__version__ = "1.10.4-dev"

Loading…
Cancel
Save