NATION

PASSWORD

Ratelimit on loading images from NationStates?

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.
User avatar
Mechanocracy
Spokesperson
 
Posts: 121
Founded: Jun 12, 2022
Democratic Socialists

Ratelimit on loading images from NationStates?

Postby Mechanocracy » Sat Apr 13, 2024 6:33 am

I have a tampermonkey script that takes the banner page of NS and changes the styling of locked banners to include the image. This involves asking NationStates for its banner pictures.

Per the Script Rules for HTML site,
The rules described here apply to any kind of tool (standalone script, browser extension, custom stylesheet, etc.) that interacts with NationStates in any way that is not using the NationStates API.

Since this is interacting with NS outside of the API, the script is bound by the HTML rules- Alright.

Automatic requests are subject to a rate limit of 10 requests per minute (or one request every 6 seconds).

mm. Not alright.

Since loading an image is not described at all, one presumes that it is a Non-restricted action, and automatically performing a non-restricted action is bound by six seconds of waiting... Every time, that means that someone who doesn't have the majority of the now ~376 banners (wow!) in the game unlocked is subject to upwards of 20 minutes of waiting to view everything*.

Is my interpretation of the rules here correct? Because if it isn't, and I can just have my script go faster instead with image requests, it would make this tool much nicer.

*Since images are stored to cache, on repeat viewings I believe it should be possible to reduce that time since the browser needs to make fewer requests to NS, this presumes most images are not cached and that the script that cannot account for when it has gotten a resource from cache rather than the site (currently the case but hopefully will be changed in the future).

User avatar
Trotterdam
Postmaster-General
 
Posts: 10555
Founded: Jan 12, 2012
Left-Leaning College State

Postby Trotterdam » Sat Apr 13, 2024 4:21 pm

I would assume that since images are static files rather than dynamically-generated pages like practically all of NationStates's HTML, they put significantly less load on the server. In many cases, they're likely to be cached by CloudFlare without the request even reaching the NationStates server itself.

However, I am not an authority figure on this, so best to wait for someone who is.

For what it's worth, I have a page that hotlinks the banners. I've posted the link before and the site staff didn't complain, although it's possible it was obscure enough to have slipped their notice. Testing just now shows that the whole thing loads in less than a second, though, so it can't be that disruptive.


Return to Technical

Who is online

Users browsing this forum: No registered users

Advertisement

Remove ads