mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-23 03:02:50 +01:00
[tsumino] more useful error message (#161)
if Tsumino suspects a non-human user and refuses to send gallery pages
This commit is contained in:
parent
d36ec51e5a
commit
197d0e99a4
@ -119,12 +119,20 @@ class TsuminoGalleryExtractor(TsuminoBase, ChapterExtractor):
|
||||
|
||||
def get_images(self, page):
|
||||
url = "{}/Read/Load/?q={}".format(self.root, self.gallery_id)
|
||||
data = self.request(url, headers={"Referer": self.url}).json()
|
||||
base = self.root + "/Image/Object?name="
|
||||
headers = {"Referer": self.url}
|
||||
response = self.request(url, headers=headers, expect=(404,))
|
||||
|
||||
if response.status_code == 404:
|
||||
url = "{}/Read/View/{}".format(self.root, self.gallery_id)
|
||||
self.log.error(
|
||||
"Failed to get gallery JSON data. Visit '%s' in a browser "
|
||||
"and solve the CAPTCHA to continue.", url)
|
||||
raise exception.StopExtraction()
|
||||
|
||||
base = self.root + "/Image/Object?name="
|
||||
return [
|
||||
(base + text.quote(name), None)
|
||||
for name in data["reader_page_urls"]
|
||||
for name in response.json()["reader_page_urls"]
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user