From b75d158d014d6c43d7d785c46c9372a9cf84d144 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Mon, 26 Aug 2019 19:34:45 -0400 Subject: New upstream version 1.10.2 --- gallery_dl/downloader/http.py | 18 +- gallery_dl/downloader/ytdl.py | 4 +- gallery_dl/extractor/adultempire.py | 8 +- gallery_dl/extractor/artstation.py | 1 + gallery_dl/extractor/booru.py | 8 +- gallery_dl/extractor/common.py | 3 +- gallery_dl/extractor/deviantart.py | 394 +++++++++++++++++++++++------------ gallery_dl/extractor/gelbooru.py | 8 +- gallery_dl/extractor/hitomi.py | 2 +- gallery_dl/extractor/imagebam.py | 6 +- gallery_dl/extractor/imgbb.py | 33 ++- gallery_dl/extractor/imgur.py | 67 ++++-- gallery_dl/extractor/instagram.py | 169 +++++++++++++-- gallery_dl/extractor/luscious.py | 2 +- gallery_dl/extractor/newgrounds.py | 2 +- gallery_dl/extractor/patreon.py | 130 ++++++++---- gallery_dl/extractor/pixiv.py | 20 +- gallery_dl/extractor/pururin.py | 2 +- gallery_dl/extractor/reactor.py | 6 +- gallery_dl/extractor/reddit.py | 2 +- gallery_dl/extractor/sankaku.py | 7 +- gallery_dl/extractor/sexcom.py | 1 + gallery_dl/extractor/simplyhentai.py | 162 +++----------- gallery_dl/extractor/twitter.py | 1 + gallery_dl/extractor/wikiart.py | 2 +- gallery_dl/extractor/xhamster.py | 16 +- gallery_dl/job.py | 20 +- gallery_dl/oauth.py | 2 +- gallery_dl/option.py | 3 +- gallery_dl/postprocessor/classify.py | 23 +- gallery_dl/postprocessor/common.py | 5 +- gallery_dl/postprocessor/metadata.py | 15 +- gallery_dl/postprocessor/mtime.py | 4 +- gallery_dl/postprocessor/ugoira.py | 10 +- gallery_dl/util.py | 179 ++++++++++------ gallery_dl/version.py | 2 +- 36 files changed, 844 insertions(+), 493 deletions(-) (limited to 'gallery_dl') diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index 7a95191..e3229eb 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -26,6 +26,7 @@ class HttpDownloader(DownloaderBase): def __init__(self, extractor, output): DownloaderBase.__init__(self, extractor, output) + self.adjust_extension = self.config("adjust-extensions", True) self.retries = self.config("retries", extractor._retries) self.timeout = self.config("timeout", extractor._timeout) self.verify = self.config("verify", extractor._verify) @@ -59,7 +60,6 @@ class HttpDownloader(DownloaderBase): def _download_impl(self, url, pathfmt): response = None - adj_ext = None tries = 0 msg = "" @@ -103,7 +103,7 @@ class HttpDownloader(DownloaderBase): elif code == 206: # Partial Content offset = filesize size = response.headers["Content-Range"].rpartition("/")[2] - elif code == 416: # Requested Range Not Satisfiable + elif code == 416 and filesize: # Requested Range Not Satisfiable break else: msg = "{}: {} for url: {}".format(code, response.reason, url) @@ -114,7 +114,7 @@ class HttpDownloader(DownloaderBase): size = text.parse_int(size) # set missing filename extension - if not pathfmt.has_extension: + if not pathfmt.extension: pathfmt.set_extension(self.get_extension(response)) if pathfmt.exists(): pathfmt.temppath = "" @@ -152,15 +152,16 @@ class HttpDownloader(DownloaderBase): continue # check filename extension - adj_ext = self.check_extension(file, pathfmt) + if self.adjust_extension: + adj_ext = self.check_extension(file, pathfmt.extension) + if adj_ext: + pathfmt.set_extension(adj_ext) break self.downloading = False - if adj_ext: - pathfmt.set_extension(adj_ext) if self.mtime: - pathfmt.keywords["_mtime"] = response.headers.get("Last-Modified") + pathfmt.kwdict["_mtime"] = response.headers.get("Last-Modified") return True def receive(self, response, file): @@ -196,9 +197,8 @@ class HttpDownloader(DownloaderBase): return "txt" @staticmethod - def check_extension(file, pathfmt): + def check_extension(file, extension): """Check filename extension against fileheader""" - extension = pathfmt.keywords["extension"] if extension in FILETYPE_CHECK: file.seek(0) header = file.read(8) diff --git a/gallery_dl/downloader/ytdl.py b/gallery_dl/downloader/ytdl.py index a233487..7d8b905 100644 --- a/gallery_dl/downloader/ytdl.py +++ b/gallery_dl/downloader/ytdl.py @@ -50,7 +50,7 @@ class YoutubeDLDownloader(DownloaderBase): return False if "entries" in info_dict: - index = pathfmt.keywords.get("_ytdl_index") + index = pathfmt.kwdict.get("_ytdl_index") if index is None: return self._download_playlist(pathfmt, info_dict) else: @@ -59,7 +59,7 @@ class YoutubeDLDownloader(DownloaderBase): def _download_video(self, pathfmt, info_dict): if "url" in info_dict: - text.nameext_from_url(info_dict["url"], pathfmt.keywords) + text.nameext_from_url(info_dict["url"], pathfmt.kwdict) pathfmt.set_extension(info_dict["ext"]) if pathfmt.exists(): pathfmt.temppath = "" diff --git a/gallery_dl/extractor/adultempire.py b/gallery_dl/extractor/adultempire.py index 5ea835f..5e2480a 100644 --- a/gallery_dl/extractor/adultempire.py +++ b/gallery_dl/extractor/adultempire.py @@ -21,12 +21,12 @@ class AdultempireGalleryExtractor(GalleryExtractor): test = ( ("https://www.adultempire.com/5998/gallery.html", { "range": "1", - "keyword": "0533ef1184892be8ac02b17286797c95f389ba63", + "keyword": "25c8171f5623678491a0d7bdf38a7a6ebfa4a361", "content": "5c6beb31e5e3cdc90ee5910d5c30f9aaec977b9e", }), ("https://www.adultdvdempire.com/5683/gallery.html", { "url": "b12cd1a65cae8019d837505adb4d6a2c1ed4d70d", - "keyword": "59fe5d95929efc5040a819a5f77aba7a022bb85a", + "keyword": "0fe9a6e3f0a331b95ba77f66a643705ca86e8ec5", }), ) @@ -42,8 +42,8 @@ class AdultempireGalleryExtractor(GalleryExtractor): "studio" : extr(">studio", "<").strip(), "date" : text.parse_datetime(extr( ">released", "<").strip(), "%m/%d/%Y"), - "actors" : text.split_html(extr( - '