Skip to content

Commit

Permalink
[seiga] raise error when redirected to login page (#3401)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Dec 17, 2022
1 parent 68ce5f9 commit 7851a2c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gallery_dl/extractor/seiga.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ def get_image_url(self, image_id):
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):
Expand Down

0 comments on commit 7851a2c

Please sign in to comment.