Skip to content

Instantly share code, notes, and snippets.

@mk30
Created December 16, 2013 03:40
Show Gist options
  • Select an option

  • Save mk30/7981957 to your computer and use it in GitHub Desktop.

Select an option

Save mk30/7981957 to your computer and use it in GitHub Desktop.
global recent changes across different localwiki hosted at localwiki.net
var request = require('request');
var concat = require('concat-stream');
var u = 'http://localwiki.net/api/v2/page_version?format=json';
recch(u, 0)
function recch(url, numreq){
request(url).pipe(concat(function (body) {
var obj = JSON.parse(body);
if (numreq <= 2) {
recch('http://localwiki.net' + obj.meta.next, numreq + 1)
}
for (var i = 0; i < obj.objects.length; i++) {
var x = obj.objects[i];
var d = new Date(x.history_date)
console.log(
x.region.full_name,
'\n', d.toString(),
'\n', x.name,
'\n', x.region.resource_uri
);
}
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment