Skip to content

Instantly share code, notes, and snippets.

@whinette
Created April 24, 2019 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whinette/4bde849d69a16356abdd995efff2f6aa to your computer and use it in GitHub Desktop.
Save whinette/4bde849d69a16356abdd995efff2f6aa to your computer and use it in GitHub Desktop.
const PixivApi = require('pixiv-api-client');
const pixiv = new PixivApi();
//insert there your export from pixivutil2 (option e) in an array: [id1, id2, id3]
const bms = [11]
var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200);
res.end('Hi everybody!');
var min = 2000
var max = 5000
pixiv.login('username', 'password', true).then(() => {
(function loop(i) {
if (i < bms.length) new Promise((resolve, reject) => {
console.log(i, bms[i]);
setTimeout( () => {
// pixiv.unfollowUser(bms[i]);
pixiv.followUser(bms[i], 'public');
resolve();
}, Math.random() * (max - min) + min);
}).then(loop.bind(null, i+1));
})(0);
});
pixiv.logout();
});
server.listen(8081);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment