Last active
October 15, 2016 22:16
-
-
Save Elrashid/798075c6d773c4487fc904852c08f1de to your computer and use it in GitHub Desktop.
Automate adding #Twitter User Not Flowing Back to a List and unfollow them with C# and Tweetinvi
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
Auth.SetUserCredentials("CONSUMER_KEY", "CONSUMER_SECRET", "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET"); | |
var user = Tweetinvi.User.GetUserFromScreenName("osman_elrashid"); | |
RateLimit.RateLimitTrackerMode = RateLimitTrackerMode.TrackAndAwait; | |
var lists = user.GetOwnedLists(Int32.MaxValue); | |
var followerIds = user.GetFollowerIds(Int32.MaxValue); | |
var friendIds = user.GetFriendIds(Int32.MaxValue); | |
var followersCount = followerIds.Count(); | |
var friendsCount = friendIds.Count(); | |
var followersFlowingBack = followerIds.Where(x => friendIds.Contains(x) ).Count(); | |
var followersNotFlowingBack = followerIds.Where(x => !friendIds.Contains(x) ).Count(); | |
var friendsFlowingBack = friendIds.Where(x => followerIds.Contains(x)).Count(); | |
var friendsNotFlowingBack = friendIds.Where(x => !followerIds.Contains(x)).Count(); | |
var friendsNotFlowingBack = friendIds.Where(x => !followerIds.Contains(x)); | |
var list = TwitterList.CreateList("Thanks", Tweetinvi.Models.PrivacyMode.Public , "Thanks"); | |
foreach (var friendNotFlowingBack in friendsNotFlowingBack) | |
{ | |
list.AddMember(friendNotFlowingBack); | |
} | |
foreach (var friendNotFlowingBack in friendsNotFlowingBack) | |
{ | |
Friendship.FriendshipController.DestroyFriendshipWith(friendNotFlowingBack); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment