public ActionResult Followers() { ViewBag.Message = "Your followers page."; user currentUser = Session["user"] as user; FollowersModel fm = new FollowersModel(); fm.BuildModelForUser(currentUser.id); return(PartialView("_Followers", fm)); }
public void FollowCategory(string user, int categoryId) { var follower = new FollowersModel { CategoryModelId = categoryId, Id = user }; var db = new ApplicationDbContext(); db.Followers.Add(follower); db.SaveChanges(); }
public FollowersModel GetFollowers(string id, string maxResults, string paginationToken) { UsersClient client = new UsersClient(_oAuthInfo); // these override the base behaviour for the user service when fetching followers string tweetFields = "attachments,author_id,context_annotations,conversation_id,created_at,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,public_metrics,organic_metrics,promoted_metrics,possibly_sensitive,referenced_tweets,reply_settings,source,text,withheld"; string userFields = "created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld"; string followersJson = client.GetFollowers(id, _expansionsFields, maxResults, paginationToken, tweetFields, userFields); FollowersDTO resultsDTO = JsonConvert.DeserializeObject <FollowersDTO>(followersJson); FollowersModel models = _iMapper.Map <FollowersDTO, FollowersModel>(resultsDTO); return(models); }
public FollowersModel DetermineFollowersType(string screenName, int numberOfFollowers) { var user = User.GetUserFromScreenName(screenName); if (user == null) { return(new FollowersModel()); } var followersList = User.GetFollowers(screenName, numberOfFollowers); var botList = new List <IUser>(); var resultList = new List <UserModel>(); foreach (var follower in followersList) { var accountActivityDecision = DetermineAccountActivity(follower.ScreenName); var accountAnonimityDecision = DetermineAccountAnonimity(follower.ScreenName); var accountTimelineModel = DetermineAccountTimeline(follower.ScreenName); var f = DetermineBotAnalysis(follower.ScreenName); resultList.Add(f); var isBot = DetermineIfBotOrNot(accountActivityDecision, accountAnonimityDecision, accountTimelineModel.TimelineDecision); if (isBot) { botList.Add(follower); } } var followersModel = new FollowersModel(); followersModel.UserModelList = resultList; followersModel.NumberOfBots = botList.Count; followersModel.NumberOfFollowersTested = numberOfFollowers; return(followersModel); }
static void Main(string[] args) { string _ConsumerKey = ConfigurationManager.AppSettings.Get("ConsumerKey"); string _ConsumerSecret = ConfigurationManager.AppSettings.Get("ConsumerSecret"); string _AccessToken = ConfigurationManager.AppSettings.Get("AccessToken"); string _AccessTokenSecret = ConfigurationManager.AppSettings.Get("AccessTokenSecret"); OAuthInfo oAuthInfo = new OAuthInfo { AccessSecret = _AccessTokenSecret, AccessToken = _AccessToken, ConsumerSecret = _ConsumerSecret, ConsumerKey = _ConsumerKey }; HideReplyService hideRepliesService = new HideReplyService(oAuthInfo); HideReplyModel model = hideRepliesService.HideReply("1296341968176451585"); // Sampled Stream Service Test SampledStreamService streamService = new SampledStreamService(oAuthInfo); streamService.DataReceivedEvent += StreamService_DataReceivedEvent; streamService.StartStream("https://api.twitter.com/2/tweets/sample/stream?expansions=attachments.poll_ids,attachments.media_keys,author_id,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id", 100, 5); // Recent Search RecentSearchService searchService = new RecentSearchService(oAuthInfo); List <RecentSearchResultsModel> resultsModels = searchService.SearchTweets("iphone", 100, 3); // Tweet(s) TweetService tweetsService = new TweetService(oAuthInfo); TweetModel tweetModel = tweetsService.GetTweet("1293779846691270658"); List <string> tids = new List <string>(); tids.Add("1293779846691270658"); // social opinion tweet tids.Add("1293779846691270658"); // social opinion tweet TweetsModel tweetModels = tweetsService.GetTweets(tids); //// User(s) UserService userService = new UserService(oAuthInfo); UserModel userModel = userService.GetUser("socialopinions"); UserService userService2 = new UserService(oAuthInfo); UserModel userModel2 = userService2.GetUser("jamie_maguire1"); List <string> users = new List <string>(); users.Add("jamie_maguire1"); users.Add("socialopinions"); UsersModel usersResults = userService.GetUsers(users); UserService myUserService = new UserService(oAuthInfo); FollowersModel followers = myUserService.GetFollowers("958676983", "100", null); FollowingModel following = myUserService.GetFollowing("38906681", "100", null); // Metrics List <string> ids = new List <string>(); ids.Add("1258736674844094465"); // social opinion tweet TweetMetricsService service = new TweetMetricsService(oAuthInfo); List <TweetMetricModel> metricModels = service.GetTweetMetrics(ids); // testing Filtered Stream FilteredStreamService filteredStreamService = new FilteredStreamService(oAuthInfo); List <FilteredStreamRule> rules = filteredStreamService.CreateRule( new MatchingRule { tag = "testing #iPhone", Value = "#iphone" }); filteredStreamService.DataReceivedEvent += FilteredStreamService_DataReceivedEvent; filteredStreamService.StartStream("https://api.twitter.com/2/tweets/search/stream?tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,entities,geo,id,in_reply_to_user_id,lang,public_metrics,possibly_sensitive,referenced_tweets,source,text,withheld&expansions=author_id&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld", 10, 5); }