[seiga] raise NotFoundError

This commit is contained in:
Mike Fährmann
2016-08-29 17:02:53 +02:00
parent 30d10cf595
commit 98877a45fb

View File

@@ -52,6 +52,8 @@ class SeigaImageExtractor(Extractor):
"""Get url for an image with id 'image_id'"""
url = "http://seiga.nicovideo.jp/image/source/" + image_id
response = self.session.head(url)
if response.status_code == 404:
raise exception.NotFoundError("image")
return response.headers["Location"].replace("/o/", "/priv/", 1)
@cache(maxage=30*24*60*60, keyarg=1)