diff options
Diffstat (limited to 'gallery_dl')
| -rw-r--r-- | gallery_dl/extractor/civitai.py | 20 | ||||
| -rw-r--r-- | gallery_dl/extractor/kemono.py | 9 | ||||
| -rw-r--r-- | gallery_dl/extractor/newgrounds.py | 4 | ||||
| -rw-r--r-- | gallery_dl/output.py | 2 | ||||
| -rw-r--r-- | gallery_dl/path.py | 3 | ||||
| -rw-r--r-- | gallery_dl/version.py | 2 |
6 files changed, 32 insertions, 8 deletions
diff --git a/gallery_dl/extractor/civitai.py b/gallery_dl/extractor/civitai.py index fe3b7ed..00400ba 100644 --- a/gallery_dl/extractor/civitai.py +++ b/gallery_dl/extractor/civitai.py @@ -459,6 +459,18 @@ class CivitaiImagesExtractor(CivitaiExtractor): def images(self): params = self._parse_query(self.groups[0]) + params["types"] = ("image",) + return self.api.images(params) + + +class CivitaiVideosExtractor(CivitaiExtractor): + subcategory = "videos" + pattern = BASE_PATTERN + r"/videos(?:/?\?([^#]+))?(?:$|#)" + example = "https://civitai.com/videos" + + def images(self): + params = self._parse_query(self.groups[0]) + params["types"] = ("video",) return self.api.images(params) @@ -521,6 +533,7 @@ class CivitaiUserImagesExtractor(CivitaiExtractor): def __init__(self, match): user, query = match.groups() self.params = self._parse_query(query) + self.params["types"] = ("image",) if self.params.get("section") == "reactions": self.subcategory = "reactions-images" self.images = self._image_reactions @@ -708,7 +721,6 @@ class CivitaiTrpcAPI(): "useIndex" : True, "period" : "AllTime", "sort" : "Newest", - "types" : ("image",), "withMeta" : False, # Metadata Only "fromPlatform" : False, # Made On-Site "browsingLevel": self.nsfw, @@ -899,10 +911,10 @@ class CivitaiSearchAPI(): def __init__(self, extractor): self.extractor = extractor - self.root = "https://search.civitai.com" + self.root = "https://search-new.civitai.com" self.headers = { - "Authorization": "Bearer ab8565e5ab8dc2d8f0d4256d204781cb63fe8b031" - "eb3779cbbed38a7b5308e5c", + "Authorization": "Bearer 8c46eb2508e21db1e9828a97968d91ab1ca1caa5f" + "70a00e88a2ba1e286603b61", "Content-Type": "application/json", "X-Meilisearch-Client": "Meilisearch instant-meilisearch (v0.13.5)" " ; Meilisearch JavaScript (v0.34.0)", diff --git a/gallery_dl/extractor/kemono.py b/gallery_dl/extractor/kemono.py index 46139bc..a5e1f6d 100644 --- a/gallery_dl/extractor/kemono.py +++ b/gallery_dl/extractor/kemono.py @@ -562,6 +562,7 @@ class KemonoAPI(): def __init__(self, extractor): self.extractor = extractor self.root = extractor.root + "/api/v1" + self.headers = {"Accept": "text/css"} def posts(self, offset=0, query=None, tags=None): endpoint = "/posts" @@ -574,8 +575,7 @@ class KemonoAPI(): def creators(self): endpoint = "/creators" - headers = {"Accept": "text/css"} - return self._call(endpoint, headers=headers) + return self._call(endpoint) def creator_posts(self, service, creator_id, offset=0, query=None, tags=None): @@ -644,6 +644,11 @@ class KemonoAPI(): return self._call(endpoint, params) def _call(self, endpoint, params=None, headers=None, fatal=True): + if headers is None: + headers = self.headers + else: + headers = {**self.headers, **headers} + return self.extractor.request_json( f"{self.root}{endpoint}", params=params, headers=headers, encoding="utf-8", fatal=fatal) diff --git a/gallery_dl/extractor/newgrounds.py b/gallery_dl/extractor/newgrounds.py index de96aa0..c42453f 100644 --- a/gallery_dl/extractor/newgrounds.py +++ b/gallery_dl/extractor/newgrounds.py @@ -224,6 +224,10 @@ class NewgroundsExtractor(Extractor): "width" : text.parse_int(full('width="', '"')), "height" : text.parse_int(full('height="', '"')), } + + if not data["url"]: + data["url"] = extr('<a href="', '"') + index = data["url"].rpartition("/")[2].partition("_")[0] data["index"] = text.parse_int(index) data["_index"] = index diff --git a/gallery_dl/output.py b/gallery_dl/output.py index 519a8f4..9e0888b 100644 --- a/gallery_dl/output.py +++ b/gallery_dl/output.py @@ -118,7 +118,7 @@ class PathfmtProxy(): def __getattribute__(self, name): pathfmt = object.__getattribute__(self, "job").pathfmt - return pathfmt.__dict__.get(name) if pathfmt else None + return getattr(pathfmt, name, None) if pathfmt else None def __str__(self): if pathfmt := object.__getattribute__(self, "job").pathfmt: diff --git a/gallery_dl/path.py b/gallery_dl/path.py index eecbd6c..6381622 100644 --- a/gallery_dl/path.py +++ b/gallery_dl/path.py @@ -134,6 +134,9 @@ class PathFormat(): basedir = self.clean_path(basedir) self.basedirectory = basedir + def __str__(self): + return self.realpath + def open(self, mode="wb"): """Open file and return a corresponding file object""" try: diff --git a/gallery_dl/version.py b/gallery_dl/version.py index a6474de..e6913b0 100644 --- a/gallery_dl/version.py +++ b/gallery_dl/version.py @@ -6,5 +6,5 @@ # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -__version__ = "1.30.3" +__version__ = "1.30.4" __variant__ = None |
