Since August is done I was curious to see what anonymous edits had been made last month from House of Commons IPs, following on from Anonymous July Wikipedia edits from the House of Commons. It seemed from what I saw on @gccaedits that there was less going on, and indeed there was: only 18 English edits and two French. (I didn’t run through all the others.)
I did it a little differently this time, because I’d read about a simpler R library for handling JSON, jsonlite, and wanted to try it out. For fun I did it all in Org mode, which worked very well.
(I can’t highlight this snippet nicely because Org isn’t one of the languages supported by Pygments, the thing that does the fancy syntax highlighting here. So I will include screenshots!)
I have this in an Org file:
#+NAME: get-edits
#+BEGIN_SRC R :session :colnames yes
library(jsonlite)
t <- fromJSON("https://en.wikipedia.org/w/api.php?action=query&list=usercontribs&ucuserprefix=192.197.82&ucstart=2014-08-01T00:00:00Z&ucend=2014-08-31T23:59:59Z&ucdir=newer&uclimit=500&ucprop=title|timestamp|ids|sizediff&format=json")
edits <- t$query$usercontribs
edits
#+END_SRC
It’s a very simple bit of R that runs when I hit C-c C-c:
- use the
jsonlite
library -
download [all August anonymous Wikipedia edits made from House of Commons IPs](https://en.wikipedia.org/w/api.php?action=query&list=usercontribs&ucuserprefix=192.197.82&ucstart=2014-08-01T00:00:00Z&ucend=2014-08-31T23:59:59Z&ucdir=newer&uclimit=500&ucprop=title timestamp ids sizediff&format=json), ingest it and turn it into a data frame - pick out the bit I’m interested in
- show it (as a table, with column names)
It looks like this in Emacs:
I can write another bit of code, this time in Ruby, to read in data from that table and do something with it! I just hit C-c C-c on the Ruby and it generates the output below.
#+NAME: make-links
#+BEGIN_SRC ruby :var edits=get-edits :results output
edits.each do |i|
puts %Q(<a href="https://en.wikipedia.org/w/index.php?pageid=#{i[2]}&oldid=#{i[3]}&diff=prev">#{i[6]}</a>)
end
#+END_SRC
#+RESULTS: make-links
#+begin_example
* [List of Manitoba senators](https://en.wikipedia.org/w/index.php?pageid=2134040&oldid=619454519&diff=prev)
* [Nepean Point](https://en.wikipedia.org/w/index.php?pageid=14210460&oldid=620245661&diff=prev)
* [Costas Menegakis](https://en.wikipedia.org/w/index.php?pageid=31680994&oldid=621366430&diff=prev)
* [Peter Mansbridge](https://en.wikipedia.org/w/index.php?pageid=252543&oldid=622065451&diff=prev)
* [Stephen I of Hungary](https://en.wikipedia.org/w/index.php?pageid=29594&oldid=622065708&diff=prev)
* [Peter Mansbridge](https://en.wikipedia.org/w/index.php?pageid=252543&oldid=622066606&diff=prev)
* [Union Station (Toronto)](https://en.wikipedia.org/w/index.php?pageid=455632&oldid=619445767&diff=prev)
* [Union Station (Toronto)](https://en.wikipedia.org/w/index.php?pageid=455632&oldid=619456111&diff=prev)
* [Panda Game (Ottawa vs. Carleton)](https://en.wikipedia.org/w/index.php?pageid=42957962&oldid=619967585&diff=prev)
* [Thanh Hai Ngo](https://en.wikipedia.org/w/index.php?pageid=36946133&oldid=620135598&diff=prev)
* [Glen Murray (politician)](https://en.wikipedia.org/w/index.php?pageid=643449&oldid=620415644&diff=prev)
* [Bean](https://en.wikipedia.org/w/index.php?pageid=4487&oldid=621354440&diff=prev)
* [Timeline of the Euromaidan](https://en.wikipedia.org/w/index.php?pageid=41793795&oldid=621936488&diff=prev)
* [Party Whip (Canada)](https://en.wikipedia.org/w/index.php?pageid=4050285&oldid=622222552&diff=prev)
* [Voluntary Aid Detachment](https://en.wikipedia.org/w/index.php?pageid=4940035&oldid=622907822&diff=prev)
* [David Anderson (Saskatchewan politician)](https://en.wikipedia.org/w/index.php?pageid=383866&oldid=623206768&diff=prev)
* [Dave Van Kesteren](https://en.wikipedia.org/w/index.php?pageid=3502825&oldid=619967138&diff=prev)
* [Larry Miller (Canadian politician)](https://en.wikipedia.org/w/index.php?pageid=1415770&oldid=621915107&diff=prev)
#+end_example
I wanted the output to be understood as HTML, but I couldn’t get that working. In any case, it’s no big deal, because I can move to a URL and hit C-c C-o to open it in my browser, and I can just copy it here and add explanations of each edit.
From 192.197.82.153
- List of Manitoba senators: subtle wording change, possibly shrewd or sophist
- Nepean Point: update mention of Canadian Museum of History with its new name
- Costas Menegakis: change a fancy apostrophe to a plain one
- Peter Mansbridge: vandalism (change “Mansbridge is a Christian” to “Mansbridge is well known within the BDSM community”)
- Stephen I of Hungary: vandalism (add “Harper” to “Saint Steven”)
- Peter Mansbridge: vandalism (adding a spurious citation)
From 192.197.82.203
- Union Station (Toronto): update “Skydome” to “Rogers Centre”
- Union Station (Toronto): revert the edit that reverted that previous edit
- Panda Game (Ottawa vs. Carleton): good copy-editing
- Thanh Hai Ngo: awkward small self-promoting edit (I emailed him after this edit but haven’t had a reply)
- Glen Murray (politician): add uncited and misspelled details of undergraduate education
- Bean: vandalism (“And still today, they will make you fart like there is no tomorrow.”)
- Timeline of the Euromaidan: useful copy-editing
- Party Whip (Canada): update name of deputy chief whip
- Voluntary Aid Detachment: “added E.M. Delafied to list of famous VAD nurse”
- David Anderson (Saskatchewan politician): change photograph to moustacheless and presumably newer version of MP
- Dave Van Kesteren: major rewrites with new information, some self-promoting, but it’s an improvement
- Larry Miller (Canadian politician): happy news—changed “two grandchildren” to “three grandchildren”
The same odd mix of good and bad we saw before.
What about French Wikipedia? Only two there, each from a different IP than above. Strange.
From 192.197.82.155 (fr)
- Ève Péclet: rewrite entry for this Quebec NDP MP
From 192.197.82.205 (fr)
- Mathieu Ravignat: correct MP’s riding
The useful edits are great, but still with the vandalism! And who knows what edits are being done in named accounts. Twenty anonymous edits this month … I’m curious to see what happens when parliament is sitting.
(Updated 2014-09-03 08:34:27 -0400 to correct the Ruby snippet.)