private static void ColectPinterest(AccRepo repo) { while (true) { Console.WriteLine("Select account"); string input = Console.ReadLine(); AccountManager accountManager = new AccountManager(); if (input == "all") { for (int i = 1; i < repo.Accounts.Count(); i++) { selectedAcc = repo.Accounts.Where(y => y.Number == i).FirstOrDefault(); AddPinterestAcciunt(selectedAcc); } Console.WriteLine("end"); Console.ReadKey(); } defaultNumber = int.Parse(input); selectedAcc = repo.Accounts.Where(y => y.Number == defaultNumber).FirstOrDefault(); AddPinterestAcciunt(selectedAcc); } }
private static void OpenAll(AccRepo repo) { foreach (Account acc in repo.Accounts) { Thread.Sleep(new TimeSpan(0, 0, 7)); System.Diagnostics.Process.Start("YouLikeHits.exe", acc.Number.ToString()); } }
private static void MakeTimer(object state) { driver = ChromeInstance.Driver(); AccRepo repo = (AccRepo)state; Grab(repo); Console.ReadLine(); }
private static void Grab(AccRepo repo) { foreach (Account acc in repo.Accounts) { try { Console.WriteLine($"check {acc.Login}"); YoulikeHits sendAccount = new YoulikeHits(); driver = new AccountManager().GetLoginedDriver(acc); driver.Url = "https://youlikehits.com/addpinterest.php"; var cardDivs = driver.FindElementsByCssSelector(".cards"); foreach (RemoteWebElement item in cardDivs) { var userName = item.FindElementsByCssSelector("b"); sendAccount.YouPinterests.Add(new YouPinterest() { AccountUserName = userName[0].Text }); } driver.Url = "https://youlikehits.com/stats.php"; if (driver.FindElementByCssSelector("center a[href = 'buypoints.php'] font") != null) { Console.WriteLine($"{acc.Login}:{driver.FindElementByCssSelector("center a[href = 'buypoints.php'] font").Text}"); sendAccount.Point = driver.FindElementByCssSelector("center a[href = 'buypoints.php'] font").Text; } var x = driver.FindElementsByCssSelector("center a[href = 'bonuspoints.php']"); System.Diagnostics.Process.Start("YouLikeHits.exe", acc.Number.ToString()); driver.Url = "http://youlikehits.com/logout.php"; } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("omg"); } finally { driver.Url = "http://youlikehits.com/logout.php"; } } }
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(); }