Limit page count to 200 as per gelbooru API limits
This commit is contained in:
parent
5ec4ebb874
commit
96bb45f11b
|
@ -62,6 +62,8 @@ class BotInstance:
|
||||||
gelbooru_tags_exclude = ""
|
gelbooru_tags_exclude = ""
|
||||||
gelbooru_json = requests.get(self.gelbooru_url + urllib.parse.quote_plus(self.gelbooru_tags + gelbooru_tags_exclude) + "&pid=" + str(page_number)).json()
|
gelbooru_json = requests.get(self.gelbooru_url + urllib.parse.quote_plus(self.gelbooru_tags + gelbooru_tags_exclude) + "&pid=" + str(page_number)).json()
|
||||||
max_pages = gelbooru_json['@attributes']['count'] // 100 + (1 if gelbooru_json['@attributes']['count'] % 100 != 0 else 0)
|
max_pages = gelbooru_json['@attributes']['count'] // 100 + (1 if gelbooru_json['@attributes']['count'] % 100 != 0 else 0)
|
||||||
|
if max_pages > 200:
|
||||||
|
max_pages = 200
|
||||||
# Make sure there are images on the page
|
# Make sure there are images on the page
|
||||||
if 'post' not in gelbooru_json:
|
if 'post' not in gelbooru_json:
|
||||||
return None, None, None, max_pages
|
return None, None, None, max_pages
|
||||||
|
|
Loading…
Reference in New Issue