예제 #1
0
        private void addXmlToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var fbd = new FolderBrowserDialog())
            {
                DialogResult result = fbd.ShowDialog();

                if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
                {
                    string[] files = Directory.GetFiles(fbd.SelectedPath);

                    foreach (var path in files)


                    {
                        if (path.Contains(".xml"))
                        {
                            DriverInstance drivers = new DriverInstance();
                            drivers.InitDriver(false);
                            Console.WriteLine(path);
                            Pinterest pin = new Pinterest(drivers.Driver);
                            pin.MakeLogin(manager.Load(path));
                            if (!pin.CheckLogin())
                            {
                                pin.MakeLogin(Path.GetFileNameWithoutExtension(path), "trance_333");
                            }

                            if (pin.CheckLogin())
                            {
                                if (pin.ValidName() == false)
                                {
                                    pin.FillName();
                                }
                                try { pin.AddImage(); }
                                catch { }


                                Account acc = new Account();
                                acc.Email    = Path.GetFileNameWithoutExtension(path);
                                acc.Password = "******";
                                acc          = pin.AccountInfo(acc);
                                AccountManager.Accounts.Add(acc);
                                try
                                {
                                    AccountManager.GetInstance().Save();
                                }
                                catch
                                { }
                            }
                            drivers.SuperQuit();
                        }
                        File.Delete(path);
                    }
                    ;
                }
            }
        }
예제 #2
0
파일: Status.cs 프로젝트: mauguzun/godlove
        private Account CheckOneAccount(Account acc, DriverInstance drivers)
        {
            AppendTextBox("check" + acc.Email);
            try
            {
                Pinterest pin = new Pinterest(drivers.Driver);
                acc = pin.AccountInfo(acc);
            }

            catch (Exception ex)
            {
                acc.Status = "account not exist";
                AccountManager.GetInstance().Save();
            }


            return(acc);
        }
예제 #3
0
        private void renameAccountToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Thread t = new Thread(() =>
            {
                this.SetInfo("start rename ");
                Parallel.ForEach(SelectAccount(), new ParallelOptions()
                {
                    MaxDegreeOfParallelism = 3
                }, (acc) =>
                {
                    acc.Proxie = null;
                    DriverInstance instance = new DriverInstance();
                    this.SetInfo("start rename " + acc.UserName);
                    if (string.IsNullOrEmpty(acc.Proxie))
                    {
                        instance.InitDriver(false);
                    }
                    else
                    {
                        instance.InitDriver(false, acc.Proxie.Replace("_", ":"));
                    }
                    var pin = new Pinterest(instance.Driver);

                    pin.MakeLogin(acc.Email, acc.Password);
                    if (pin.CheckLogin())
                    {
                        this.SetInfo("cant logined  " + acc.UserName);
                        pin.FillName();
                        var accountNewName = pin.AccountInfo(acc);
                        AccountManager.Accounts.Where(x => x.Email == acc.Email).FirstOrDefault().FullName = accountNewName.FullName;
                        AccountManager.GetInstance().Save();
                    }
                    else
                    {
                        this.SetInfo("cant login  " + acc.UserName);
                    }
                });
            });

            t.Start();
        }
예제 #4
0
        private void addAccountToolStripMenuItem1_Click_1(object sender, EventArgs e)
        {
            Thread t = new Thread(() =>
            {
                List <Account> newAccount = new List <Account>();
                string[] lines            = File.ReadAllLines(@"C:\my_work_files\pinterest\res\good.txt");
                foreach (string line in lines)
                {
                    string[] linedata = line.Split(':');
                    if (newAccount.Any(x => x.Email == linedata[0]))
                    {
                        newAccount.Where(x => x.Email == linedata[0]).FirstOrDefault().Password = linedata[1];
                    }
                    else
                    {
                        newAccount.Add(new Account()
                        {
                            Email    = linedata[0].ToLower(),
                            Password = linedata[1],
                        });
                    }
                }
                List <string> already = new List <string>();
                if (File.Exists(ALREADY))
                {
                    already = File.ReadAllLines(ALREADY).ToList();
                }

                newAccount = newAccount.Where(p => !already.Any(p2 => p2 == p.Email)).ToList();
                newAccount = newAccount.Where(p => !AccountManager.Accounts.Any(p2 => p2.Email == p.Email)).ToList();


                SetInfo("Account count for test " + newAccount.Count());
                newAccount.Reverse();
                Parallel.ForEach(newAccount, new ParallelOptions()
                {
                    MaxDegreeOfParallelism = 7
                }, (acc) =>
                {
                    DriverInstance drivers = new DriverInstance();
                    SetInfo("Start checking" + acc.Email);
                    if (already.Contains(acc.Email) || AccountManager.Accounts.Where(x => x.Email == acc.Email).Any())
                    {
                        SetInfo("skip");
                    }
                    else
                    {
                        drivers.InitDriver(false);
                        Pinterest pin = new Pinterest(drivers.Driver);
                        pin.MakeLogin(acc.Email, acc.Password);
                        if (pin.CheckLogin())
                        {
                            //      SetInfo("finded checking" + acc.Email);
                            var newAcc = pin.AccountInfo(acc);
                            AccountManager.Accounts.Add(newAcc);

                            AccountManager.GetInstance().Save();
                        }
                        else if (pin.Error != "password reset")
                        {
                            try { File.AppendAllText(ALREADY, acc.Email + Environment.NewLine); }
                            catch { }
                        }
                    }
                    drivers.SuperQuit();
                });
            });

            t.Start();
        }
예제 #5
0
파일: Status.cs 프로젝트: mauguzun/godlove
        public void PinStart()
        {
            Setup();

            AppendTextBox("start ");
            Thread t = new Thread(() =>
            {
                Parallel.ForEach(Accounts, new ParallelOptions()
                {
                    MaxDegreeOfParallelism = 7
                }, (acc) =>
                {
                    DriverInstance drivers = new DriverInstance();
                    this.startedDriver++;
                    try
                    {
                        AppendTextBox(acc.Email + " try login");
                        if (string.IsNullOrEmpty(acc.Proxie))
                        {
                            drivers.InitDriver(show);
                        }
                        else
                        {
                            drivers.InitDriver(show, acc.Proxie.Replace("_", ":"));
                        }

                        Pinterest pin = new Pinterest(drivers.Driver);


                        pin.MakeLogin(acc.Email, acc.Password);
                        pin.UserName = acc.UserName;
                        if (pin.CheckLogin())
                        {
                            pin.SaveCookie(CookieManager.Filename(acc.Email, acc.Proxie.Replace('_', ':')));
                            if (pin.ValidName() == false)
                            {
                                pin.FillName();
                            }
                            GUI.ActionInfo response = new ActionInfo(false, null);
                            while (true)
                            {
                                switch (this.PinAction)
                                {
                                case PinAction.Follow:
                                    limit    = 7;
                                    response = pin.Follow();
                                    break;


                                case PinAction.Repin:

                                    int d = RepinPinList.Count();;
                                    if (RepinPinList.Count() > succeAcction)
                                    {
                                        response = pin.Repin(RepinPinList[succeAcction], firstTime);
                                    }
                                    else
                                    {
                                        this.Close();
                                    }

                                    firstTime = false;

                                    break;

                                //
                                case PinAction.RepinOther:

                                    pin.Driver.Url      = "https://www.pinterest.com/";
                                    var pinsElement     = pin.Driver.FindElementsByCssSelector("[data-force-refresh]");
                                    List <string> hrefs = new List <string>();

                                    foreach (var item in pinsElement)
                                    {
                                        if (!hrefs.Contains(item.GetAttribute("href")))
                                        {
                                            hrefs.Add(item.GetAttribute("href"));
                                        }
                                    }
                                    foreach (var href in hrefs)
                                    {
                                        response = pin.Repin(href, firstTime);
                                        if (response.Done == false)
                                        {
                                            break;
                                        }
                                        else
                                        {
                                            AppendTextBox(href);
                                        }

                                        firstTime = false;
                                    }
                                    break;



                                case PinAction.FollowSelf:
                                    var newbies = AccountManager.Accounts.Where(x => x.Followers == 0);
                                    foreach (var item in newbies)
                                    {
                                        response = pin.Follow(item.UserName);
                                        if (response.Done == false)
                                        {
                                            drivers.SuperQuit();
                                        }
                                        else
                                        {
                                            AlreadyFollowedMyAccount.Add(item.UserName);
                                            File.AppendAllLines(FOLLOWED, AlreadyFollowedMyAccount);
                                        }
                                        AppendTextBox(" followed  " + item.UserName);
                                    }

                                    break;

                                default:
                                    response = pin.MakePost();
                                    break;
                                }
                                if (this.pinAction == PinAction.Follow && response.Done == true)
                                {
                                    int?before          = acc.Follow;
                                    DriverInstance temp = new DriverInstance();
                                    temp.InitDriver(false);
                                    acc = CheckOneAccount(acc, temp);
                                    temp.SuperQuit();

                                    if (before == acc.Follow)
                                    {
                                        AppendTextBox("not work " + this.PinAction + acc.Email);
                                        drivers.SuperQuit();
                                        this.stopedDriver++;
                                        break;
                                    }
                                }
                                else if (this.pinAction == PinAction.Pin && response.Done == true)
                                {
                                    File.AppendAllText(PINNED, response.Info + Environment.NewLine);
                                }

                                if (attemp.Keys.Contains(acc.Email))
                                {
                                    if (attemp[acc.Email] > limit)
                                    {
                                        AppendTextBox(this.PinAction + "= limit =" + acc.Email);
                                        drivers.SuperQuit();
                                    }
                                    attemp[acc.Email]++;
                                }
                                else
                                {
                                    attemp[acc.Email] = 0;
                                }



                                succeAcction++;
                                AppendTextBox(this.PinAction + " - " + response.Done + " - " + response.Info);
                                acc.Status = this.PinAction + DateTime.Now.ToString();

                                //if(response.Done == false)
                                //{
                                //    break;
                                //}
                            }
                        }
                        else
                        {
                            AppendTextBox(pin.Error + ":" + acc.Email);
                            drivers.SuperQuit();
                            this.stopedDriver++;
                        }
                        this.SetInfo();
                    }

                    catch (Exception ex)
                    {
                        DeleteProxie(acc.Proxie);
                        acc.Proxie = null;
                        AppendTextBox("delete proxy " + acc.Proxie.Replace("_", ":"));
                    }
                    finally
                    {
                        drivers.SuperQuit();
                    }
                });
            });

            t.Start();
        }