Skip to content

Instantly share code, notes, and snippets.

@BatuhanK
Created September 3, 2014 18:44
Show Gist options
  • Save BatuhanK/3a90669ea52d6fb1dd71 to your computer and use it in GitHub Desktop.
Save BatuhanK/3a90669ea52d6fb1dd71 to your computer and use it in GitHub Desktop.
Takip ediyoruz
var request = require('request');
var redis = require("redis"),
client = redis.createClient();
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
for (var i = 0; i < numCPUs; i++)
cluster.fork();
cluster.on('disconnect', function(worker) {
console.log('yeni fork geliyor');
cluster.fork();
});
} else {
client.srandmember(['twitter_id_set', 300], function(err, reply) {
var options = {
url: 'https://twitter.com/welcome/follow_all_friends',
headers: {
'Accept': 'application/json, text/javascript, */*; q=0.01',
'Cookie':'',
'x-phx' : true,
'X-Requested-With' : 'XMLHttpRequest'
}
};
var r = request.post(options, function optionalCallback (err, httpResponse, body) {
if (err) {
console.log(err);
process.exit(0);
}
console.log('DONE');
process.exit(0);
})
var form = r.form()
for(i in reply) {
form.append('user_ids[]', reply[i])
client.srem('twitter_id_set',reply[i]);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment