コード例 #1
0
        static void Main(string[] args)
        {
            // Clear();
            AccRepo repo = new AccRepo();

            //var cookiesAcc = new AccountManager().Accounts();
            //List<Account> newList = new List<Account>();

            //foreach (Account acc in repo.Accounts)
            //{
            //    if (cookiesAcc.Contains(acc.Login))
            //    {
            //        newList.Add(acc);
            //    }
            //}


            //repo.Accounts = newList;
            //repo.Save();

            if (args.Count() != 0)
            {
                defaultNumber = Int32.Parse(args[0]);
            }
            else
            {
                foreach (var line in repo.Accounts)
                {
                    Console.WriteLine($"{line.Number},{line.Login},{line.Password}");
                }
                Console.WriteLine("pls choose login, grab, login,clear,account");

                string number = Console.ReadLine().Trim();

                if (number == "login")
                {
                    AccountManager manager = new AccountManager();
                    manager.LoginAll();
                }
                else if (number == "account")
                {
                    ColectPinterest(repo);
                    Console.ReadLine();
                }
                else if (number == "grab")
                {
                    Grab(repo);
                    Console.ReadLine();
                }

                else if (number == "clear")
                {
                    Clear();
                }

                defaultNumber = 1;
                Int32.TryParse(number, out defaultNumber);
            }
            Console.WriteLine("en  moment");

            while (true)
            {
                AccountManager accountManager = new AccountManager();
                selectedAcc = repo.Accounts.Where(y => y.Number == defaultNumber).FirstOrDefault();
                driver      = accountManager.GetLoginedDriver(selectedAcc);
                if (accountManager.Logined(selectedAcc))
                {
                    Console.Title = selectedAcc.Login;
                    Youtube youtube = new Youtube(driver);
                    try
                    {
                        youtube.Follow();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                else
                {
                    Console.Title = "user can`t login" + selectedAcc.Login;
                    break;
                }
            }

            AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);

            Console.ReadKey();
            driver.Quit();
            Console.ReadKey();
        }
コード例 #2
0
        private static void AddPinterestAcciunt(Account selectedAcc)
        {
            AccountManager accountManager = new AccountManager();

            driver = accountManager.GetLoginedDriver(selectedAcc);

            if (accountManager.Logined(selectedAcc))
            {
                driver.Url = "https://www.youlikehits.com/addpinterest.php";

                var links = driver.FindElementsByCssSelector(".cards a");
                for (int i = 0; i < links.Count; i++)
                {
                    try
                    {
                        driver.FindElementByCssSelector(".cards a").Click();


                        driver.Url = "https://www.youlikehits.com/addpinterest.php";
                    }

                    catch { }
                }


                var account = GUI.Account.GetAccountExtraInfo();



                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                string title           = (string)js.ExecuteScript("document.getElementById('addpage').setAttribute('style', '')");
                //   driver.FindElementByCssSelector(".mainfocusbody a").Click();



                int addedAccount = 0;
                var noobies      = account.Where(x => x.Followers == 0);
                int count        = 0;
                foreach (var item in noobies)
                {
                    try
                    {
                        if (!already.Contains(item) && item.Followers != null)
                        {
                            already.Add(item);
                            driver.FindElementByCssSelector("#url").Clear();
                            driver.FindElementByCssSelector("#url").SendKeys(item.UserName);
                            driver.FindElementByCssSelector("#verifybutton").Click();

                            if (addedAccount > 11)
                            {
                                break;
                            }

                            if (driver.FindElementsByCssSelector("#verify .mainfocusheader").Count == 0)
                            {
                                addedAccount++;
                                continue;
                            }
                            else
                            {
                                var have = driver.FindElementByCssSelector("#verify .maintable").Text;
                                if (have.Contains("up to 10 Pinterest"))
                                {
                                    break;
                                }
                            }
                            var x = driver.FindElementByCssSelector("#verify .mainfocusheader").Text;
                            if (!driver.FindElementByCssSelector("#verify .mainfocusheader").Text.ToLower().Contains("ops"))
                            {
                                addedAccount++;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("catch" + ex.Message);
                    }
                    count++;

                    if (addedAccount == 10 | count > 40)
                    {
                        break;
                    }
                }
                driver.Url = "https://www.youlikehits.com/addpinterest.php";
                var select = driver.FindElementsByCssSelector(".cards select");
                foreach (var item in select)
                {
                    var selectElement = new SelectElement(item);
                    selectElement.SelectByValue("20");
                    Console.WriteLine("done");
                }
            }
            else
            {
                Console.Title = "user can`t login" + selectedAcc.Login;
            }
        }