diff --git a/gallery_dl/extractor/2ch.py b/gallery_dl/extractor/2ch.py index ab55e2cf..81a0a694 100644 --- a/gallery_dl/extractor/2ch.py +++ b/gallery_dl/extractor/2ch.py @@ -25,7 +25,7 @@ class _2chThreadExtractor(Extractor): def __init__(self, match): tld = match[1] - self.root = f"https://2ch.{'org' if tld == 'hk' else tld}" + self.root = "https://2ch." + ("org" if tld == "hk" else tld) Extractor.__init__(self, match) def items(self): @@ -71,14 +71,14 @@ class _2chBoardExtractor(Extractor): def __init__(self, match): tld = match[1] - self.root = f"https://2ch.{'su' if tld == 'hk' else tld}" + self.root = "https://2ch." + ("org" if tld == "hk" else tld) Extractor.__init__(self, match) def items(self): base = f"{self.root}/{self.groups[1]}" # index page - url = f"{base}/index.json" + url = base + "/index.json" index = self.request_json(url) index["_extractor"] = _2chThreadExtractor for thread in index["threads"]: diff --git a/gallery_dl/extractor/arcalive.py b/gallery_dl/extractor/arcalive.py index 4287e7d4..d48e4f5a 100644 --- a/gallery_dl/extractor/arcalive.py +++ b/gallery_dl/extractor/arcalive.py @@ -84,7 +84,7 @@ class ArcalivePostExtractor(ArcaliveExtractor): url = src fallback = () - query = f"?type=orig&{query}" + query = "?type=orig&" + query if orig := text.extr(media, 'data-orig="', '"'): path, _, ext = url.rpartition(".") if ext != orig: @@ -169,8 +169,11 @@ class ArcaliveAPI(): return data self.log.debug("Server response: %s", data) - msg = f": {msg}" if (msg := data.get("message")) else "" - raise exception.AbortExtraction(f"API request failed{msg}") + if msg := data.get("message"): + msg = "API request failed: " + msg + else: + msg = "API request failed" + raise exception.AbortExtraction(msg) def _pagination(self, endpoint, params, key): while True: diff --git a/gallery_dl/extractor/arena.py b/gallery_dl/extractor/arena.py index ada2fa1d..6f3fa96d 100644 --- a/gallery_dl/extractor/arena.py +++ b/gallery_dl/extractor/arena.py @@ -24,8 +24,8 @@ class ArenaChannelExtractor(GalleryExtractor): example = "https://are.na/evan-collins-1522646491/cassette-futurism" def metadata(self, page): - channel = self.request_json( - f"https://api.are.na/v2/channels/{self.groups[0]}") + url = "https://api.are.na/v2/channels/" + self.groups[0] + channel = self.request_json(url) channel["date"] = self.parse_datetime_iso( channel["created_at"]) diff --git a/gallery_dl/extractor/artstation.py b/gallery_dl/extractor/artstation.py index f1b55ce8..9c0f5ed4 100644 --- a/gallery_dl/extractor/artstation.py +++ b/gallery_dl/extractor/artstation.py @@ -95,7 +95,7 @@ class ArtstationExtractor(Extractor): if not self.external: return asset["extension"] = "mp4" - return f"ytdl:{url}" + return "ytdl:" + url self.log.debug(player) self.log.warning("Failed to extract embedded player URL (%s)", @@ -328,9 +328,9 @@ class ArtstationChallengeExtractor(ArtstationExtractor): def items(self): base = f"{self.root}/contests/_/challenges/{self.challenge_id}" - challenge_url = f"{base}.json" - submission_url = f"{base}/submissions.json" - update_url = f"{self.root}/contests/submission_updates.json" + challenge_url = base + ".json" + submission_url = base + "/submissions.json" + update_url = self.root + "/contests/submission_updates.json" challenge = self.request_json(challenge_url) yield Message.Directory, "", {"challenge": challenge} @@ -388,7 +388,7 @@ class ArtstationSearchExtractor(ArtstationExtractor): "value" : value.split(","), }) - url = f"{self.root}/api/v2/search/projects.json" + url = self.root + "/api/v2/search/projects.json" data = { "query" : self.query, "page" : None, @@ -419,7 +419,7 @@ class ArtstationArtworkExtractor(ArtstationExtractor): return {"artwork": self.query} def projects(self): - url = f"{self.root}/projects.json" + url = self.root + "/projects.json" return self._pagination(url, self.query.copy()) diff --git a/gallery_dl/extractor/bellazon.py b/gallery_dl/extractor/bellazon.py index 9757f487..b9ec3d96 100644 --- a/gallery_dl/extractor/bellazon.py +++ b/gallery_dl/extractor/bellazon.py @@ -24,7 +24,7 @@ class BellazonExtractor(Extractor): archive_fmt = "{post[id]}/{id}_{filename}" def items(self): - native = (f"{self.root}/", f"{self.root[6:]}/") + native = (self.root + "/", self.root[6:] + "/") extract_urls = text.re( r'(?s)<(' r'(?:video .*?]*?src|a [^>]*?href)="([^"]+).*?' @@ -82,7 +82,7 @@ class BellazonExtractor(Extractor): dc["extension"] = text.ext_from_url(url) if url[0] == "/": - url = f"https:{url}" + url = "https:" + url yield Message.Url, url, dc else: @@ -91,10 +91,10 @@ class BellazonExtractor(Extractor): yield Message.Queue, url, data def _pagination(self, base, pnum=None): - base = f"{self.root}{base}" + base = self.root + base if pnum is None: - url = f"{base}/" + url = base + "/" pnum = 1 else: url = f"{base}/page/{pnum}/" @@ -112,7 +112,7 @@ class BellazonExtractor(Extractor): url = f"{base}/page/{pnum}/" def _pagination_reverse(self, base, pnum=None): - base = f"{self.root}{base}" + base = self.root + base url = f"{base}/page/{'9999' if pnum is None else pnum}/" with self.request(url) as response: @@ -127,7 +127,7 @@ class BellazonExtractor(Extractor): if pnum > 1: url = f"{base}/page/{pnum}/" elif pnum == 1: - url = f"{base}/" + url = base + "/" else: return @@ -198,9 +198,9 @@ class BellazonPostExtractor(BellazonExtractor): def posts(self): path, post_id = self.groups - page = self.request(f"{self.root}{path}").text + page = self.request(self.root + path).text - pos = page.find(f'id="elComment_{post_id}') + pos = page.find('id="elComment_' + post_id) if pos < 0: raise exception.NotFoundError("post") html = text.extract(page, "
", pos-100)[0] diff --git a/gallery_dl/extractor/bilibili.py b/gallery_dl/extractor/bilibili.py index fe10150f..d9a942df 100644 --- a/gallery_dl/extractor/bilibili.py +++ b/gallery_dl/extractor/bilibili.py @@ -146,7 +146,7 @@ class BilibiliAPI(): except Exception: if "window._riskdata_" not in page: raise exception.AbortExtraction( - f"{article_id}: Unable to extract INITIAL_STATE data") + article_id + ": Unable to extract INITIAL_STATE data") self.extractor.wait(seconds=300) def user_favlist(self): diff --git a/gallery_dl/extractor/boosty.py b/gallery_dl/extractor/boosty.py index 1e609770..01ecf59f 100644 --- a/gallery_dl/extractor/boosty.py +++ b/gallery_dl/extractor/boosty.py @@ -424,7 +424,7 @@ class BoostyAPI(): params["offset"] = offset def dialog(self, dialog_id): - endpoint = f"/v1/dialog/{dialog_id}" + endpoint = "/v1/dialog/" + dialog_id return self._call(endpoint) def dialog_messages(self, dialog_id, limit=300, offset=None): diff --git a/gallery_dl/extractor/booth.py b/gallery_dl/extractor/booth.py index 3c000b19..c232c588 100644 --- a/gallery_dl/extractor/booth.py +++ b/gallery_dl/extractor/booth.py @@ -116,7 +116,7 @@ class BoothShopExtractor(BoothExtractor): BoothExtractor.__init__(self, match) def shop_items(self): - return self._pagination(f"{self.root}/items") + return self._pagination(self.root + "/items") def _fallback(url): diff --git a/gallery_dl/extractor/bunkr.py b/gallery_dl/extractor/bunkr.py index 2696111c..2c08f003 100644 --- a/gallery_dl/extractor/bunkr.py +++ b/gallery_dl/extractor/bunkr.py @@ -189,7 +189,7 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor): json={"id": data_id}) if data.get("encrypted"): - key = f"SECRET_KEY_{data['timestamp'] // 3600}" + key = "SECRET_KEY_" + str(data["timestamp"] // 3600) file_url = util.decrypt_xor(data["url"], key.encode()) else: file_url = data["url"] @@ -221,7 +221,7 @@ class BunkrMediaExtractor(BunkrAlbumExtractor): def fetch_album(self, album_id): try: - page = self.request(f"{self.root}{album_id}").text + page = self.request(self.root + album_id).text data_id = text.extr(page, 'data-file-id="', '"') file = self._extract_file(data_id) file["name"] = text.unquote(text.unescape(text.extr( diff --git a/gallery_dl/extractor/civitai.py b/gallery_dl/extractor/civitai.py index 55702651..708f9595 100644 --- a/gallery_dl/extractor/civitai.py +++ b/gallery_dl/extractor/civitai.py @@ -580,10 +580,10 @@ class CivitaiUserCollectionsExtractor(CivitaiExtractor): params = self._parse_query(query) params["userId"] = self.api.user(text.unquote(user))[0]["id"] - base = f"{self.root}/collections/" + base = self.root + "/collections/" for collection in self.api.collections(params): collection["_extractor"] = CivitaiCollectionExtractor - yield Message.Queue, f"{base}{collection['id']}", collection + yield Message.Queue, base + str(collection["id"]), collection class CivitaiGeneratedExtractor(CivitaiExtractor): @@ -591,7 +591,7 @@ class CivitaiGeneratedExtractor(CivitaiExtractor): subcategory = "generated" filename_fmt = "{filename}.{extension}" directory_fmt = ("{category}", "generated") - pattern = f"{BASE_PATTERN}/generate" + pattern = BASE_PATTERN + "/generate" example = "https://civitai.com/generate" def items(self): @@ -647,12 +647,12 @@ class CivitaiRestAPI(): }) def model(self, model_id): - endpoint = f"/v1/models/{model_id}" + endpoint = "/v1/models/" + str(model_id) return self._call(endpoint) @memcache(keyarg=1) def model_version(self, model_version_id): - endpoint = f"/v1/model-versions/{model_version_id}" + endpoint = "/v1/model-versions/" + str(model_version_id) return self._call(endpoint) def models(self, params): @@ -945,7 +945,7 @@ class CivitaiSearchAPI(): if auth := extractor.config("token"): if " " not in auth: - auth = f"Bearer {auth}" + auth = "Bearer " + auth else: auth = ("Bearer 8c46eb2508e21db1e9828a97968d" "91ab1ca1caa5f70a00e88a2ba1e286603b61") diff --git a/gallery_dl/extractor/comick.py b/gallery_dl/extractor/comick.py index 4742e694..c119b2e3 100644 --- a/gallery_dl/extractor/comick.py +++ b/gallery_dl/extractor/comick.py @@ -44,7 +44,7 @@ class ComickCoversExtractor(ComickBase, GalleryExtractor): covers.reverse() return [ - (f"https://meo.comick.pictures/{cover['b2key']}", { + ("https://meo.comick.pictures/" + cover["b2key"], { "id" : cover["id"], "width" : cover["w"], "height": cover["h"], @@ -128,7 +128,7 @@ class ComickChapterExtractor(ComickBase, ChapterExtractor): return () return [ - (f"https://meo.comick.pictures/{img['b2key']}", { + ("https://meo.comick.pictures/" + img["b2key"], { "width" : img["w"], "height" : img["h"], "size" : img["s"], diff --git a/gallery_dl/extractor/common.py b/gallery_dl/extractor/common.py index 13c7bbef..a6379a3e 100644 --- a/gallery_dl/extractor/common.py +++ b/gallery_dl/extractor/common.py @@ -766,7 +766,7 @@ class GalleryExtractor(Extractor): Extractor.__init__(self, match) if url is None and (path := self.groups[0]) and path[0] == "/": - self.page_url = f"{self.root}{path}" + self.page_url = self.root + path else: self.page_url = url @@ -863,7 +863,7 @@ class MangaExtractor(Extractor): Extractor.__init__(self, match) if url is None and (path := self.groups[0]) and path[0] == "/": - self.page_url = f"{self.root}{path}" + self.page_url = self.root + path else: self.page_url = url diff --git a/gallery_dl/extractor/cyberfile.py b/gallery_dl/extractor/cyberfile.py index 6af3fd23..49cc6db1 100644 --- a/gallery_dl/extractor/cyberfile.py +++ b/gallery_dl/extractor/cyberfile.py @@ -20,7 +20,7 @@ class CyberfileExtractor(Extractor): root = "https://cyberfile.me" def request_api(self, endpoint, data): - url = f"{self.root}{endpoint}" + url = self.root + endpoint headers = { "X-Requested-With": "XMLHttpRequest", "Origin": self.root, @@ -29,7 +29,7 @@ class CyberfileExtractor(Extractor): url, method="POST", headers=headers, data=data) if "albumPasswordModel" in resp.get("javascript", ""): - url_pw = f"{self.root}/ajax/folder_password_process" + url_pw = self.root + "/ajax/folder_password_process" data_pw = { "folderPassword": self._get_auth_info(password=True)[1], "folderId": text.extr( diff --git a/gallery_dl/extractor/danbooru.py b/gallery_dl/extractor/danbooru.py index c036226e..588d94b5 100644 --- a/gallery_dl/extractor/danbooru.py +++ b/gallery_dl/extractor/danbooru.py @@ -155,7 +155,7 @@ class DanbooruExtractor(BaseExtractor): return if prefix: - params["page"] = f"{prefix}{posts[-1]['id']}" + params["page"] = prefix + str(posts[-1]["id"]) elif params["page"]: params["page"] += 1 else: @@ -174,9 +174,8 @@ class DanbooruExtractor(BaseExtractor): else: ext = data["ZIP:ZipFileName"].rpartition(".")[2] - fmt = ("{:>06}." + ext).format delays = data["Ugoira:FrameDelays"] - return [{"file": fmt(index), "delay": delay} + return [{"file": f"{index:>06}.{ext}", "delay": delay} for index, delay in enumerate(delays)] def _collection_posts(self, cid, ctype): diff --git a/gallery_dl/extractor/dandadan.py b/gallery_dl/extractor/dandadan.py index 44db1606..9349d5fe 100644 --- a/gallery_dl/extractor/dandadan.py +++ b/gallery_dl/extractor/dandadan.py @@ -31,7 +31,7 @@ class DandadanChapterExtractor(DandadanBase, ChapterExtractor): return { "manga" : "Dandadan", "chapter" : text.parse_int(chapter), - "chapter_minor": f"{sep}{minor}", + "chapter_minor": sep + minor, "lang" : "en", } diff --git a/gallery_dl/extractor/dankefuerslesen.py b/gallery_dl/extractor/dankefuerslesen.py index daed1abb..baebb6f3 100644 --- a/gallery_dl/extractor/dankefuerslesen.py +++ b/gallery_dl/extractor/dankefuerslesen.py @@ -34,7 +34,7 @@ class DankefuerslesenChapterExtractor(DankefuerslesenBase, ChapterExtractor): def _init(self): self.zip = self.config("zip", False) if self.zip: - self.filename_fmt = f"{self.directory_fmt[-1]}.{{extension}}" + self.filename_fmt = self.directory_fmt[-1] + ".{extension}" self.directory_fmt = self.directory_fmt[:-1] def metadata(self, page): diff --git a/gallery_dl/extractor/deviantart.py b/gallery_dl/extractor/deviantart.py index 1554085a..0769c7ae 100644 --- a/gallery_dl/extractor/deviantart.py +++ b/gallery_dl/extractor/deviantart.py @@ -66,7 +66,7 @@ class DeviantartExtractor(Extractor): self.quality = "-fullview.png?" self.quality_sub = text.re(r"-fullview\.[a-z0-9]+\?").sub else: - self.quality = f",q_{self.quality}" + self.quality = ",q_" + str(self.quality) self.quality_sub = text.re(r",q_\d+").sub if self.intermediary: diff --git a/gallery_dl/extractor/erome.py b/gallery_dl/extractor/erome.py index 2f319ac8..d01d00a8 100644 --- a/gallery_dl/extractor/erome.py +++ b/gallery_dl/extractor/erome.py @@ -25,10 +25,10 @@ class EromeExtractor(Extractor): _cookies = True def items(self): - base = f"{self.root}/a/" + base = self.root + "/a/" data = {"_extractor": EromeAlbumExtractor} for album_id in self.albums(): - yield Message.Queue, f"{base}{album_id}", data + yield Message.Queue, base + album_id, data def albums(self): return () @@ -141,7 +141,7 @@ class EromeSearchExtractor(EromeExtractor): example = "https://www.erome.com/search?q=QUERY" def albums(self): - url = f"{self.root}/search" + url = self.root + "/search" params = text.parse_query(self.groups[0]) return self._pagination(url, params) diff --git a/gallery_dl/extractor/facebook.py b/gallery_dl/extractor/facebook.py index b27edee7..e8f7d863 100644 --- a/gallery_dl/extractor/facebook.py +++ b/gallery_dl/extractor/facebook.py @@ -237,16 +237,14 @@ class FacebookExtractor(Extractor): if res.url.startswith(self.root + "/login"): raise exception.AuthRequired( - message=(f"You must be logged in to continue viewing images." - f"{LEFT_OFF_TXT}") - ) + message=("You must be logged in to continue viewing images." + + LEFT_OFF_TXT)) if b'{"__dr":"CometErrorRoot.react"}' in res.content: raise exception.AbortExtraction( - f"You've been temporarily blocked from viewing images.\n" - f"Please try using a different account, " - f"using a VPN or waiting before you retry.{LEFT_OFF_TXT}" - ) + "You've been temporarily blocked from viewing images.\n" + "Please try using a different account, " + "using a VPN or waiting before you retry." + LEFT_OFF_TXT) return res diff --git a/gallery_dl/extractor/fanbox.py b/gallery_dl/extractor/fanbox.py index 355eb62e..5af60449 100644 --- a/gallery_dl/extractor/fanbox.py +++ b/gallery_dl/extractor/fanbox.py @@ -340,7 +340,7 @@ class FanboxExtractor(Extractor): url = (f"https://docs.google.com/forms/d/e/" f"{content_id}/viewform?usp=sf_link") else: - self.log.warning(f"service not recognized: {provider}") + self.log.warning("service not recognized: %s", provider) if url: final_post["embed"] = embed diff --git a/gallery_dl/extractor/fansly.py b/gallery_dl/extractor/fansly.py index 6a88328b..d57c8ca4 100644 --- a/gallery_dl/extractor/fansly.py +++ b/gallery_dl/extractor/fansly.py @@ -135,7 +135,7 @@ class FanslyExtractor(Extractor): files.append({ "file": file, - "url": f"ytdl:{location['location']}", + "url": "ytdl:" + location["location"], "_fallback": fallback, "_ytdl_manifest": "dash" if mime == "application/dash+xml" else "hls", @@ -184,7 +184,7 @@ class FanslyListExtractor(FanslyExtractor): example = "https://fansly.com/lists/1234567890" def items(self): - base = f"{self.root}/" + base = self.root + "/" for account in self.api.lists_itemsnew(self.groups[0]): account["_extractor"] = FanslyCreatorPostsExtractor url = f"{base}{account['username']}/posts" @@ -197,7 +197,7 @@ class FanslyListsExtractor(FanslyExtractor): example = "https://fansly.com/lists" def items(self): - base = f"{self.root}/lists/" + base = self.root + "/lists/" for list in self.api.lists_account(): list["_extractor"] = FanslyListExtractor url = f"{base}{list['id']}#{list['label']}" @@ -308,7 +308,7 @@ class FanslyAPI(): return self._pagination(endpoint, params) def timeline_new(self, account_id, wall_id): - endpoint = f"/v1/timelinenew/{account_id}" + endpoint = "/v1/timelinenew/" + str(account_id) params = { "before" : "0", "after" : "0", diff --git a/gallery_dl/extractor/flickr.py b/gallery_dl/extractor/flickr.py index 54920695..5071de7e 100644 --- a/gallery_dl/extractor/flickr.py +++ b/gallery_dl/extractor/flickr.py @@ -456,7 +456,7 @@ class FlickrAPI(oauth.OAuth1API): except ValueError: data = {"code": -1, "message": response.content} if "code" in data: - msg = data.get("message") + msg = data.get("message", "") self.log.debug("Server response: %s", data) if data["code"] == 1: raise exception.NotFoundError(self.extractor.subcategory) @@ -466,7 +466,7 @@ class FlickrAPI(oauth.OAuth1API): raise exception.AuthenticationError(msg) elif data["code"] == 99: raise exception.AuthorizationError(msg) - raise exception.AbortExtraction(f"API request failed: {msg}") + raise exception.AbortExtraction("API request failed: " + msg) return data def _pagination(self, method, params, key="photos"): diff --git a/gallery_dl/extractor/foolfuuka.py b/gallery_dl/extractor/foolfuuka.py index 35ad1ebf..88053b4c 100644 --- a/gallery_dl/extractor/foolfuuka.py +++ b/gallery_dl/extractor/foolfuuka.py @@ -278,7 +278,7 @@ class FoolfuukaGalleryExtractor(FoolfuukaExtractor): base = f"{self.root}/_/api/chan/gallery/?board={self.board}&page=" for pnum in pages: - posts = self.request_json(f"{base}{pnum}") + posts = self.request_json(base + str(pnum)) if not posts: return yield from posts diff --git a/gallery_dl/extractor/furaffinity.py b/gallery_dl/extractor/furaffinity.py index a3ce536f..0a046c93 100644 --- a/gallery_dl/extractor/furaffinity.py +++ b/gallery_dl/extractor/furaffinity.py @@ -322,7 +322,7 @@ class FuraffinityUserExtractor(Dispatch, FuraffinityExtractor): def items(self): base = self.root - user = f"{self.user}/" + user = self.user + "/" return self._dispatch_extractors(( (FuraffinityGalleryExtractor , f"{base}/gallery/{user}"), (FuraffinityScrapsExtractor , f"{base}/scraps/{user}"), diff --git a/gallery_dl/extractor/girlsreleased.py b/gallery_dl/extractor/girlsreleased.py index 55dd5b73..da1add92 100644 --- a/gallery_dl/extractor/girlsreleased.py +++ b/gallery_dl/extractor/girlsreleased.py @@ -22,14 +22,14 @@ class GirlsreleasedExtractor(Extractor): def items(self): data = {"_extractor": GirlsreleasedSetExtractor} - base = f"{self.root}/set/" + base = self.root + "/set/" for set in self._pagination(): - yield Message.Queue, f"{base}{set[0]}", data + yield Message.Queue, base + set[0], data def _pagination(self): base = f"{self.root}/api/0.2/sets/{self._path}/{self.groups[0]}/page/" for pnum in itertools.count(): - sets = self.request_json(f"{base}{pnum}")["sets"] + sets = self.request_json(base + str(pnum))["sets"] if not sets: return diff --git a/gallery_dl/extractor/hitomi.py b/gallery_dl/extractor/hitomi.py index b05a9a7b..fd3d00ed 100644 --- a/gallery_dl/extractor/hitomi.py +++ b/gallery_dl/extractor/hitomi.py @@ -32,14 +32,14 @@ class HitomiExtractor(Extractor): language = tag tag = "index" else: - ns = f"{ns}/" + ns += "/" url = (f"https://ltn.{self.domain}/n/{ns}" f"/{tag.replace('_', ' ')}-{language}.nozomi") if headers is None: headers = {} headers["Origin"] = self.root - headers["Referer"] = f"{self.root}/" + headers["Referer"] = self.root + "/" return decode_nozomi(self.request(url, headers=headers).content) diff --git a/gallery_dl/extractor/imagehosts.py b/gallery_dl/extractor/imagehosts.py index 21e6cf8d..47dbc0f9 100644 --- a/gallery_dl/extractor/imagehosts.py +++ b/gallery_dl/extractor/imagehosts.py @@ -28,10 +28,7 @@ class ImagehostImageExtractor(Extractor): def __init__(self, match): Extractor.__init__(self, match) - if self.root: - self.page_url = f"{self.root}{match[1]}" - else: - self.page_url = f"http{'s' if self._https else ''}://{match[1]}" + self.page_url = (self.root or "https://") + match[1] self.token = match[2] if self._params == "simple": @@ -461,8 +458,8 @@ class ImgdriveImageExtractor(ImagehostImageExtractor): def __init__(self, match): path, category, self.token = match.groups() - self.page_url = f"https://{path}" - self.category = f"img{category}" + self.page_url = "https://" + path + self.category = "img" + category Extractor.__init__(self, match) def get_info(self, page): diff --git a/gallery_dl/extractor/imgbb.py b/gallery_dl/extractor/imgbb.py index d9573288..ed06c1ca 100644 --- a/gallery_dl/extractor/imgbb.py +++ b/gallery_dl/extractor/imgbb.py @@ -136,8 +136,8 @@ class ImgbbAlbumExtractor(ImgbbExtractor): 'data-text="image-count">', "<")), } - url = f"{self.root}/json" - params["pathname"] = f"/album/{album['id']}" + url = self.root + "/json" + params["pathname"] = "/album/" + album["id"] return self._pagination(page, url, params) @@ -190,11 +190,11 @@ class ImgbbUserExtractor(ImgbbExtractor): if response.status_code < 300: params["pathname"] = "/" - return self._pagination(response.text, f"{url}json", params) + return self._pagination(response.text, url + "json", params) if response.status_code == 301: raise exception.NotFoundError("user") - redirect = f"HTTP redirect to {response.headers.get('Location')}" + redirect = "HTTP redirect to " + response.headers.get("Location", "") if response.status_code == 302: raise exception.AuthRequired( ("username & password", "authenticated cookies"), diff --git a/gallery_dl/extractor/imgpile.py b/gallery_dl/extractor/imgpile.py index c991abed..c73926ac 100644 --- a/gallery_dl/extractor/imgpile.py +++ b/gallery_dl/extractor/imgpile.py @@ -22,9 +22,6 @@ class ImgpileExtractor(Extractor): "{post[title]} ({post[id_slug]})") archive_fmt = "{post[id_slug]}_{id}" - def items(self): - pass - class ImgpilePostExtractor(ImgpileExtractor): subcategory = "post" @@ -71,7 +68,7 @@ class ImgpilePostExtractor(ImgpileExtractor): "id_slug": text.extr(media, 'data-id="', '"'), "id" : text.parse_int(text.extr( media, 'data-media-id="', '"')), - "url": f"""http{text.extr(media, '', "", " – ")) manga_id = text.parse_int(text.extr(page, "manga_id=", "&")) - url = f"{self.root}/wp-admin/admin-ajax.php" + url = self.root + "/wp-admin/admin-ajax.php" params = { "manga_id": manga_id, "page" : "1", diff --git a/gallery_dl/extractor/realbooru.py b/gallery_dl/extractor/realbooru.py index 04a98b41..3454340c 100644 --- a/gallery_dl/extractor/realbooru.py +++ b/gallery_dl/extractor/realbooru.py @@ -49,7 +49,7 @@ class RealbooruExtractor(booru.BooruExtractor): tags.append(tag) tags_categories[tag_type].append(tag) for key, value in tags_categories.items(): - post[f"tags_{key}"] = ", ".join(value) + post["tags_" + key] = ", ".join(value) tags.sort() post["tags"] = ", ".join(tags) diff --git a/gallery_dl/extractor/reddit.py b/gallery_dl/extractor/reddit.py index cc73e474..a8bde87d 100644 --- a/gallery_dl/extractor/reddit.py +++ b/gallery_dl/extractor/reddit.py @@ -223,10 +223,10 @@ class RedditExtractor(Extractor): self.log.debug(src) elif url := data.get("dashUrl"): submission["_ytdl_manifest"] = "dash" - yield f"ytdl:{url}" + yield "ytdl:" + url elif url := data.get("hlsUrl"): submission["_ytdl_manifest"] = "hls" - yield f"ytdl:{url}" + yield "ytdl:" + url def _extract_video_ytdl(self, submission): return "https://www.reddit.com" + submission["permalink"] @@ -506,7 +506,7 @@ class RedditAPI(): return "Bearer " + data["access_token"] def _call(self, endpoint, params): - url = f"{self.root}{endpoint}" + url = self.root + endpoint params["raw_json"] = "1" while True: diff --git a/gallery_dl/extractor/redgifs.py b/gallery_dl/extractor/redgifs.py index 164fdf49..de8b82e6 100644 --- a/gallery_dl/extractor/redgifs.py +++ b/gallery_dl/extractor/redgifs.py @@ -135,7 +135,7 @@ class RedgifsCollectionsExtractor(RedgifsExtractor): def items(self): base = f"{self.root}/users/{self.key}/collections/" for collection in self.api.collections(self.key): - url = f"{base}{collection['folderId']}" + url = base + collection["folderId"] collection["_extractor"] = RedgifsCollectionExtractor yield Message.Queue, url, collection diff --git a/gallery_dl/extractor/rule34xyz.py b/gallery_dl/extractor/rule34xyz.py index 8174313a..b395f03f 100644 --- a/gallery_dl/extractor/rule34xyz.py +++ b/gallery_dl/extractor/rule34xyz.py @@ -120,13 +120,13 @@ class Rule34xyzExtractor(BooruExtractor): def _login_impl(self, username, password): self.log.info("Logging in as %s", username) - url = f"{self.root}/api/v2/auth/signin" + url = self.root + "/api/v2/auth/signin" data = {"email": username, "password": password} response = self.request_json( url, method="POST", json=data, fatal=False) if jwt := response.get("jwt"): - return f"Bearer {jwt}" + return "Bearer " + jwt raise exception.AuthenticationError( (msg := response.get("message")) and f'"{msg}"') diff --git a/gallery_dl/extractor/s3ndpics.py b/gallery_dl/extractor/s3ndpics.py index 39a30d08..7eeeece9 100644 --- a/gallery_dl/extractor/s3ndpics.py +++ b/gallery_dl/extractor/s3ndpics.py @@ -18,7 +18,7 @@ class S3ndpicsExtractor(Extractor): """Base class for s3ndpics extractors""" category = "s3ndpics" root = "https://s3nd.pics" - root_api = f"{root}/api" + root_api = root + "/api" directory_fmt = ("{category}", "{user[username]}", "{date} {title:?/ /}({id})") filename_fmt = "{num:>02}.{extension}" @@ -41,7 +41,7 @@ class S3ndpicsExtractor(Extractor): post["type"] = file["type"] path = file["url"] text.nameext_from_url(path, post) - yield Message.Url, f"{base}{path}", post + yield Message.Url, base + path, post def _pagination(self, url, params): params["page"] = 1 @@ -76,7 +76,7 @@ class S3ndpicsUserExtractor(S3ndpicsExtractor): url = f"{self.root_api}/users/username/{self.groups[0]}" self.kwdict["user"] = user = self.request_json(url)["user"] - url = f"{self.root_api}/posts" + url = self.root_api + "/posts" params = { "userId": user["_id"], "limit" : "12", @@ -91,7 +91,7 @@ class S3ndpicsSearchExtractor(S3ndpicsExtractor): example = "https://s3nd.pics/search?QUERY" def posts(self): - url = f"{self.root_api}/posts" + url = self.root_api + "/posts" params = text.parse_query(self.groups[0]) params.setdefault("limit", "20") self.kwdict["search_tags"] = \ diff --git a/gallery_dl/extractor/sankaku.py b/gallery_dl/extractor/sankaku.py index 1df62bbe..f8fe9106 100644 --- a/gallery_dl/extractor/sankaku.py +++ b/gallery_dl/extractor/sankaku.py @@ -193,7 +193,7 @@ class SankakuBooksExtractor(SankakuExtractor): params = {"tags": self.tags, "pool_type": "0"} for pool in self.api.pools_keyset(params): pool["_extractor"] = SankakuPoolExtractor - url = f"https://sankaku.app/books/{pool['id']}" + url = "https://sankaku.app/books/" + pool["id"] yield Message.Queue, url, pool diff --git a/gallery_dl/extractor/schalenetwork.py b/gallery_dl/extractor/schalenetwork.py index 26d0cc96..30e57bc0 100644 --- a/gallery_dl/extractor/schalenetwork.py +++ b/gallery_dl/extractor/schalenetwork.py @@ -64,7 +64,7 @@ class SchalenetworkExtractor(Extractor): def _token(self, required=True): if token := self.config("token"): - return f"Bearer {token.rpartition(' ')[2]}" + return "Bearer " + token.rpartition(' ')[2] if required: raise exception.AuthRequired("'token'", "your favorites") @@ -172,7 +172,7 @@ class SchalenetworkGalleryExtractor(SchalenetworkExtractor, GalleryExtractor): if self.config("cbz", False): headers["Authorization"] = self._token() dl = self.request_json( - f"{url}&action=dl", method="POST", headers=headers) + url + "&action=dl", method="POST", headers=headers) # 'crt' parameter here is necessary for 'hdoujin' downloads url = f"{dl['base']}?crt={self._crt()}" info = text.nameext_from_url(url) @@ -259,7 +259,7 @@ class SchalenetworkFavoriteExtractor(SchalenetworkExtractor): params = text.parse_query(self.groups[1]) params["page"] = text.parse_int(params.get("page"), 1) self.headers["Authorization"] = self._token() - return self._pagination(f"/books/favorites?crt={self._crt()}", params) + return self._pagination("/books/favorites?crt=" + self._crt(), params) SchalenetworkExtractor.extr_class = SchalenetworkGalleryExtractor diff --git a/gallery_dl/extractor/sexcom.py b/gallery_dl/extractor/sexcom.py index 5fdbae47..417538cd 100644 --- a/gallery_dl/extractor/sexcom.py +++ b/gallery_dl/extractor/sexcom.py @@ -282,7 +282,7 @@ class SexcomFeedExtractor(SexcomExtractor): def pins(self): if not self.cookies_check(("sess_sex",)): self.log.warning("no 'sess_sex' cookie set") - url = f"{self.root}/feed/" + url = self.root + "/feed/" return self._pagination(url) @@ -341,10 +341,10 @@ class SexcomSearchExtractor(SexcomExtractor): pin["type"] = "gif" if gifs and pin["extension"] == "webp": pin["extension"] = "gif" - pin["_fallback"] = (f"{root}{path}",) - path = f"{path[:-4]}gif" + pin["_fallback"] = (root + path,) + path = path[:-4] + "gif" - pin["url"] = f"{root}{path}" + pin["url"] = root + path yield Message.Directory, "", pin yield Message.Url, pin["url"], pin diff --git a/gallery_dl/extractor/subscribestar.py b/gallery_dl/extractor/subscribestar.py index 96e8a5b5..df82ff69 100644 --- a/gallery_dl/extractor/subscribestar.py +++ b/gallery_dl/extractor/subscribestar.py @@ -58,7 +58,7 @@ class SubscribestarExtractor(Extractor): text.nameext_from_url(url, item) if url[0] == "/": - url = f"{self.root}{url}" + url = self.root + url yield Message.Url, url, item def posts(self): @@ -72,7 +72,7 @@ class SubscribestarExtractor(Extractor): "/verify_subscriber" in response.url or "/age_confirmation_warning" in response.url): raise exception.AbortExtraction( - f"HTTP redirect to {response.url}") + "HTTP redirect to " + response.url) content = response.content if len(content) < 250 and b">redirected<" in content: diff --git a/gallery_dl/extractor/thehentaiworld.py b/gallery_dl/extractor/thehentaiworld.py index 4c207d67..f1b4ee34 100644 --- a/gallery_dl/extractor/thehentaiworld.py +++ b/gallery_dl/extractor/thehentaiworld.py @@ -90,12 +90,12 @@ class ThehentaiworldExtractor(Extractor): post["tags"] = tags_list = [] for key, value in tags.items(): tags_list.extend(value) - post[f"tags_{key}" if key else "tags_general"] = value + post["tags_" + key if key else "tags_general"] = value return post def _pagination(self, endpoint): - base = f"{self.root}{endpoint}" + base = self.root + endpoint pnum = self.page_start while True: diff --git a/gallery_dl/extractor/tsumino.py b/gallery_dl/extractor/tsumino.py index 1ccdafb1..2ac7e42f 100644 --- a/gallery_dl/extractor/tsumino.py +++ b/gallery_dl/extractor/tsumino.py @@ -30,7 +30,7 @@ class TsuminoBase(): @cache(maxage=14*86400, keyarg=1) def _login_impl(self, username, password): self.log.info("Logging in as %s", username) - url = f"{self.root}/Account/Login" + url = self.root + "/Account/Login" headers = {"Referer": url} data = {"Username": username, "Password": password} @@ -119,9 +119,9 @@ class TsuminoSearchExtractor(TsuminoBase, Extractor): def galleries(self): """Return all gallery results matching 'self.query'""" - url = f"{self.root}/Search/Operate?type=Book" + url = self.root + "/Search/Operate?type=Book" headers = { - "Referer": f"{self.root}/", + "Referer": self.root + "/", "X-Requested-With": "XMLHttpRequest", } data = { diff --git a/gallery_dl/extractor/tumblr.py b/gallery_dl/extractor/tumblr.py index fb8fb3d3..bd274168 100644 --- a/gallery_dl/extractor/tumblr.py +++ b/gallery_dl/extractor/tumblr.py @@ -32,7 +32,7 @@ class TumblrExtractor(Extractor): def _init(self): if name := self.groups[1]: - self.blog = f"{name}.tumblr.com" + self.blog = name + ".tumblr.com" else: self.blog = self.groups[0] or self.groups[2] diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index 801c5222..739400b4 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -730,19 +730,19 @@ class TwitterUserExtractor(Dispatch, TwitterExtractor): def items(self): user, user_id = self.groups if user_id is not None: - user = f"id:{user_id}" + user = "id:" + user_id base = f"{self.root}/{user}/" return self._dispatch_extractors(( - (TwitterInfoExtractor , f"{base}info"), - (TwitterAvatarExtractor , f"{base}photo"), - (TwitterBackgroundExtractor, f"{base}header_photo"), - (TwitterTimelineExtractor , f"{base}timeline"), - (TwitterTweetsExtractor , f"{base}tweets"), - (TwitterMediaExtractor , f"{base}media"), - (TwitterRepliesExtractor , f"{base}with_replies"), - (TwitterHighlightsExtractor, f"{base}highlights"), - (TwitterLikesExtractor , f"{base}likes"), + (TwitterInfoExtractor , base + "info"), + (TwitterAvatarExtractor , base + "photo"), + (TwitterBackgroundExtractor, base + "header_photo"), + (TwitterTimelineExtractor , base + "timeline"), + (TwitterTweetsExtractor , base + "tweets"), + (TwitterMediaExtractor , base + "media"), + (TwitterRepliesExtractor , base + "with_replies"), + (TwitterHighlightsExtractor, base + "highlights"), + (TwitterLikesExtractor , base + "likes"), ), ("timeline",)) @@ -1990,10 +1990,10 @@ class TwitterAPI(): extr.log.info("Retrying API request as guest") continue raise exception.AuthorizationError( - f"{user['screen_name']} blocked your account") + user["screen_name"] + " blocked your account") elif user.get("protected"): raise exception.AuthorizationError( - f"{user['screen_name']}'s Tweets are protected") + user["screen_name"] + "'s Tweets are protected") raise exception.AbortExtraction( "Unable to retrieve Tweets from this timeline") @@ -2042,7 +2042,7 @@ class TwitterAPI(): pinned = None elif pinned := extr._user_obj["legacy"].get( "pinned_tweet_ids_str"): - pinned = f"-tweet-{pinned[0]}" + pinned = "-tweet-" + pinned[0] for idx, entry in enumerate(tweets): if entry["entryId"].endswith(pinned): # mark as pinned / set 'pinned = True' @@ -2248,7 +2248,7 @@ class TwitterAPI(): def _update_variables_search(self, variables, cursor, tweet): try: tweet_id = tweet.get("id_str") or tweet["legacy"]["id_str"] - max_id = f"max_id:{int(tweet_id)-1}" + max_id = "max_id:" + str(int(tweet_id)-1) query, n = text.re(r"\bmax_id:\d+").subn( max_id, variables["rawQuery"]) diff --git a/gallery_dl/extractor/vipergirls.py b/gallery_dl/extractor/vipergirls.py index cce22d04..39817632 100644 --- a/gallery_dl/extractor/vipergirls.py +++ b/gallery_dl/extractor/vipergirls.py @@ -94,7 +94,7 @@ class VipergirlsExtractor(Extractor): def _login_impl(self, username, password): self.log.info("Logging in as %s", username) - url = f"{self.root}/login.php?do=login" + url = self.root + "/login.php?do=login" data = { "vb_login_username": username, "vb_login_password": password, diff --git a/gallery_dl/extractor/vk.py b/gallery_dl/extractor/vk.py index bd4ec633..ea422651 100644 --- a/gallery_dl/extractor/vk.py +++ b/gallery_dl/extractor/vk.py @@ -101,7 +101,7 @@ class VkExtractor(Extractor): url, method="POST", headers=headers, data=data) if response.history and "/challenge.html" in response.url: raise exception.AbortExtraction( - f"HTTP redirect to 'challenge' page:\n{response.url}") + "HTTP redirect to 'challenge' page:\n" + response.url) payload = response.json()["payload"][1] if len(payload) < 4: @@ -236,7 +236,7 @@ class VkTaggedExtractor(VkExtractor): self.user_id = match[1] def photos(self): - return self._pagination(f"tag{self.user_id}") + return self._pagination("tag" + self.user_id) def metadata(self): return {"user": {"id": self.user_id}} diff --git a/gallery_dl/extractor/vsco.py b/gallery_dl/extractor/vsco.py index 847a6b0f..6046a78c 100644 --- a/gallery_dl/extractor/vsco.py +++ b/gallery_dl/extractor/vsco.py @@ -158,7 +158,7 @@ class VscoGalleryExtractor(VscoExtractor): tkn = data["users"]["currentUser"]["tkn"] sid = str(data["sites"]["siteByUsername"][self.user]["site"]["id"]) - url = f"{self.root}/api/3.0/medias/profile" + url = self.root + "/api/3.0/medias/profile" params = { "site_id" : sid, "limit" : "14", diff --git a/gallery_dl/extractor/wallhaven.py b/gallery_dl/extractor/wallhaven.py index 9ea3c364..3025c566 100644 --- a/gallery_dl/extractor/wallhaven.py +++ b/gallery_dl/extractor/wallhaven.py @@ -113,7 +113,7 @@ class WallhavenCollectionsExtractor(WallhavenExtractor): base = f"{self.root}/user/{self.username}/favorites/" for collection in self.api.collections(self.username): collection["_extractor"] = WallhavenCollectionExtractor - url = f"{base}{collection['id']}" + url = base + str(collection["id"]) yield Message.Queue, url, collection diff --git a/gallery_dl/extractor/weibo.py b/gallery_dl/extractor/weibo.py index 16c76ac6..c7217d5d 100644 --- a/gallery_dl/extractor/weibo.py +++ b/gallery_dl/extractor/weibo.py @@ -114,13 +114,13 @@ class WeiboExtractor(Extractor): if not url: continue if url.startswith("http:"): - url = f"https:{url[5:]}" + url = "https:" + url[5:] if "filename" not in file: text.nameext_from_url(url, file) if file["extension"] == "json": file["extension"] = "mp4" if file["extension"] == "m3u8": - url = f"ytdl:{url}" + url = "ytdl:" + url file["_ytdl_manifest"] = "hls" file["extension"] = "mp4" num += 1 @@ -307,11 +307,11 @@ class WeiboUserExtractor(WeiboExtractor): def items(self): base = f"{self.root}/u/{self._user_id()}?tabtype=" return Dispatch._dispatch_extractors(self, ( - (WeiboHomeExtractor , f"{base}home"), - (WeiboFeedExtractor , f"{base}feed"), - (WeiboVideosExtractor , f"{base}video"), - (WeiboNewvideoExtractor, f"{base}newVideo"), - (WeiboAlbumExtractor , f"{base}album"), + (WeiboHomeExtractor , base + "home"), + (WeiboFeedExtractor , base + "feed"), + (WeiboVideosExtractor , base + "video"), + (WeiboNewvideoExtractor, base + "newVideo"), + (WeiboAlbumExtractor , base + "album"), ), ("feed",)) diff --git a/gallery_dl/extractor/wikimedia.py b/gallery_dl/extractor/wikimedia.py index a700e00f..aa19fdb8 100644 --- a/gallery_dl/extractor/wikimedia.py +++ b/gallery_dl/extractor/wikimedia.py @@ -47,7 +47,7 @@ class WikimediaExtractor(BaseExtractor): def _init(self): if api_path := self.config_instance("api-path"): if api_path[0] == "/": - self.api_url = f"{self.root}{api_path}" + self.api_url = self.root + api_path else: self.api_url = api_path else: @@ -66,7 +66,7 @@ class WikimediaExtractor(BaseExtractor): def _search_api_path(self, root): self.log.debug("Probing possible API endpoints") for path in ("/api.php", "/w/api.php", "/wiki/api.php"): - url = f"{root}{path}" + url = root + path response = self.request(url, method="HEAD", fatal=None) if response.status_code < 400: return url @@ -122,10 +122,10 @@ class WikimediaExtractor(BaseExtractor): yield Message.Url, image["url"], image if self.subcategories: - base = f"{self.root}/wiki/" + base = self.root + "/wiki/" params["gcmtype"] = "subcat" for subcat in self._pagination(params): - url = f"{base}{subcat['title'].replace(' ', '_')}" + url = base + subcat["title"].replace(" ", "_") subcat["_extractor"] = WikimediaArticleExtractor yield Message.Queue, url, subcat diff --git a/gallery_dl/extractor/xenforo.py b/gallery_dl/extractor/xenforo.py index fb68332f..37dc653a 100644 --- a/gallery_dl/extractor/xenforo.py +++ b/gallery_dl/extractor/xenforo.py @@ -118,7 +118,7 @@ class XenforoExtractor(BaseExtractor): def _login_impl(self, username, password): self.log.info("Logging in as %s", username) - url = f"{self.root}/login/login" + url = self.root + "/login/login" page = self.request(url).text data = { "_xfToken": text.extr(page, 'name="_xfToken" value="', '"'), @@ -140,10 +140,10 @@ class XenforoExtractor(BaseExtractor): } def _pagination(self, base, pnum=None): - base = f"{self.root}{base}" + base = self.root + base if pnum is None: - url = f"{base}/" + url = base + "/" pnum = 1 else: url = f"{base}/page-{pnum}" @@ -160,7 +160,7 @@ class XenforoExtractor(BaseExtractor): url = f"{base}/page-{pnum}" def _pagination_reverse(self, base, pnum=None): - base = f"{self.root}{base}" + base = self.root + base url = f"{base}/page-{'9999' if pnum is None else pnum}" with self.request_page(url) as response: @@ -180,7 +180,7 @@ class XenforoExtractor(BaseExtractor): if pnum > 1: url = f"{base}/page-{pnum}" elif pnum == 1: - url = f"{base}/" + url = base + "/" else: return @@ -345,4 +345,4 @@ class XenforoForumExtractor(XenforoExtractor): pnum = self.groups[-1] for page in self._pagination(path, pnum): for path in extract_threads(page): - yield Message.Queue, f"{self.root}{text.unquote(path)}", data + yield Message.Queue, self.root + text.unquote(path), data diff --git a/gallery_dl/extractor/xvideos.py b/gallery_dl/extractor/xvideos.py index 6c016ecf..6f64c864 100644 --- a/gallery_dl/extractor/xvideos.py +++ b/gallery_dl/extractor/xvideos.py @@ -117,5 +117,5 @@ class XvideosUserExtractor(XvideosBase, Extractor): base = f"{self.root}/profiles/{self.user}/photos/" for gallery in galleries: - url = f"{base}{gallery['id']}" + url = base + str(gallery["id"]) yield Message.Queue, url, gallery