Created
January 2, 2018 22:47
-
-
Save Pchelolo/2f291fb5adbdcc7af68fe4852290e2fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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