sinkaroid / booru

Python bindings for booru imageboards

Home Page:https://sinkaroid.github.io/booru

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

List index out of range

kotaruTWK opened this issue · comments

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`

  • OS: windows 11
  • Python: 3.10.7

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


Click here to make your day UmU
abc

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