1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[seiga] raise error when redirected to login page (#3401)

This commit is contained in:
Mike Fährmann 2022-12-17 12:45:15 +01:00
parent 68ce5f965d
commit 7851a2c520
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -44,7 +44,11 @@ class SeigaExtractor(Extractor):
url = "{}/image/source/{}".format(self.root, image_id)
response = self.request(
url, method="HEAD", allow_redirects=False, notfound="image")
return response.headers["Location"].replace("/o/", "/priv/", 1)
location = response.headers["location"]
if "nicovideo.jp/login" in location:
raise exception.StopExtraction(
"HTTP redirect to login page (%s)", location.partition("?")[0])
return location.replace("/o/", "/priv/", 1)
class SeigaUserExtractor(SeigaExtractor):