replace old %-formatted and .format(…) strings with f-strings (#7671)

mostly using flynt
https://github.com/ikamensh/flynt
This commit is contained in:
Mike Fährmann
2025-06-28 19:36:16 +02:00
parent f77e98b57d
commit 9dbe33b6de
167 changed files with 756 additions and 891 deletions

View File

@@ -78,7 +78,7 @@ class _8chanThreadExtractor(_8chanExtractor):
self.cookies.set(self.cookies_tos_name(), "1", domain=self.root[8:])
# fetch thread data
url = "{}/{}/res/{}.".format(self.root, board, thread)
url = f"{self.root}/{board}/res/{thread}."
self.session.headers["Referer"] = url + "html"
thread = self.request(url + "json").json()
thread["postId"] = thread["threadId"]
@@ -116,19 +116,18 @@ class _8chanBoardExtractor(_8chanExtractor):
self.cookies.set(self.cookies_tos_name(), "1", domain=self.root[8:])
pnum = text.parse_int(pnum, 1)
url = "{}/{}/{}.json".format(self.root, board, pnum)
url = f"{self.root}/{board}/{pnum}.json"
data = self.request(url).json()
threads = data["threads"]
while True:
for thread in threads:
thread["_extractor"] = _8chanThreadExtractor
url = "{}/{}/res/{}.html".format(
self.root, board, thread["threadId"])
url = f"{self.root}/{board}/res/{thread['threadId']}.html"
yield Message.Queue, url, thread
pnum += 1
if pnum > data["pageCount"]:
return
url = "{}/{}/{}.json".format(self.root, board, pnum)
url = f"{self.root}/{board}/{pnum}.json"
threads = self.request(url).json()["threads"]