[danbooru] add 'ugoira' option (#406)
to choose between ZIP archives or converted video files for Ugoira posts
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
## 1.10.3 - 2019-08-30
|
## 1.10.3 - 2019-08-30
|
||||||
### Additions
|
### 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))
|
- 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
|
extractor.deviantart.extra
|
||||||
--------------------------
|
--------------------------
|
||||||
=========== =====
|
=========== =====
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
"danbooru":
|
"danbooru":
|
||||||
{
|
{
|
||||||
"username": null,
|
"username": null,
|
||||||
"password": null
|
"password": null,
|
||||||
|
"ugoira": true
|
||||||
},
|
},
|
||||||
"deviantart":
|
"deviantart":
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class BooruExtractor(SharedConfigMixin, Extractor):
|
|||||||
page_start = 1
|
page_start = 1
|
||||||
page_limit = None
|
page_limit = None
|
||||||
sort = False
|
sort = False
|
||||||
|
ugoira = True
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
super().__init__(match)
|
super().__init__(match)
|
||||||
@@ -51,7 +52,11 @@ class BooruExtractor(SharedConfigMixin, Extractor):
|
|||||||
|
|
||||||
for image in images:
|
for image in images:
|
||||||
try:
|
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:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
if url.startswith("/"):
|
if url.startswith("/"):
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class DanbooruExtractor(booru.DanbooruPageMixin, booru.BooruExtractor):
|
|||||||
self.scheme = "https" if self.subdomain == "danbooru" else "http"
|
self.scheme = "https" if self.subdomain == "danbooru" else "http"
|
||||||
self.api_url = "{scheme}://{subdomain}.donmai.us/posts.json".format(
|
self.api_url = "{scheme}://{subdomain}.donmai.us/posts.json".format(
|
||||||
scheme=self.scheme, subdomain=self.subdomain)
|
scheme=self.scheme, subdomain=self.subdomain)
|
||||||
|
self.ugoira = self.config("ugoira", True)
|
||||||
|
|
||||||
username, api_key = self._get_auth_info()
|
username, api_key = self._get_auth_info()
|
||||||
if username:
|
if username:
|
||||||
@@ -63,9 +64,15 @@ class DanbooruPoolExtractor(booru.PoolMixin, DanbooruExtractor):
|
|||||||
class DanbooruPostExtractor(booru.PostMixin, DanbooruExtractor):
|
class DanbooruPostExtractor(booru.PostMixin, DanbooruExtractor):
|
||||||
"""Extractor for single images from danbooru"""
|
"""Extractor for single images from danbooru"""
|
||||||
pattern = BASE_PATTERN + r"/posts/(?P<post>\d+)"
|
pattern = BASE_PATTERN + r"/posts/(?P<post>\d+)"
|
||||||
test = ("https://danbooru.donmai.us/posts/294929", {
|
test = (
|
||||||
"content": "5e255713cbf0a8e0801dc423563c34d896bb9229",
|
("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):
|
class DanbooruPopularExtractor(booru.PopularMixin, DanbooruExtractor):
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
# it under the terms of the GNU General Public License version 2 as
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
# published by the Free Software Foundation.
|
# published by the Free Software Foundation.
|
||||||
|
|
||||||
__version__ = "1.10.3"
|
__version__ = "1.10.4-dev"
|
||||||
|
|||||||
Reference in New Issue
Block a user