zabop
zabop

Reputation: 7852

How to list all anonymous (so IP-public) edits made to Wikipedia from a specific IP address?

Lets say I have an IP address, for example the IP address of the Hungarian Parliament: 193.224.28.151

How can I get a list of all Wikipeida edits made using this IP address?

On a Tom Scott webpage, I read:

Here's a fact: Wikipedia stores the IP addresses of anonymous users.

Here's another fact: all of the web traffic from the Houses of Parliament is sent through one of two proxy servers — which means that every anonymous edit to Wikipedia from within Parliament is attributed to one of just two IP addresses.

I'm sure you can see where this is going.

I haven't found a repository for a project like this. If it can be done either within browser or maybe using Python, that would be great.

Upvotes: 3

Views: 1085

Answers (2)

xqt
xqt

Reputation: 333

Using Pywikibot you may use the MediaWiki API as follows:

import pywikibot
site = pywikibot('Wikipedia:en')
user = pyikibot.User(site, '193.224.28.2')

User is a class derived from pywikibot.Page which represents a user and there is a method to retrieve his contibutions. The method is contributions() which is a generator and yields pywikibot.Page (a Page object which can be used for further informations) , revid (the revision id), pywikibot.Timestamp (an object derived from datetime), comment (the edit summary). To get the last 5 Edits you may use:

contribs = list(user.contributions(total=5))

This retrieves entries like:

(Page('History of Croatia'), 282343057, Timestamp(2009, 4, 7, 14, 10, 7), '')

To get a range of ips you may use the corresponding site method usercontibs() but you have to upcast the content by yourself:

list(site.usercontribs(userprefix='193.224.28.', total=5))

For each entry you get a dict like this:

{'comment': '',
 'ns': 0,
 'pageid': 5574,
 'parentid': 281875336,
 'revid': 282343057,
 'timestamp': '2009-04-07T14:10:07Z',
 'title': 'History of Croatia',
 'user': '193.224.28.2',
 'userid': 0}

There are additional parameters for Site.usercontribs() method which are als usable for Page.contributions(). They can be used to filter the result, e.g. for a specific namespace or to retrieve only the topmost edit of pages. The documentation can be found here.

Upvotes: 2

user15517071
user15517071

Reputation: 614

You can use the Special:Contributions page to view contributions from a Wikipedia account, IP address or IP range. For example, https://en.wikipedia.org/wiki/Special:Contributions/193.224.28.151 lists the edits made from 193.224.28.151. You may also view edits from an IP range, like https://en.wikipedia.org/wiki/Special:Contributions/193.224.28.0/22.

If you wish to view contributions from Wikipedia accounts and individual IP addresses via Wikipedia's API, documentation and examples are available at https://www.mediawiki.org/wiki/API:Usercontribs

Upvotes: 4

Related Questions