mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
[patreon] add explicit 'image_large' file type (#2257)
to allow more control over when and if to download 'large_url' images
4fee3a0e52
forced them to be downloaded
instead of regular images, even though 'large_url' images are most likely
an upscaled version of the original.
This commit is contained in:
parent
6ea3ff5173
commit
bfa5e61900
@ -1661,12 +1661,12 @@ extractor.patreon.files
|
||||
Type
|
||||
``list`` of ``strings``
|
||||
Default
|
||||
``["images", "attachments", "postfile", "content"]``
|
||||
``["images", "image_large", "attachments", "postfile", "content"]``
|
||||
Description
|
||||
Determines the type and order of files to be downloaded.
|
||||
|
||||
Available types are
|
||||
``postfile``, ``images``, ``attachments``, and ``content``.
|
||||
``postfile``, ``images``, ``image_large``, ``attachments``, and ``content``.
|
||||
|
||||
|
||||
extractor.photobucket.subalbums
|
||||
|
@ -65,18 +65,21 @@ class PatreonExtractor(Extractor):
|
||||
return ()
|
||||
|
||||
def _images(self, post):
|
||||
image = post.get("image")
|
||||
if image:
|
||||
url = image.get("large_url") or image["url"]
|
||||
name = image.get("file_name") or self._filename(url) or url
|
||||
yield "image", url, name
|
||||
|
||||
for image in post["images"]:
|
||||
url = image.get("download_url")
|
||||
if url:
|
||||
name = image.get("file_name") or self._filename(url) or url
|
||||
yield "image", url, name
|
||||
|
||||
def _image_large(self, post):
|
||||
image = post.get("image")
|
||||
if image:
|
||||
url = image.get("large_url")
|
||||
if url:
|
||||
name = image.get("file_name") or self._filename(url) or url
|
||||
return (("image_large", url, name),)
|
||||
return ()
|
||||
|
||||
def _attachments(self, post):
|
||||
for attachment in post["attachments"]:
|
||||
url = self.request(
|
||||
@ -218,10 +221,11 @@ class PatreonExtractor(Extractor):
|
||||
|
||||
def _build_file_generators(self, filetypes):
|
||||
if filetypes is None:
|
||||
return (self._images, self._attachments,
|
||||
self._postfile, self._content)
|
||||
return (self._images, self._image_large,
|
||||
self._attachments, self._postfile, self._content)
|
||||
genmap = {
|
||||
"images" : self._images,
|
||||
"image_large": self._image_large,
|
||||
"attachments": self._attachments,
|
||||
"postfile" : self._postfile,
|
||||
"content" : self._content,
|
||||
|
Loading…
Reference in New Issue
Block a user