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);
        }
Exemplo n.º 2
0
        private void DoContactsFollow()
        {
            int todo = PseudoRand.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 : FLICKR RETURN ERROR 500 ON ({0})", uri);
                    break; // no retry
                }
                try
                {
                    MyContactsInTryout.Add(uri);
                    if (Selenium.GetElements(Config.CssContactFollow).Any()) // manage the already followed like this
                    {
                        Selenium.Click(Config.CssContactFollow);
                        Data.MyContacts.Add(uri);
                        WaitHumanizer();// the url relad may break a waiting ball

                        // issue detection : Manage limit to 20 follow on a new account : https://www.flickr.com/help/forum/en-us/72157651299881165/  Then there seem to be another limit
                        if (Selenium.GetElements(Config.CssContactFollow).Any()) // may be slow so will wait if required
                        {
                            WaitHumanizer();                                     // give a last chance
                            if (Selenium.GetElements(Config.CssContactFollow, true, true).Any())
                            {
                                Log.LogWarning("ACTION STOPED : SEEMS USER CAN'T FOLLOW ({0}) ANYMORE", uri);
                                break; // no retry
                            }
                        }
                        // hang issue detection
                        if (Selenium.GetElements(Config.CssModalWaiterBalls, true, true).Any())     // will not wait
                        {
                            WaitHumanizer();                                                        // give a last chance...
                            if (Selenium.GetElements(Config.CssModalWaiterBalls, true, true).Any()) // will not wait
                            {
                                Log.LogWarning("ACTION STOPED : SEEMS FLICKR HANG ON THIS CONTACT ({0})", uri);
                                break; // no retry
                            }
                        }
                        todo--;
                    }
                }
                catch (Exception ex)
                {
                    Log.LogWarning(default, ex, "ACTION STOPED : {0}", ex.GetBaseException().Message);
        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);
        }