sinkaroid / booru

Python bindings for booru imageboards
https://sinkaroid.github.io/booru
MIT License
25 stars 3 forks source link

List index out of range #4

Open kotaruTWK opened 1 year ago

kotaruTWK commented 1 year ago

I cant seem to figure out the exact reason it occurs but some search terms result in a "list index out of range". im using this with a discord bot and so far everything is working except for a few random searches like searching safebooru for "rem" or rule34 for "princess_rosalina". (Both of these searches work on the actual site itself. exact error: `[2022-10-08 20:08:46] [ERROR ] discord.client: Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python310\lib\site-packages\booru\client\safebooru.py", line 139, in search return better_object(self.not_random[randint(0, len(self.not_random))]) IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 409, in _run_event await coro(*args, **kwargs) File "C:\Users\xxxxx\Downloads\Python programs\waifu.py", line 109, in on_message res = await imgs.search(query=content, random=True, gacha=True) File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python310\lib\site-packages\booru\client\safebooru.py", line 148, in search raise ValueError(f"Failed to get data: {e}") ValueError: Failed to get data: list index out of range`

da-vinci-bot[bot] commented 1 year ago

Hey! @kotaruTWK You'll get a response soon! UwU

Click here to make your day UmU ![abc](https://gitlab.com/d0g/servant/-/raw/master/pout/94c88625944c4c92f37685fe0ea53ed3.jpg "UmU")
sinkaroid commented 1 year ago

Trying to update booru to 1.0.21 and give limit= property with 10-50.

Safebooru response "rem" with 100 is empty here: https://safebooru.org/index.php?page=dapi&s=post&q=index&tags=rem&limit=100&pid=1&json=1

You can validate the proper tags instead rem with: booru.client.safebooru.Safebooru.find_tags