Skip to content

Instantly share code, notes, and snippets.

@Pchelolo
Created January 2, 2018 22:47
Show Gist options
  • Save Pchelolo/2f291fb5adbdcc7af68fe4852290e2fe to your computer and use it in GitHub Desktop.
Save Pchelolo/2f291fb5adbdcc7af68fe4852290e2fe to your computer and use it in GitHub Desktop.
'use strict';
const preq = require('preq');
const get = (c) => {
let uri = 'https://en.wikipedia.org/w/api.php?action=query&prop=transcludedin&titles=Template:Sidebar_person&format=json';
if (c) {
uri += '&continue=||&ticontinue=' + c;
}
return preq.get(uri)
.then((res) => {
const a = res.body.query.pages['55149776'].transcludedin.map(p => encodeURIComponent(p.title.replace(' ', '_')));
a.map(page => {
preq.get('https://en.wikipedia.org/api/rest_v1/page/mobile-sections/' + page)
.then(sections => {
if (JSON.stringify(sections).indexOf('Fuck') > -1) {
console.log('Purged ' + page);
}
})
})
if (res.body.continue) {
return get(res.body.continue.ticontinue);
}
});
};
get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment