Topic: e621 API Binary Search issue

Posted under e621 Tools and Applications

Hi,

I wanted to ask if someone knows how can I list the quantity of posts or pages for a tag search over the API, because sometime ago I made several Telegram Bots, a C# WPF Application, and an Android Application using e621 API, so, for the Telegram Bots, the application needed to know how many pages were in a certain tag search, so it could send a random image, and in the case of the WPF Application, it needed to know how many images or items were in a search so it could start a mass download with a progress bar.

So my best approach was to implement a Binary Search starting from page 5000 or so, in case someone just searched for a very very common tag, it initially worked, but some time later all the applications failed and that's because of the API rate limit, so right now I can't implement a fast binary search because that could exceed the API rate, I could maybe make a queue of requests that can just be sent 1 every 500 ms, but starting from page 5000 in the worst case scenario that would take like 20 steps, that means waiting 10 seconds for the binary search to finish, and another second or so for the bot to send the file or some ms to send the link of the item.

Is there any way to make what I want to implement without having to wait for a binary search or throttling the requests is the only option?

Thanks for any help

Updated by Mantikor

  • 1