I've got a tool which parses sockpuppet investigation (SPI) pages and does some analysis. One of the steps is I need to validate that all of the usernames found in the SPI report are valid. I do that by sequentially calling usercontribs on each name with uclimit=1 and seeing if I get a baduser error.
This works, but it's slow because I need to make 1 API call for each user. For a big SPI case, the time to do this swamps everything else. Is there a more efficient way to do this? Some API call where I can give it a bunch of usernames in a batch and have it tell me which ones are invalid? Alternatively, is there a regex I could apply on the client side to test if a username is valid?
The most common type of invalid name I see is when somebody puts down an iprange (i.e. 1.2.4.0/24) as a username. Testing for that client-side would be trivial, but it might miss some others.