Example #1
0
        private void startProcessUsingHashTag()
        {
            try
            {
                GloBoardPro.HasTagListListThread.Add(Thread.CurrentThread);
                GloBoardPro.HasTagListListThread.Distinct();
                Thread.CurrentThread.IsBackground = true;
            }
            catch
            {
            }

            int parsedValue;
            bool ProcessStartORnot = false;
            AddToHashLoggerDAta("[ " + DateTime.Now + " ] => [Pleasewait ]");
            List<List<string>> list_Accounts = new List<List<string>>();
            acc_checker_counter = DemoStagramPro.ClGlobul.accountList.Count();
            list_Accounts = ListUtilities.Split(DemoStagramPro.ClGlobul.accountList, Maxthread);
            ThreadPool.SetMaxThreads(Noofthreads, 5);
            GlobDramProHttpHelper httphelper = new GlobDramProHttpHelper();
            HashTag objHashTag = new HashTag();
            List<string> Usercount = new List<string>();

            try
            {
                if (!(string.IsNullOrEmpty(txtHashTagDelay.Text)))
                {
                    ClGlobul.hashTagDelay = Convert.ToInt32(txtHashTagDelay.Text);
                }
                else
                {
                    ClGlobul.hashTagDelay = 10;
                }
            }
            catch
            { }
            if (chkDivideDataFollow1.Checked && rdbDivideGivenByUser1.Checked)
            {
                if (!int.TryParse(txtDiveideByUser1.Text, out parsedValue))
                {

                    AddToLogger("[ " + DateTime.Now + " ] => [ This is a number only field.Please enter proper value in divide given by user field. ]");
                    return;
                }
            }
            try
            {
                if (ClGlobul.HashFollower.Count != 0)
                {
                    if (!string.IsNullOrEmpty(txtNumberProfilesFollow.Text))
                    {
                        ClGlobul.NumberOfProfilesToFollow = Convert.ToInt32(txtNumberProfilesFollow.Text);
                        //ClGlobul.SnapVideosCounterfollow = Convert.ToInt32(txtNumberProfilesFollow.Text) * ClGlobul.HashFollower.Count;
                    }
                    else
                    {
                        MessageBox.Show("Please enter the numbers of profiles to follow and continue.");
                        AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Please enter the numbers of profiles to follow and continue. ]");
                        return;
                    }
                }
                if (ClGlobul.HashLiker.Count != 0)
                {
                    if (!string.IsNullOrEmpty(txtNumberPicsVideosLike.Text))
                    {
                        ClGlobul.NumberofSnapsVideosToLike = Convert.ToInt32(txtNumberPicsVideosLike.Text);
                        //ClGlobul.SnapVideosCounter = Convert.ToInt32(txtNumberPicsVideosLike.Text) * ClGlobul.HashLiker.Count;
                    }
                    else
                    {
                        MessageBox.Show("Please enter the numbers of snaps or videos to like and continue.");
                        AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Please enter the numbers of snaps or videos to like and continue. ]");
                        return;
                    }
                }
                if (ClGlobul.HashComment.Count != 0)
                {
                    if (!string.IsNullOrEmpty(txtNumberSnapsVideosComment.Text))
                    {
                        ClGlobul.NumberofSnapsVideosToComment = Convert.ToInt32(txtNumberSnapsVideosComment.Text);
                       // ClGlobul.SnapVideosCounterComment = Convert.ToInt32(txtNumberSnapsVideosComment.Text) * ClGlobul.HashComment.Count;
                    }
                    else
                    {
                        MessageBox.Show("Please enter the numbers of snaps or videos to like and continue.");
                        AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Please enter the numbers of snaps or videos to like and continue. ]");
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            #region scrapHashTagFollowr

            List<string> lstHashTagUserIdTemp = new List<string>();
            List<string> lstHashTagUserId = new List<string>();
            if (!string.IsNullOrEmpty(txtHashFollower.Text.Trim()))
            {

                foreach (string hashKeyword in ClGlobul.HashFollower)
                {

                    AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraping Users with HashTag " + hashKeyword + "]");
                    lstHashTagUserIdTemp = GetUser(hashKeyword);
                    lstHashTagUserId.AddRange(lstHashTagUserIdTemp);
                    AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraped Users with HashTag " + hashKeyword + "]");
                }
            }
            #endregion

            #region ScraperhashLiker
            List<string> lstHashTagUserIdLikeTemp = new List<string>();
            List<string> lstHashLikeTagUserLikeId = new List<string>();
            if (!string.IsNullOrEmpty(txtHashLike.Text.Trim()))
            {
                foreach (string hashLikerKeyword in ClGlobul.HashLiker)
                {

                    AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraping PhotoId with HashTag " + hashLikerKeyword + "]");
                    lstHashTagUserIdLikeTemp = GetPhotoId(hashLikerKeyword);
                    lstHashLikeTagUserLikeId.AddRange(lstHashTagUserIdLikeTemp);
                    AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraped Users with HashTag " + hashLikerKeyword + "]");
                }
            }
            #endregion

            #region hashtagcomment
            List<string> lstHashTagUserIdCommentTemp = new List<string>();
            List<string> lstHashTagCommentUserId = new List<string>();
            if (!string.IsNullOrEmpty(txtHashComment.Text.Trim()))
            {

                foreach (string hashCommentKeyword in ClGlobul.HashComment)
                {

                    AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraping Users PhotoId HashTag " + hashCommentKeyword + "]");
                    lstHashTagUserIdCommentTemp = GetPhotoId1(hashCommentKeyword);
                    lstHashTagCommentUserId.AddRange(lstHashTagUserIdCommentTemp);
                    AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraped Users PhotoId HashTag " + hashCommentKeyword + "]");

                }
            }
            #endregion
            List<List<string>> list_lstTargetUsers = new List<List<string>>();
            counter_follow = DemoStagramPro.ClGlobul.accountList.Count();
            list_Accounts = ListUtilities.Split(DemoStagramPro.ClGlobul.accountList, Maxthread);
            List<List<string>> list_lstTargetHashTag = new List<List<string>>();
            List<List<string>> list_lstTargetHashTagLike = new List<List<string>>();
            List<List<string>> list_lstTargetHashTagComment = new List<List<string>>();

            //for divide by data logic here
            if (chkDivideDataFollow1.Checked)
            {
                if (rdbDivideGivenByUser1.Checked || rdbDivideEqually1.Checked)
                {
                    int splitNo = 0;
                    if (rdbDivideEqually1.Checked)
                    {
                        splitNo = lstHashTagUserId.Count / ClGlobul.accountList.Count;
                    }
                    else if (rdbDivideGivenByUser1.Checked)
                    {
                        if (Convert.ToInt32(txtDiveideByUser1.Text.Trim()) != 0)
                        {
                            int res = Convert.ToInt32(Convert.ToInt32(txtDiveideByUser1.Text.Trim()));
                            splitNo = res;
                        }
                    }
                    if (splitNo == 0)
                    {
                        splitNo = RandomNumberGenerator.GenerateRandom(0, lstHashTagUserId.Count - 1);
                    }
                    list_lstTargetHashTag = Split(lstHashTagUserId, splitNo);
                }
            }

            if (chkDivideDataFollow1.Checked)
            {
                if (rdbDivideGivenByUser1.Checked || rdbDivideEqually1.Checked)
                {
                    int splitNo = 0;
                    if (rdbDivideEqually1.Checked)
                    {
                        splitNo = lstHashLikeTagUserLikeId.Count / ClGlobul.accountList.Count;
                    }
                    else if (rdbDivideGivenByUser1.Checked)
                    {
                        if (Convert.ToInt32(txtDiveideByUser1.Text.Trim()) != 0)
                        {
                            int res = Convert.ToInt32(Convert.ToInt32(txtDiveideByUser1.Text.Trim()));
                            splitNo = res;
                        }
                    }
                    if (splitNo == 0)
                    {
                        splitNo = RandomNumberGenerator.GenerateRandom(0, lstHashLikeTagUserLikeId.Count - 1);
                    }
                    list_lstTargetHashTagLike = Split(lstHashLikeTagUserLikeId, splitNo);
                }
            }

            if (chkDivideDataFollow1.Checked)
            {
                if (rdbDivideGivenByUser1.Checked || rdbDivideEqually1.Checked)
                {
                    int splitNo = 0;
                    if (rdbDivideEqually1.Checked)
                    {
                        splitNo = lstHashTagCommentUserId.Count / ClGlobul.accountList.Count;
                    }
                    else if (rdbDivideGivenByUser1.Checked)
                    {
                        if (Convert.ToInt32(txtDiveideByUser1.Text.Trim()) != 0)
                        {
                            int res = Convert.ToInt32(Convert.ToInt32(txtDiveideByUser1.Text.Trim()));
                            splitNo = res;
                        }
                    }
                    if (splitNo == 0)
                    {
                        splitNo = RandomNumberGenerator.GenerateRandom(0, lstHashTagCommentUserId.Count - 1);
                    }
                    list_lstTargetHashTagComment = Split(lstHashTagCommentUserId, splitNo);
                }
            }

            int LstCounter = 0;
            // unlikeCompletionCount = ClGlobul.accountList.Count;
            unlikeCompletionLikeCount = ClGlobul.accountList.Count;
            try
            {
                if (list_Accounts.Count == 0)
                {
                    AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Please upload account. ]");
                    return;
                }
                else
                {
                    ClGlobul.countNoOFAccountHashFollower = ClGlobul.accountList.Count;
                    ClGlobul.countNoOFAccountHashComment = ClGlobul.accountList.Count;
                    ClGlobul.countNOOfFollowersandImageDownload = ClGlobul.accountList.Count;

                    //try
                    //{
                    //    ClGlobul.SnapVideosCounterfollow = ClGlobul.SnapVideosCounterfollow * list_Accounts.Count;
                    //}
                    //catch { };
                    //try
                    //{
                    //    ClGlobul.SnapVideosCounter = ClGlobul.SnapVideosCounter * list_Accounts.Count;
                    //}
                    //catch { };
                    //try
                    //{

                    //    ClGlobul.SnapVideosCounterComment = ClGlobul.SnapVideosCounterComment * list_Accounts.Count;
                    //}
                    //catch { };

                    foreach (List<string> listAccounts in list_Accounts)
                    {
                        foreach (string val in listAccounts)
                        {
                            //soniaghezzo94:mdag123456:93.118.68.148:3128
                            string[] StrArrar = Regex.Split(val, ":");
                            string account = string.Empty;
                            string pass = string.Empty;
                            string proxyadd = string.Empty;
                            string proxyport = string.Empty;
                            string proxyUser = string.Empty;
                            string proxyPass = string.Empty;
                            try
                            {
                                account = StrArrar[0];
                            }
                            catch
                            {
                                account = StrArrar[0];
                            }
                            try
                            {
                                pass = StrArrar[1];
                            }
                            catch
                            {
                                pass = StrArrar[1];
                            }
                            try
                            {
                                proxyadd = StrArrar[2];
                            }

                            catch
                            {
                                proxyadd = StrArrar[2];
                            }
                            try
                            {
                                proxyport = StrArrar[3];
                            }
                            catch
                            {
                                proxyport = StrArrar[3];
                            }
                            try
                            {
                                proxyUser = StrArrar[4];
                            }
                            catch
                            {
                                proxyUser = StrArrar[4];
                            }
                            try
                            {
                                proxyPass = StrArrar[5];
                            }
                            catch
                            {
                                proxyPass = StrArrar[5];
                            }
                            string txtUrl = txtHashFollower.Text;
                            string txtLikeComment = txtHashLike.Text;

                            if (LstCounter == list_lstTargetHashTag.Count && (chkDivideDataFollow1.Checked))
                            {
                                //AddToLogger("[ " + DateTime.Now + " ] => [ Account is grater than List of users. ]");
                                // break;
                            }

                            List<string> list_lstTargetHashTag_item = new List<string>();

                            try
                            {
                                if (chkDivideDataFollow1.Checked)
                                {
                                    list_lstTargetHashTag_item = list_lstTargetHashTag[LstCounter];
                                }
                                else
                                {
                                    list_lstTargetHashTag_item = lstHashTagUserId;
                                }

                            }
                            catch { }

                            List<string> list_lstTargetHashTagLike_item = new List<string>();
                            try
                            {
                                if (chkDivideDataFollow1.Checked)
                                {
                                    list_lstTargetHashTagLike_item = list_lstTargetHashTagLike[LstCounter];
                                }
                                else
                                {
                                    list_lstTargetHashTagLike_item = lstHashLikeTagUserLikeId;
                                }

                            }
                            catch { }

                            List<string> list_lstTargetHashTagComment_item = new List<string>();
                            try
                            {
                                if (chkDivideDataFollow1.Checked)
                                {
                                    list_lstTargetHashTagComment_item = list_lstTargetHashTagComment[LstCounter];
                                }
                                else
                                {
                                    list_lstTargetHashTagComment_item = lstHashTagCommentUserId;
                                }

                            }
                            catch { }

                            InstagramManager.Classes.InstagramAccountManager InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(account, pass, proxyadd, proxyport, proxyUser, proxyPass);
                            string status = InstagramAccountManager.LoginNew(ref InstagramAccountManager.httpHelper);
                            if (!status.Contains("Success"))
                            {
                                status = InstagramAccountManager.LoginNew(ref InstagramAccountManager.httpHelper);
                            }
                            AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Logged in with account : " + InstagramAccountManager.Username + " ]");
                            // string ddd = Uri.EscapeDataString(txtUrl);
                            try
                            {
                                if (ClGlobul.HashFollower.Count != 0)
                                {
                                    //foreach (string hashTagFollow in ClGlobul.HashFollower) //commented for divide data
                                    //foreach (string hashTagFollow in list_lstTargetHashTag_item)
                                    {
                                        new Thread(() =>
                                        {
                                            try
                                            {
                                                GloBoardPro.HasTagListListThread.Add(Thread.CurrentThread);
                                                GloBoardPro.HasTagListListThread.Distinct();
                                                Thread.CurrentThread.IsBackground = true;
                                            }
                                            catch
                                            {
                                            }
                                            objHashTag.HashTagFollow(ref InstagramAccountManager, list_lstTargetHashTag_item);
                                        }).Start();
                                    }
                                }
                                if (ClGlobul.HashLiker.Count != 0)
                                {
                                    //foreach (string hashTagLike in ClGlobul.HashLiker)
                                    {
                                        new Thread(() =>
                                      {
                                          // objHashTag.HashTagLike(ref InstagramAccountManager, hashTagLike);
                                          objHashTag.HashTagLike(ref InstagramAccountManager, list_lstTargetHashTagLike_item);
                                      }).Start();
                                    }
                                }
                                if (ClGlobul.HashComment.Count != 0)
                                {
                                    //foreach (string hashTagComment in ClGlobul.HashComment)
                                    {
                                        new Thread(() =>
                                        {
                                            objHashTag.HashTagComment(ref InstagramAccountManager, list_lstTargetHashTagComment_item);
                                        }).Start();
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                            }
                            LstCounter++;
                            Thread.Sleep(1000);
                        }
                    }
                }
            }

            catch (Exception ex)
            { }

            finally
            {

                {
                    if (unlikeCompletionLikeCount == 0)
                    {

                    }
                }
            }
        }
Example #2
0
        private void StartProcessScrapeFollower()
        {
            try
            {

                AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [Pleasewait ]");
                List<List<string>> list_Accounts = new List<List<string>>();

                acc_checker_counter = DemoStagramPro.ClGlobul.accountList.Count();
                list_Accounts = ListUtilities.Split(DemoStagramPro.ClGlobul.accountList, Maxthread);
                ThreadPool.SetMaxThreads(5, 5);
                ClGlobul.listUsernameScrapeFollowers.Add(txtUsernameScrapeFollowers.Text);
                //GlobusHttpHelper httphelper = new GlobusHttpHelper();

                if (!string.IsNullOrEmpty(txtUsernameScrapeFollowers.Text))
                {
                    if (ClGlobul.listUsernameScrapeFollowers.Count != 0)
                    {
                        if (!ClGlobul.isStopScrapeFollowers)
                        {

                        LoopBackAccount:

                            string proxyadd = string.Empty;
                            string proxyport = string.Empty;
                            string proxyUser = string.Empty;
                            string proxyPass = string.Empty;

                            List<string> list_account = list_Accounts[ClGlobul.accountIndexForLoopingBack];

                            foreach (string val in list_account)
                            {
                                cmbScraperAccounts.Invoke(new MethodInvoker(delegate
                                {
                                    cmbScraperAccounts.SelectedIndex = accountIndex;
                                }));

                                string[] StrArrar = Regex.Split(val, ":");
                                string account = StrArrar[0];
                                string pass = StrArrar[1];
                                if (StrArrar.Count() == 4)
                                {
                                    proxyadd = StrArrar[2];
                                    proxyport = StrArrar[3];
                                }
                                if (StrArrar.Count() == 6)
                                {
                                    proxyUser = StrArrar[4];
                                    proxyPass = StrArrar[5];
                                }

                                InstagramManager.Classes.InstagramAccountManager InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(account, pass, proxyadd, proxyport, proxyUser, proxyPass);

                                string status = InstagramAccountManager.LoginNew(ref InstagramAccountManager.httpHelper);

                                if (!status.Contains("Success"))
                                {

                                    status = InstagramAccountManager.LoginNew(ref InstagramAccountManager.httpHelper);
                                }
                                if (status == "Success")
                                {
                                    AddToScrapeFollowersLogger("[ " + DateTime.Now + "] " + "[ Logged in with account : " + InstagramAccountManager.Username + " ]");

                                    foreach (string username in ClGlobul.listUsernameScrapeFollowers)
                                    {
                                        ClGlobul.scrapeFollowerAndFollowingUsername = username;

                                        //new Thread(() => StartScrapingFollowers(ref InstagramAccountManager, username)).Start();

                                        Thread StartThread = new Thread(() => StartScrapingFollowers(ref InstagramAccountManager, username));

                                        StartThread.Start();

                                        StartThread.Join();
                                    }
                                }
                                else
                                {
                                    AddToScrapeFollowersLogger("[ " + DateTime.Now + "] " + "[ Not logged in with account : " + InstagramAccountManager.Username + " ]");
                                    return;
                                }

                                accountIndex++;
                            }

                            if (!ClGlobul.isStopScrapeFollowers)
                            {
                                if (!ClGlobul.userOverFollower)
                                {
                                    if (accountIndex >= list_Accounts.Count())
                                    {
                                        Thread.Sleep(5000);
                                        AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ All accounts used. Looping Back to the first account.]");
                                        AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ Delay of 5 seconds. ]");
                                        ClGlobul.accountIndexForLoopingBack = 0;
                                        accountIndex = 0;
                                        goto LoopBackAccount;
                                    }
                                    else
                                    {
                                        if (ClGlobul.switchAccount)
                                        {
                                            Thread.Sleep(5000);
                                            AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ Delay of 5 seconds. ]");
                                            ClGlobul.accountIndexForLoopingBack++;
                                            goto LoopBackAccount;
                                        }
                                    }
                                }
                            }

                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please write username.");
                        AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ Please write username. ]");
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("Please write username.");
                    AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ Please write username. ]");
                    return;
                }
            }
            catch (Exception ex)
            {
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers);
                GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Method Name => btnStartScrapeFollowers_Click :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers);
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers);
            }
        }