Skip to content

Instantly share code, notes, and snippets.

@KustoSan
Last active March 20, 2016 22:33
Show Gist options
  • Save KustoSan/6a47e01de59ce74fc0ac to your computer and use it in GitHub Desktop.
Save KustoSan/6a47e01de59ce74fc0ac to your computer and use it in GitHub Desktop.
// Originally made by Epictek
var username = "username";
var followerspage = 1;
var followers = [];
var a = false;
var getFollowers = setInterval(function() {
$.get("https://hummingbird.me/users?followers_of=" + username + "&page=" + followerspage, function(data) {
console.log(data);
if (data.users.length === 0) {
clearInterval(getFollowers);
a = true;
getNonFollowers();
} else {
$.each(data.users, function(i, u) {
followers.push(u.id);
});
console.log(followers);
}
});
followerspage++;
}, 500);
var followingpage = 1;
var following = [];
var b = false;
var getFollowing = setInterval(function() {
$.get("https://hummingbird.me/users?followed_by=" + username + "&page=" + followingpage, function(data) {
console.log(data);
if (data.users.length === 0) {
clearInterval(getFollowing);
b = true;
getNonFollowers();
} else {
$.each(data.users, function(i, u) {
following.push(u.id);
});
console.log(following);
}
});
followingpage++;
}, 500);
function getNonFollowers() {
if (a === true && b === true) {
var nonFollowers = [];
$.each(following, function(i, value) {
if ($.inArray(value, followers) == -1) {
nonFollowers.push(value);
console.log("Non follower: " + value);
}
});
console.log(nonFollowers);
$.each(nonFollowers, function(i, user) {
if (confirm("Do you want to unfollow " + user + "?")){
$.post("https://hummingbird.me/users/" + user + "/follow")
}
});
} else {
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment