[exhentai] raise proper exception for 'unavailable' galleries
This commit is contained in:
@@ -46,8 +46,11 @@ class ExhentaiGalleryExtractor(Extractor):
|
|||||||
yield Message.Cookies, self.session.cookies
|
yield Message.Cookies, self.session.cookies
|
||||||
|
|
||||||
url = "https://exhentai.org/g/{}/{}/".format(self.gid, self.token)
|
url = "https://exhentai.org/g/{}/{}/".format(self.gid, self.token)
|
||||||
page = self.request(url).text
|
response = self.session.get(url)
|
||||||
if page.startswith(("Key missing", "Gallery not found")):
|
page = response.text
|
||||||
|
if response.status_code == 404 and "Gallery Not Available" in page:
|
||||||
|
raise exception.AuthorizationError()
|
||||||
|
if page.startswith(("\ufeffKey missing", "\ufeffGallery not found")):
|
||||||
raise exception.NotFoundError("gallery")
|
raise exception.NotFoundError("gallery")
|
||||||
data = self.get_job_metadata(page)
|
data = self.get_job_metadata(page)
|
||||||
self.count = int(data["count"])
|
self.count = int(data["count"])
|
||||||
|
|||||||
Reference in New Issue
Block a user