private void DoContactsFollow() { int todo = Rand.Next(Config.BotFollowTaskBatchMinLimit, Config.BotFollowTaskBatchMaxLimit); int c = Data.ContactsToFollow.Count; while (Data.ContactsToFollow.TryDequeue(out string uri) && todo > 0) { if (!MoveTo(uri)) { Log.LogWarning("ACTION STOPED : INSTAGRAM RETURN ERROR ON ({0})", uri); break; // no retry } MyContactsInTryout.Add(uri); if (Selenium.GetElements(Config.CssContactFollow).Any()) // manage the already followed like this { WaitBeforeFollowHumanizer(); Selenium.Click(Config.CssContactFollow); Data.MyContacts.Add(uri); WaitHumanizer(); // the url relad may break a waiting ball // issue detection : too many actions lately ? should stop for 24-48h... Selenium.CrashIfPresent(Config.CssActionWarning, "This action was blocked. Please try again later"); todo--; } else { Data.MyContactsBanned.Add(uri); // avoid going back each time to a "requested" account } } Log.LogDebug("$ContactsToFollow -{0}", c - Data.ContactsToFollow.Count); }
private void DoContactsUnfollow() { int todo = Rand.Next(Config.BotUnfollowTaskBatchMinLimit, Config.BotUnfollowTaskBatchMaxLimit); int c = Data.ContactsToUnfollow.Count; while (Data.ContactsToUnfollow.TryDequeue(out string uri) && todo > 0) { if (!MoveTo(uri)) { Log.LogWarning("ACTION STOPED : Instagram RETURN ERROR ({0})", uri); break; // no retry } bool process = false; // with triangle if (Selenium.GetElements(Config.CssContactUnfollowButton).Any()) // manage the already unfollowed like this { WaitBeforeFollowHumanizer(); Selenium.Click(Config.CssContactUnfollowButton); process = true; } // without triangle else if (Selenium.GetElements(Config.CssContactUnfollowButtonAlt).Any()) // manage the already unfollowed like this { WaitBeforeFollowHumanizer(); Selenium.Click(Config.CssContactUnfollowButtonAlt); process = true; } if (process) { WaitHumanizer(); Selenium.Click(Config.CssContactUnfollowConfirm); WaitHumanizer(); // the url relad may break a waiting ball // issue detection : too many actions lately ? should stop for 24-48h... Selenium.CrashIfPresent(Config.CssActionWarning, "This action was blocked. Please try again later"); Data.MyContacts.Remove(uri); MyContactsInTryout.Remove(uri); Data.MyContactsBanned.Add(uri); todo--; } } Log.LogDebug("$ContactsToUnfollow -{0}", c - Data.ContactsToUnfollow.Count); }
private void AuthLogin() { if (!MoveTo(Config.UrlLogin)) { throw new NotSupportedException("INSTAGRAM RETURN ERROR ON " + Config.UrlLogin); } if (!string.IsNullOrWhiteSpace(Config.BotUserEmail)) { Selenium.InputWrite(Config.CssLoginEmail, Config.BotUserEmail); if (!string.IsNullOrWhiteSpace(Config.BotUserPassword)) { Selenium.InputWrite(Config.CssLoginPassword, Config.BotUserPassword); Selenium.EnterKey(Config.CssLoginPassword); } else { Log.LogWarning("Waiting user manual password validation..."); } WaitUrlStartsWith(Config.UrlRoot); // loading may take some time WaitHumanizer(); // after WaitUrlStartsWith because 1st loading may take extra time // Ignore the notification modal popup Selenium.CrashIfPresent(Config.CssLoginUnusual, "Unusual Login Attempt Detected"); // Ignore the enable notification on your browser modal popup Selenium.ClickIfPresent(Config.CssLoginWarning); // who am i ? Selenium.Click(Config.CssLoginMyself); // must be here, else the auth have failed WaitHumanizer(); Data.UserContactUrl = Selenium.Url; if (Data.UserContactUrl.EndsWith('/')) // standardize { Data.UserContactUrl = Data.UserContactUrl.Remove(Data.UserContactUrl.Length - 1); } Data.CookiesInitDate = DateTime.UtcNow; } else { throw new FormatException("BotUserEmail required !"); } }
private void DoPhotosLike(bool doFollow = true, bool doLike = true) { int todo = Rand.Next(Config.BotLikeTaskBatchMinLimit, Config.BotLikeTaskBatchMaxLimit); int c = Data.PhotosToLike.Count; while (Data.PhotosToLike.TryDequeue(out string uri) && todo > 0) { if (!MoveTo(uri)) { Log.LogWarning("ACTION STOPED : Instagram RETURN ERROR ({0})", uri); break; // no retry } if (doLike && Selenium.GetElements(Config.CssPhotoLike).Any()) // manage the already unfollowed like this { WaitBeforeLikeHumanizer(); Selenium.Click(Config.CssPhotoLike); WaitHumanizer(); // TODO Add in the folowed list, else will be detected in 48h // issue detection : too many actions lately ? should stop for 24-48h... Selenium.CrashIfPresent(Config.CssActionWarning, "This action was blocked. Please try again later"); } if (doFollow && Selenium.GetElements(Config.CssPhotoFollow).Any()) // manage the already unfollowed like this { WaitBeforeFollowHumanizer(); Selenium.Click(Config.CssPhotoFollow); WaitHumanizer(); // issue detection : too many actions lately ? should stop for 24-48h... Selenium.CrashIfPresent(Config.CssActionWarning, "This action was blocked. Please try again later"); } todo--; } Log.LogDebug("$PhotosToLike -{0}", c - Data.PhotosToLike.Count); }