Created
September 3, 2014 18:44
-
-
Save BatuhanK/3a90669ea52d6fb1dd71 to your computer and use it in GitHub Desktop.
Takip ediyoruz
This file contains 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
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