replace more '.format(…)' calls with f-strings (#7671)

This commit is contained in:
Mike Fährmann
2025-07-10 21:05:10 +02:00
parent a619638178
commit 096bc6f784
14 changed files with 54 additions and 78 deletions

View File

@@ -19,11 +19,10 @@ class PixnetExtractor(Extractor):
category = "pixnet"
filename_fmt = "{num:>03}_{id}.{extension}"
archive_fmt = "{id}"
url_fmt = ""
def __init__(self, match):
Extractor.__init__(self, match)
self.blog, self.item_id = match.groups()
self.blog, self.item_id = self.groups
self.root = f"https://{self.blog}.pixnet.net"
def items(self):
@@ -91,14 +90,13 @@ class PixnetImageExtractor(PixnetExtractor):
class PixnetSetExtractor(PixnetExtractor):
"""Extractor for images from a pixnet set"""
subcategory = "set"
url_fmt = "{}/album/set/{}"
directory_fmt = ("{category}", "{blog}",
"{folder_id} {folder_title}", "{set_id} {set_title}")
pattern = BASE_PATTERN + r"/album/set/(\d+)"
example = "https://USER.pixnet.net/album/set/12345"
def items(self):
url = self.url_fmt.format(self.root, self.item_id)
url = f"{self.root}/album/set/{self.item_id}"
page = self.request(url, encoding="utf-8").text
data = self.metadata(page)