Search code examples
mediawikimediawiki-api

Retrieve the number of edits made by bots, registered users and anonymous users for a Wikipedia article


I'm trying to retrieve the number of edits made by bots, registered users and anonymous users separated for a specific wikipedia article.

I know I can get all revisions for an article by the revision prop in the MediaWiki API, I was thinking to use rvprop=user to return the name of the user who made the revision and do some processing on the retrieved data.

http://ar.wikipedia.org/w/api.php?action=query&prop=revisions&titles=%D8%A7%D8%A8%D9%86%20%D8%A7%D9%84%D9%86%D9%81%D9%8A%D8%B3&rvlimit=500&rvprop=timestamp%7Cuser|size&format=xml

for anonymous users revisions the anon="" occurs always so I can count it, but for the bots I can't find a way, as far as I know the bots names are not always written in a standardized way. Any idea how to do it? or an easier way maybe using another API to do this task?


Solution

  • The revisions API lets you list the flags for each revision - they include whether an edit was marked as a minor or bot edit. For example, see these revisions.

    However, it looks like the edits in your linked data set were made without flagging them as bot edits, either because those bots are not approved bots or because they forgot to set the flag. In that case, you're quite out of luck. You still can filter against the term bot in the username or the known list of bots in your wiki.