[common] add 'request_location()' convenience function

This commit is contained in:
Mike Fährmann
2025-04-18 22:43:26 +02:00
parent d6311bbf75
commit 88f1541a83
10 changed files with 29 additions and 64 deletions

View File

@@ -516,16 +516,10 @@ class PixivMeExtractor(PixivExtractor):
pattern = r"(?:https?://)?pixiv\.me/([^/?#]+)"
example = "https://pixiv.me/USER"
def __init__(self, match):
PixivExtractor.__init__(self, match)
self.account = match.group(1)
def items(self):
url = "https://pixiv.me/" + self.account
data = {"_extractor": PixivUserExtractor}
response = self.request(
url, method="HEAD", allow_redirects=False, notfound="user")
yield Message.Queue, response.headers["Location"], data
url = "https://pixiv.me/" + self.groups[0]
location = self.request_location(url, notfound="user")
yield Message.Queue, location, {"_extractor": PixivUserExtractor}
class PixivWorkExtractor(PixivExtractor):