Created
November 27, 2012 19:55
-
-
Save danarbaugh/4156609 to your computer and use it in GitHub Desktop.
nodeJS+ntwitter
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
var twitter = require('ntwitter'); | |
var twit = new twitter({ | |
consumer_key: 'PASTE YOURS HERE', | |
consumer_secret: 'PASTE YOURS HERE', | |
access_token_key: 'PASTE YOURS HERE', | |
access_token_secret: 'PASTE YOURS HERE' | |
}); | |
var userID = PASTE YOUR NUMERIC TWITTER ID HERE; | |
success = function(result){ | |
console.log(result); | |
} | |
var friends=[]; | |
prune = function(err, result){ | |
var idList = result; | |
for(i=0;i<idList.length;i++){ | |
friends[i]=idList[i]; | |
} | |
twit.getFollowersIds(userID, function(err, response) { | |
var foundUsers=[]; | |
for(i=0;i<response.length;i++){ | |
var userIndex = friends.indexOf(response[i]); | |
if(userIndex!=-1)friends.splice(userIndex, 1); | |
} | |
for(i=0;i<friends.length;i++) { | |
twit.destroyFriendship(friends[i], function (err,cb) { | |
console.log('Removed ID #: ' + cb); | |
}); | |
} | |
}); | |
} | |
twit.getFriendsIds(userID, prune); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment