From d004a957f94fd6923212c3c63b91aaac5c00e571 Mon Sep 17 00:00:00 2001 From: dotnet Date: Fri, 13 Oct 2023 13:47:18 -0400 Subject: [PATCH] Fix tag combination and url conversion. --- gelbooru_poster.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gelbooru_poster.py b/gelbooru_poster.py index 9f0bbdb..7ffca55 100644 --- a/gelbooru_poster.py +++ b/gelbooru_poster.py @@ -44,10 +44,10 @@ class BotInstance: image_number = random.randint(0, 100) # Get the JSON data from the API if self.gelbooru_tags_exclude != "": - gelbooru_tags_exclude = "+" + self.gelbooru_tags_exclude + gelbooru_tags_exclude = " " + self.gelbooru_tags_exclude else: gelbooru_tags_exclude = "" - gelbooru_json = requests.get(self.gelbooru_url + urllib.parse.quote_plus(self.gelbooru_tags) + urllib.parse.quote_plus(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) # Make sure there are images on the page if 'post' not in gelbooru_json: