Exemplo n.º 1
0
        private void StartCheckingAccount(object parameters)
        {

            TweetAccountManager tweetAccountManager = new TweetAccountManager();

            lstThreadAppFollow.Add(Thread.CurrentThread);
            lstThreadAppFollow = lstThreadAppFollow.Distinct().ToList();
            Thread.CurrentThread.IsBackground = true;

            try
            {
                Array paramsArray = new object[3];

                paramsArray = (Array)parameters;

                KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);


                AddToListBox("[ " + DateTime.Now + " ] => [ Starting Checking Account : " + keyValue.Key + " ]");

                tweetAccountManager = keyValue.Value;

                if (!tweetAccountManager.IsLoggedIn)
                {
                    tweetAccountManager.Login();
                }
                if (tweetAccountManager.IsLoggedIn)
                {
                    AddToListBox("[ " + DateTime.Now + " ] => [ SuccessFully Logged In with Account:  " + keyValue.Key + " ]");
                }
                if (tweetAccountManager.AccountStatus == "Account Suspended")
                {
                    AddToListBox("[ " + DateTime.Now + " ] => [ Suspended  Account:  " + keyValue.Key + " ]");
                    clsDBQueryManager database = new clsDBQueryManager();
                    database.UpdateSuspendedAcc(tweetAccountManager.Username);
                    return;
                }

                DataTable dt = objclsFBAccount.SelectAccoutsForGridView();

                if (!Globals.IsRefreshAccountExecute)
                {
                    btnRefresh.Invoke(new MethodInvoker(delegate
                    {
                        dgvAccounts.DataSource = dt;

                    }));
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> startCheckingAccount() -- Method --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }
            finally
            {
                counter_Account--;
                
                if (counter_Account == 0)
                {
                    if (btnRefresh.InvokeRequired)
                    {
                        btnRefresh.Invoke(new MethodInvoker(delegate
                        {
                            AddToListBox("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddToListBox("---------------------------------------------------------------------------------------------------------------------------");

                        }));
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void StartProcessOfRetweetOrFavorite(object AC)
        {
            int favCount = 0;
            int RetweetCount = 0;
            try
            {
                if (!_Isfevorite)
                {
                    lstReTweetThread.Add(Thread.CurrentThread);
                    lstReTweetThread.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
            }
            catch
            {
            }
            TweetAccountManager tweetAccountManager = new TweetAccountManager();
            KeyValuePair<string, TweetAccountManager> item = (KeyValuePair<string, TweetAccountManager>)AC;
            tweetAccountManager = item.Value;
            tweetAccountManager.logEvents.addToLogger += new EventHandler(retweetOfUrl_logEvents_addToLogger);
            try
            {
                AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Starting Process For Account " + tweetAccountManager.Username + " ]");
                //Login from account ..
                tweetAccountManager.Login();

                //check if account is not loged In ..
                if (!tweetAccountManager.IsLoggedIn)
                {
                    //tweetAccountManager.Login();
                }
                //check Coount is loged in or Is not suspended ..
                if (tweetAccountManager.IsLoggedIn)
                {
                    //AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Logged In With " + tweetAccountManager.Username + " ]");
                    if (tweetAccountManager.IsNotSuspended)
                    {
                        if (!chkUsingKeyWord.Checked)
                        {
                            foreach (string TUri in lst_tweetUrl)
                            {
                                try
                                {
                                    if (chk_retweetOfUrl.Checked)
                                    {
                                        retweetOfUrl(new object[] { TUri, item, tweetAccountManager });
                                    }
                                    if (chk_Favorite.Checked)
                                    {
                                        AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Adding To Favorite : " + TUri + " from " + tweetAccountManager.Username + " ]");
                                        FavoriteOfUrl(new object[] { TUri, item, tweetAccountManager });
                                    }
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }
                        else
                        {

                            //foreach (TwitterDataScrapper.StructTweetIDs TUri in TweetAccountManager.static_lst_Struct_TweetData)
                            if (TwitterDataScrapper.queTweetId.Count > 0)
                            {
                                while (TwitterDataScrapper.queTweetId.Count > 0)
                                {
                                    try
                                    {
                                        //if (chk_retweetOfUrl.Checked)
                                        //{
                                        //    AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Retweeted : " + TUri + " from " + tweetAccountManager.Username + " ]");
                                        //    retweetOfUrl(new object[] { TUri.ID_Tweet, item, tweetAccountManager });
                                        //}
                                        string TUri = TwitterDataScrapper.queTweetId.Dequeue();
                                        if (chk_Favorite.Checked)
                                        {
                                            AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Added To Favorite : " + TUri + " from " + tweetAccountManager.Username + " ]");
                                            favCount=FavoriteOfUrl(new object[] { TUri, item, tweetAccountManager },favCount);
                                        }
                                        if (favCount >= int.Parse(txtCountFavoriteandRetweet.Text))
                                        {
                                            break;
                                        }
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                            }
                            else
                            {
                                AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Zero tweet found from keyword " + txt_TweetUrl.Text + " ]");
                            }
                        }
                    }
                    else
                    {
                        AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Account Is suspended  >" + item.Key + " ]");
                    }
                }
                else
                {
                    AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Account Not Logged With " + item.Key + " ]");
                }

                //this.Invoke(new MethodInvoker(delegate
                //{
                //txt_TweetUrl.Text = "";
                //lst_tweetUrl.Clear();
                //}));
            }
            catch (Exception ex)
            {
                //AddToLog_RetweetAndFavorite("Error :-  > " + ex.Message);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error :- Mathod Name :- StartProcessOfRetweetOrFavorite- 1; Error Text :- " + ex.Message, Globals.path_LogErrorFromRetweetAndFavorit);
            }

            finally
            {
                //AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Completed Retweet and Favorite From " + tweetAccountManager.Username + " ]");
                tweetAccountManager.logEvents.addToLogger -= new EventHandler(retweetOfUrl_logEvents_addToLogger);
                //txt_RetweetUrlFilePath.Text = "";
                counter_Retweet--;
                if (counter_Retweet == 0)
                {
                    if (btn_start.InvokeRequired)
                    {
                        //btn_start.Cursor = Cursors.AppStarting;
                        btn_start.Invoke(new MethodInvoker(delegate
                        {
                            AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddToLog_RetweetAndFavorite("---------------------------------------------------------------------------------------------------------------------------");
                            btn_start.Cursor = Cursors.Default;
                            lst_tweetUrl.Clear();
                            //txt_TweetUrl.Text = "";

                        }));
                    }

                }

            }
        }
Exemplo n.º 3
0
        public void ReTweet1(ref TweetAccountManager objTweetAccountManager, int minDelay, int maxDelay)
        {
            try
            {
                if (!IsLoggedIn)
                {
                    Login();
                }

                if (IsNotSuspended)
                {
                    if (IsLoggedIn)
                    {

                        int counter_Retweet = 0;


                        TwitterDataScrapper.StructTweetIDs item = new TwitterDataScrapper.StructTweetIDs();
                        while (objTweetAccountManager.que_lst_Struct_TweetData1.Count > 0)  //TweetAccountManager.que_lst_Struct_TweetData
                        {
                            //foreach (TwitterDataScrapper.StructTweetIDs item in static_lst_Struct_TweetData)
                            //{
                            if (!RetweetPerDay)
                            {
                                if (counter_Retweet >= noOfRetweets)
                                {
                                    Log("[ " + DateTime.Now + " ] => [ " + counter_Retweet + " ReTweets Done For " + Username + " ]");
                                    break;
                                }
                            }
                            else if (RetweetPerDay)
                            {
                                if (AlreadyRetweeted >= NoOFRetweetPerDay)
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Already Tweeted " + AlreadyRetweeted + " ]");
                                    break;
                                }
                            }

                            lock (locker_qque_lst_Struct_TweetData)
                            {
                                if (objTweetAccountManager.que_lst_Struct_TweetData1.Count > 0)
                                {
                                    item = objTweetAccountManager.que_lst_Struct_TweetData1.Dequeue();
                                }
                                else
                                {

                                }
                            }


                            string tweetStatus;

                            int delay = 10 * 1000;

                            try
                            {
                                //delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                if (Globals.IsGlobalDelay && Globals.IsCheckValueOfDelay)
                                {
                                    delay = RandomNumberGenerator.GenerateRandom(Globals.MinGlobalDelay, Globals.MaxGlobalDelay);
                                }
                                else
                                {
                                    delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                }
                            }
                            catch (Exception ex)
                            {
                                delay = 10;
                                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  ReTweet()  -- " + Username + " --> " + ex.Message, Globals.Path_TweetAccountManager);
                            }


                            tweeter.ReTweet(ref globusHttpHelper, pgSrc_Profile, postAuthenticityToken, item.ID_Tweet, "", out tweetStatus);

                            if (tweetStatus == "posted")
                            {
                                counter_Retweet++;
                                AlreadyRetweeted++;
                                clsDBQueryManager DataBase = new clsDBQueryManager();
                                string dbTweetMessage = StringEncoderDecoder.Encode(item.wholeTweetMessage);
                                DataBase.InsertMessageData(Username, "ReTweet", item.ID_Tweet, dbTweetMessage);
                                Log("[ " + DateTime.Now + " ] => [ Retweeted " + counter_Retweet + ": >> " + item.username__Tweet_User + " by " + Username + " ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(item.username__Tweet_User + " by " + Username, Globals.path_RetweetInformation);
                            }
                            else
                            {
                                Log("[ " + DateTime.Now + " ] => [ >>Couldn't Retweet >> " + item.ID_Tweet_User + " by " + Username + " ]");
                                //GlobusFileHelper.AppendStringToTextfileNewLine("Retweeted " + counter_Retweet + ": >> " + item.username__Tweet_User + " by " + Username, Globals.path_RetweetInformation);
                            }

                            Log("[ " + DateTime.Now + " ] => [ Retweet Delayed for " + delay + " Seconds ]");
                            Thread.Sleep(delay * 1000);
                        }

                        Log("[ " + DateTime.Now + " ] => [ Finished Retweeting with : " + Username + " ]");
                        Log("------------------------------------------------------------------------------------------------------------------------------------------");
                    }
                    else
                    {
                        Log("[ " + DateTime.Now + " ] => [ Couldn't log in with " + Username + " ]");
                        //GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_FailedLoginAccounts);
                    }
                }
                else
                {
                    clsDBQueryManager database = new clsDBQueryManager();
                    database.UpdateSuspendedAcc(Username);
                    Log("[ " + DateTime.Now + " ] => [ " + Username + ">>Account Suspended ]");

                    return;
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager() - retweet --> " + ex.Message, Globals.Path_TweetingErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  ReTweet()  -- " + Username + " --> " + ex.Message, Globals.Path_TweetAccountManager);
            }
        }
Exemplo n.º 4
0
        private void ScrapeWhotoFollow(TweetAccountManager tweetAccountManager, string Keyword, int NoOfPages)
        {
            try
            {
                AddThreadToDictionary(strModule(Module.WhoToScrap), tweetAccountManager.Username);
                int counter = 0;
                int PageCount = 1;
               // int NoOfData = NoOfPages * 20;
                List<string> username = new List<string>();
                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Getting Users To Scrape Data For ]");
                while (counter < NoOfPages)
                {
                   // string pagsource = tweetAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/who_to_follow/suggestions/search/users?q=" + Keyword + "&cursor=" + PageCount + "&include_available_features=1&include_entities=1&is_forward=true"), "", "");
                    string pagsource = "";
                    if (PageCount == 1)
                    {
                         pagsource = tweetAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/i/search/timeline?q=" + Keyword + "&cursor=" + PageCount + "&include_available_features=1&include_entities=1&is_forward=true"), "", ""); // https://twitter.com/who_to_follow/suggestions/search/users?q=software&cursor=1&include_available_features=1&include_entities=1&is_forward=true
                    }
                    else
                    {
                        //if (pagsource.Contains("\"has_more_items\":true"))
                        string uri = "https://twitter.com/i/search/timeline?q=" + Keyword + "&mode=users&include_available_features=1&include_entities=1&last_note_ts=555&scroll_cursor=USER-0-" + PageCount * 20;
                        pagsource = tweetAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/i/search/timeline?q=" + Keyword + "&mode=users&include_available_features=1&include_entities=1&last_note_ts=555&scroll_cursor=USER-0-" + PageCount * 20), "", "");
                    }
                  //  if (pagsource.Contains("has-more-items"))
                    if (pagsource.Contains("has_more_items"))
                    {
                        PageCount++;
                         string[] Aray = Regex.Split(pagsource, "js-stream-item stream-item");
                        //string[] Aray = Regex.Split(pagsource, "js-stream-item stream-item stream-user-item");  //js-stream-item stream-item
                      //  string[] Aray = Regex.Split(pagsource, "fullname js-action-profile-name");
                        Aray = Aray.Skip(1).ToArray();
                        foreach (string item in Aray)
                        {
                            string Userid = string.Empty;
                            string Username = string.Empty;
                            try
                            {
                                //int startindex = item.IndexOf("=\\\"");
                                int startindex = item.IndexOf("data-user-id=\"");
                                int startindexForItem = item.IndexOf("data-item-id=\\\"");
                                if (startindex >= 0 && PageCount==2)
                                {
                                    string start = item.Substring(startindex).Replace("data-user-id=\"", "");
                                    //string start = item.Substring(startindex).Replace("=\\\"", "");
                                    //int endindex = start.IndexOf("\\\"");
                                    int endindex = start.IndexOf("\"");
                                    string end = start.Substring(0, endindex);
                                    Userid = end;
                                }
                                else if (startindexForItem >= 0)
                                {
                                    string start = item.Substring(startindexForItem).Replace("data-item-id=\\\"", "");
                                    //string start = item.Substring(startindex).Replace("=\\\"", "");
                                    //int endindex = start.IndexOf("\\\"");
                                    int endindex = start.IndexOf("\\\"");
                                    string end = start.Substring(0, endindex);
                                    Userid = end;

                                }
                            }
                            catch (Exception ex)
                            {
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ScrapeWhotoFollow() 1--> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ScrapeWhotoFollow() 1--> " + ex.Message, Globals.Path_TwtErrorLogs);
                            }

                            try
                            {
                                //int startindex = item.IndexOf("data-screen-name=\\\"");
                                int startindex = item.IndexOf("data-screen-name=\"");
                                int startindex2 = item.IndexOf("data-screen-name=\\\"");
                                if (startindex >= 0)
                                {
                                    //string start = item.Substring(startindex).Replace("data-screen-name=\\\"", "");
                                    string start = item.Substring(startindex).Replace("data-screen-name=\"", "");
                                    //int endindex = start.IndexOf("\\\"");
                                    int endindex = start.IndexOf("\"");
                                    string end = start.Substring(0, endindex);
                                    Username = end;
                                    username.Add(end);
                                }

                                if (startindex2 >= 0)
                                {
                                    //string start = item.Substring(startindex).Replace("data-screen-name=\\\"", "");
                                    string start = item.Substring(startindex2).Replace("data-screen-name=\\\"", "");
                                    //int endindex = start.IndexOf("\\\"");
                                    int endindex = start.IndexOf("\\\"");
                                    string end = start.Substring(0, endindex);
                                    Username = end;
                                    username.Add(end);
                                }
                            }
                            catch (Exception ex)
                            {
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ScrapeWhotoFollow() 1--> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ScrapeWhotoFollow() 1--> " + ex.Message, Globals.Path_TwtErrorLogs);
                            }

                            try
                            {
                                if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Userid))
                                {
                                    string query = "INSERT INTO tb_UsernameDetails (Username , Userid) VALUES ('" + Username + "' ,'" + Userid + "') ";
                                    DataBaseHandler.InsertQuery(query, "tb_UsernameDetails");
                                }
                            }
                            catch (Exception ex)
                            {
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ScrapeWhotoFollow() --> Database --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ScrapeWhotoFollow() --> DataBase --> " + ex.Message, Globals.Path_TwtErrorLogs);
                            }

                            AddToScrapeLogs("[ " + DateTime.Now + " ] => [ " + Username + " ::  " + Userid + " ]");
                        }
                        username = username.Distinct().ToList();
                        counter++;
                    }
                    else
                    {
                        AddToScrapeLogs("[ " + DateTime.Now + " ] => [ No More Pages To Scrape For Keyword : " + Keyword + " ]");
                        break;
                    }
                }

                if (!File.Exists(Globals.Path_KeywordScrapedListData + ".csv"))
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("USERID , USERNAME , PROFILE NAME , BIO  , LOCATION , WEBSITE , NOOFTWEETS , FOLLOWING , FOLLOWERS ", Globals.Path_KeywordScrapedListData + ".csv");
                }

                foreach (string UserIds in username)
                {
                    try
                    {
                        string ProfileName = string.Empty;
                        string Location = string.Empty;
                        string Bio = string.Empty;
                        string website = string.Empty;
                        string NoOfTweets = string.Empty;
                        string Followers = string.Empty;
                        string Followings = string.Empty;
                        string userids = string.Empty;
                        string TweetUsername = string.Empty;
                        string Userid = string.Empty;
                        string Username = string.Empty;
                        ChilkatHttpHelpr objChilkat = new ChilkatHttpHelpr();
                        GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                        string ProfilePageSource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + UserIds), "", "");

                        string Responce = ProfilePageSource;

                        #region Convert HTML to XML

                        string xHtml = objChilkat.ConvertHtmlToXml(Responce);
                        Chilkat.Xml xml = new Chilkat.Xml();
                        xml.LoadXml(xHtml);

                        Chilkat.Xml xNode = default(Chilkat.Xml);
                        Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml);
                        #endregion

                        //xNode = xml.SearchForAttribute(xBeginSearchAfter, "ul", "class", "stats js-mini-profile-stats");
                        //xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "profile-field");
                        //userids = xNode.GetAttrValue("data-user-id");
                        //userids = xNode.AccumulateTagContent("text", "script|style");
                        if (Responce.Contains("has-more-items"))
                        {
                            PageCount++;
                            //string[] Aray = Regex.Split(Responce, "js-stream-item stream-item stream-item");
                            //Aray = Aray.Skip(1).ToArray();
                            //foreach (string item in Aray)
                            {

                                try
                                {
                                    #region commented
                                    //int startindex = item.IndexOf("=\\\"");
                                    //int startindex = item.IndexOf("data-user-id=");
                                    //if (startindex >= 0)
                                    //{
                                    //    string start = item.Substring(startindex).Replace("data-user-id=\"", "");
                                    //    //string start = item.Substring(startindex).Replace("=\\\"", "");
                                    //    //int endindex = start.IndexOf("\\\"");
                                    //    int endindex = start.IndexOf("\"");
                                    //    string end = start.Substring(0, endindex);
                                    //    userids = end;
                                    //    break;
                                    //}
                                    #endregion

                                    int startindex = Responce.IndexOf("profile_id");
                                    string start = Responce.Substring(startindex).Replace("profile_id", "");
                                    int endindex = start.IndexOf(",");
                                    string end = start.Substring(0, endindex).Replace("&quot;", "").Replace("\"", "").Replace(":", "").Trim();
                                    userids = end.Trim();
                                    TweetUsername = UserIds;

                                }

                                catch (Exception ex)
                                {
                                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ScrapeWhotoFollow() 1--> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ScrapeWhotoFollow() 1--> " + ex.Message, Globals.Path_TwtErrorLogs);
                                }
                            }
                        }
                        int counterdata = 0;
                        xBeginSearchAfter = null;
                        string dataDescription = string.Empty;
                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "h1", "class", "ProfileHeaderCard-name");
                        while ((xNode != null))
                        {
                            xBeginSearchAfter = xNode;
                            if (counterdata == 0)
                            {
                                ProfileName = xNode.AccumulateTagContent("text", "script|style").Replace("Verified account", "");
                                counterdata++;
                            }
                            else if (counterdata == 1)
                            {
                                website = xNode.AccumulateTagContent("text", "script|style");
                                counterdata++;
                            }
                            else
                            {
                                break;
                            }
                            //xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "profile-field");
                            xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "u-textUserColor");
                        }

                        xBeginSearchAfter = null;
                        dataDescription = string.Empty;
                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "screen-name");
                        //while ((xNode != null))
                        //{
                        //    xBeginSearchAfter = xNode;
                        //    TweetUsername = xNode.AccumulateTagContent("text", "script|style");
                        //    break;
                        //}

                        xBeginSearchAfter = null;
                        dataDescription = string.Empty;
                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "p", "class", "ProfileHeaderCard-bio u-dir");//bio profile-field");
                        while ((xNode != null))
                        {
                            xBeginSearchAfter = xNode;
                            Bio = xNode.AccumulateTagContent("text", "script|style").Replace("&#39;", "'").Replace("&#13;&#10;", string.Empty).Trim();
                            break;
                        }

                        xBeginSearchAfter = null;
                        dataDescription = string.Empty;
                        //xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "location profile-field");
                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "ProfileHeaderCard-locationText u-dir");
                        while ((xNode != null))
                        {
                            xBeginSearchAfter = xNode;
                            Location = xNode.AccumulateTagContent("text", "script|style");
                            break;
                        }

                        int counterData = 0;
                        xBeginSearchAfter = null;
                        dataDescription = string.Empty;
                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "p", "class", "ProfileHeaderCard-bio u-dir");//bio profile-field");
                        while ((xNode != null))
                        {
                            xBeginSearchAfter = xNode;
                            Bio = xNode.AccumulateTagContent("text", "script|style").Replace("&#39;", "'").Replace("&#13;&#10;", string.Empty).Trim();
                            break;
                        }

                        xBeginSearchAfter = null;
                        dataDescription = string.Empty;
                        //xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "location profile-field");
                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "ProfileHeaderCard-locationText u-dir");//location profile-field");
                        while ((xNode != null))
                        {
                            xBeginSearchAfter = xNode;
                            Location = xNode.AccumulateTagContent("text", "script|style");
                            break;
                        }

                        xBeginSearchAfter = null;
                        dataDescription = string.Empty;
                        //xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "data-element-term", "tweet_stats");
                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-nav");
                        while ((xNode != null))
                        {
                            xBeginSearchAfter = xNode;
                            if (counterData == 0)
                            {
                                NoOfTweets = xNode.AccumulateTagContent("text", "script|style").Replace("Tweets", string.Empty).Replace(",", string.Empty).Replace("Tweet", string.Empty);
                                counterData++;
                            }
                            else if (counterData == 1)
                            {
                                Followings = xNode.AccumulateTagContent("text", "script|style").Replace(" Following", string.Empty).Replace(",", string.Empty).Replace("Following", string.Empty);
                                counterData++;
                            }
                            else if (counterData == 2)
                            {
                                Followers = xNode.AccumulateTagContent("text", "script|style").Replace("Followers", string.Empty).Replace(",", string.Empty).Replace("Follower", string.Empty);
                                counterData++;
                            }
                            else
                            {
                                break;
                            }
                            //xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "js-nav");
                            xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-openSignupDialog js-nonNavigable u-textUserColor");
                        }

                        if (!string.IsNullOrEmpty(userids))
                        {
                            lock (WhoTofollowThreadLock)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine(userids + "," + TweetUsername + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location.Replace(",", "") + "," + website + "," + NoOfTweets.Replace(",", "").Replace("Tweets", "") + "," + Followers.Replace(",", "").Replace("Following", "") + "," + Followings.Replace(",", "").Replace("Followers", "").Replace("Follower", ""), Globals.Path_KeywordScrapedListData + ".csv");
                            }
                            AddToScrapeLogs("[ " + DateTime.Now + " ] => [ " + userids + "," + TweetUsername + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location + "," + website + "," + NoOfTweets + "," + Followers + "," + Followings + " ]");
                        }
                    }
                    catch (Exception ex)
                    {
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ScrapeWhotoFollow() 3--> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ScrapeWhotoFollow() 3--> " + ex.Message, Globals.Path_TwtErrorLogs);
                    }
                }
                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Finished Scraping For " + tweetAccountManager.Username + " ]");
                AddToProxysLogs("-----------------------------------------------------------------------------------------------------------------------");
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ScrapeWhotoFollow() 2--> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ScrapeWhotoFollow() 2--> " + ex.Message, Globals.Path_TwtErrorLogs);
            }
        }
Exemplo n.º 5
0
        public void StartFollowByKeyWord(Object Param)
        {
            try
            {
                try
                {
                    Dic_Thread.Add(Thread.CurrentThread.Name, Thread.CurrentThread);
                }
                catch { };

                Interlocked.Increment(ref counterThreadsFollowByKeyWord);  //lockerThreadsFollowByKeyWord
                Array ParamArray = (Array)Param;

                string profileUsername = string.Empty;
                string profileUserpass = string.Empty;
                int FollowLimitCounter = 0;
                //int AccountCounter = 0;

                TweetAccountManager TweetAccountManager = new TweetAccountManager();
                TwitterDataScrapper TwitterDataScrapper = new TwitterDataScrapper();

                KeyValuePair<string, TweetAccountManager> item = (KeyValuePair<string, TweetAccountManager>)ParamArray.GetValue(0);

                int DelayStart = (int)ParamArray.GetValue(1);
                int DelayEnd = (int)ParamArray.GetValue(2);
                List<TwitterDataScrapper.StructTweetIDs> KeywordStructData = (List<TwitterDataScrapper.StructTweetIDs>)ParamArray.GetValue(3);

                profileUsername = item.Key;
                profileUserpass = item.Value.Password;

                //******search profile By keyWords
                string SeachKey = string.Empty;
                //List<TwitterDataScrapper.StructTweetIDs> KeywordStructData = new List<TwitterDataScrapper.StructTweetIDs>();
                #region commented
                //if (FollowtweetKeywordList.Count != 0)
                //{
                //    TwitterDataScrapper.noOfRecords = int.Parse(txt_FollowByPerAccount.Text);
                //    if (!chk_followbysinglekeywordperaccount.Checked)
                //    {
                //        try
                //        {
                //            if (searchkeywordqueue.Count == 0)
                //            {
                //                return;
                //            }

                //            SeachKey = searchkeywordqueue.Dequeue().ToString();//FollowtweetKeywordList[counterThreadsFollowByKeyWord];
                //            KeywordStructData = TwitterDataScrapper.GetTweetData_New(SeachKey);

                //            if (KeywordStructData.Count == 0)
                //            {
                //                KeywordStructData = TwitterDataScrapper.NewKeywordStructData(SeachKey);
                //            }
                //        }
                //        catch (Exception)
                //        {
                //        }
                //    }
                //    else
                //    {
                //        //TwitterDataScrapper.logEvents.addToLogger += new EventHandler(logEvents_Follower_addToLogger);

                //        foreach (string SeachKey_item in FollowtweetKeywordList)
                //        {
                //            List<TwitterDataScrapper.StructTweetIDs> KeywordStructData1 = new List<TwitterDataScrapper.StructTweetIDs>();
                //            int datacounter = 0;
                //            KeywordStructData1 = TwitterDataScrapper.NewKeywordStructData1(SeachKey_item);

                //            if (KeywordStructData1.Count == 0)
                //            {
                //                KeywordStructData1 = TwitterDataScrapper.KeywordStructData(SeachKey_item);
                //            }

                //            if (KeywordStructData1.Count == 0)
                //            {
                //                AddToLog_Follower("[ " + DateTime.Now + " ] => [ Key Word is not Exist/suspended. ]");
                //            }

                //            foreach (var KeywordStructData1_item in KeywordStructData1)
                //            {
                //                if (datacounter == int.Parse(txt_FollowByPerAccount.Text))
                //                {
                //                    break;
                //                }
                //                else
                //                {
                //                    KeywordStructData.Add(KeywordStructData1_item);
                //                    datacounter++;
                //                }
                //            }
                //        }
                //    }
                //}
                //else
                //{
                //    MessageBox.Show("Please Upload Keywords");
                //    //break;
                //}

                #endregion
                //*************
                try
                {
                    if (KeywordStructData.Count > 0)
                    {
                        TweetAccountManager AccountManager = (TweetAccountManager)item.Value;
                        AccountManager.logEvents.addToLogger += new EventHandler(logEvents_Follower_addToLogger);

                        if (!AccountManager.IsLoggedIn)
                        {
                            AccountManager.Login();
                        }

                        if (!AccountManager.IsLoggedIn || !AccountManager.IsNotSuspended)
                        {
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ Not Logged in From Account =  " + AccountManager.Username + " . ]");
                            return;
                        }

                        ///Return if Suspended
                        if (AccountManager.AccountStatus == "Account Suspended")
                        {
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ " + profileUsername + " : Suspended ]");
                            return;
                        }
                        else if ((AccountManager.globusHttpHelper.gResponse.ResponseUri.ToString().ToLower()).Contains("captcha"))
                        {
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ " + profileUsername + " : Asking for captcha. ]");
                            return;
                        }

                        foreach (var item1 in KeywordStructData)
                        {
                            if (!chk_followbysinglekeywordperaccount.Checked)
                            {
                                //accordint to get Follow users limits
                                if (FollowLimitCounter >= (int.Parse(txt_FollowByPerAccount.Text)))
                                {
                                    FollowLimitCounter = 0;
                                    break;
                                }
                                else
                                {
                                    FollowLimitCounter++;
                                }
                            }

                            //Get follow from user
                            string AccountId = item1.ID_Tweet_User;

                            //get Follow
                            getFollowUserBySearch(new object[] { AccountManager, AccountId });

                            int Delay = RandomNumberGenerator.GenerateRandom((DelayStart * 1000), (DelayEnd * 1000));
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ Delay :- " + TimeSpan.FromMilliseconds(Delay).Seconds + " Seconds. ]");
                            Thread.Sleep(Delay);
                        }
                    }
                    else
                    {
                        //Message List is Empty

                        //AddToLog_Follower("Key Word File is Empty or Wrong Formate");
                        //break;
                    }
                }
                catch (Exception)
                {

                }

            }
            catch (Exception)
            {
            }
            finally
            {
                Interlocked.Decrement(ref counterThreadsFollowByKeyWord);
                lock (lockerThreadsFollowByKeyWord)
                {
                    Monitor.Pulse(lockerThreadsFollowByKeyWord);
                }
                if (counterThreadsFollowByKeyWord == 0)
                {
                    AddToLog_Follower("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                    AddToLog_Follower("-----------------------------------------------------------------------------------------------------------------------");
                }
            }
        }
Exemplo n.º 6
0
        private void ScrapeMemberSeacrh()
        {
            try
            {
                lstIsStopScrapMember.Add(Thread.CurrentThread);
                lstIsStopScrapMember.Distinct();
                Thread.CurrentThread.IsBackground = true;

            }
            catch { }

            try
            {
                TwitterDataScrapper TweetData = new TwitterDataScrapper();
                GlobusHttpHelper globusHttpHelper = new GlobusHttpHelper();
                int counter = 0;
                TweetAccountManager TweetLogin = new TweetAccountManager();
               

                txtlimitScrapeUsers.Invoke(new MethodInvoker(delegate
                {

                    if (!string.IsNullOrEmpty(txtlimitScrapeUsers.Text.Trim()) && NumberHelper.ValidateNumber(txtlimitScrapeUsers.Text.Trim()))
                    {
                        noOfRecords = Convert.ToInt32(txtlimitScrapeUsers.Text.Trim());
                        if (noOfRecords == 0)
                        {
                            AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ Do not put Zero value ]");
                            AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ Default number of records is 50 ]");
                            noOfRecords = 50;
                        }
                    }
                    else
                    {
                        AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ please enter value in number of users ]");
                        return;
                    }
                }));


                foreach (KeyValuePair<string, TweetAccountManager> item in TweetAccountContainer.dictionary_TweetAccount)
                {
                    AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ Login process starting]");
                    if (counter > TweetAccountContainer.dictionary_TweetAccount.Count)
                    {
                        counter = 0;
                    }

                    TweetLogin = new TweetAccountManager();
                    TweetLogin.Username = item.Key;
                    TweetLogin.Password = item.Value.Password;
                    TweetLogin.IPAddress = item.Value.IPAddress;
                    TweetLogin.IPPort = item.Value.IPPort;
                    TweetLogin.IPUsername = item.Value.IPUsername;
                    TweetLogin.IPpassword = item.Value.IPpassword;
                    TweetLogin.Login();

                    if (!TweetLogin.IsLoggedIn)
                    {
                        continue;
                    }
                    else
                    {
                        AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ Login process successful]");
                        globusHttpHelper = TweetLogin.globusHttpHelper;
                        counter++;
                        break;
                    }
                }


                if (!TweetLogin.IsLoggedIn)
                {
                    AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ Please Upload Atleast One Working Account To Get Details ]");
                    return;
                }


                AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ Scraping User ]");

                
                    foreach (string item in lstUrl)
                    {
                        string tempItem = string.Empty;
                        if (!item.Contains("https://twitter.com"))
                        {
                            tempItem = "https://twitter.com" + item;
                        }
                        else
                        {
                            tempItem = item;
                        }

                        List<string> lstMember = new List<string>();
                        string returnStatus = string.Empty;
                        getTweetUsers(item, ref globusHttpHelper);
                        //lstMember = GetMembers(item, ref globusHttpHelper, out returnStatus);
                        AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ Scraped Member for Url " + item + "]");
                    }

            }
            catch { }
        }
Exemplo n.º 7
0
        public void StartVerification(object parameters )
        {
            try
            {
                lstEmailVarificationThread.Add(Thread.CurrentThread);
                lstEmailVarificationThread.Distinct().ToList();
                Thread.CurrentThread.IsBackground = true;

                Array paramsArray = new object[2];
                paramsArray = (Array)parameters;

                string Email = string.Empty;
                string Password = string.Empty;
                string username = string.Empty;
                string IPAddress = string.Empty;
                string IPPort = string.Empty;
                string IPUsername = string.Empty;
                string IPpassword = string.Empty;
                string IP = string.Empty;
                string tempEmail = string.Empty;


                #region commented by prabhat 07.12.13
                //string emailData = (string)paramsArray.GetValue(0);
                //if (paramsArray.Length>1)
                //{
                //    IP = (string)paramsArray.GetValue(1);
                //}

                //if (!emailData.Contains(':'))
                //{
                //    AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ Wrong Format Of Emails :- " + emailData + " ]");
                //    return;
                //}


                //Email = emailData.Split(':')[0];
                //Password = emailData.Split(':')[1];

                //AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ Going for Email Verification : " + Email + " ]");

                //if (!string.IsNullOrEmpty(IP))
                //{
                //    try
                //    {
                //        string[] IPData = IP.Split(':');
                //        if (IPData.Count() == 2)
                //        {
                //            IPAddress = IPData[0];
                //            IPPort = IPData[1];
                //        }
                //        if (IPData.Count() == 4)
                //        {
                //            IPAddress = IPData[0];
                //            IPPort = IPData[1];
                //            IPUsername = IPData[2];
                //            IPpassword = IPData[3];
                //        }
                //    }
                //    catch (Exception)
                //    {
                //    }
                //} 
                #endregion

                counter = Lst_NonVerifiedEmailAccount.Count();
                string item = paramsArray.GetValue(0).ToString();


                try
                {
                    string[] arrItem = Regex.Split(item, ":");
                    tempEmail = arrItem[0];
                    if (arrItem.Length == 2)
                    {
                        Email = arrItem[0]; //item.Key;
                        Password = arrItem[1];//item.Value._Password;
                    }
                    else if (arrItem.Length == 4)
                    {
                        Email = arrItem[0]; //item.Key;
                        Password = arrItem[1];//item.Value._Password;
                        IPAddress = arrItem[2];//item.Value._IPAddress;
                        IPPort = arrItem[3];
                    }
                    else if (arrItem.Length == 6)
                    {
                        Email = arrItem[0]; //item.Key;
                        Password = arrItem[1];//item.Value._Password;
                        IPAddress = arrItem[2];//item.Value._IPAddress;
                        IPPort = arrItem[3];//item.Value._IPPort;
                        IPUsername = arrItem[4];//item.Value._IPUsername;
                        IPpassword = arrItem[5];//item.Value._IPpassword;
                    }
                    else
                    {
                        AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ Wrong Format For Email Password ]");
                        return;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error >>> " + ex.StackTrace);
                }


                Globussoft.GlobusHttpHelper globusHelper = new Globussoft.GlobusHttpHelper();
                TweetAccountManager Accountmanager = new TweetAccountManager();

                Accountmanager.logEvents.addToLogger += new EventHandler(logEvents_addToLogger);

                ClsEmailActivator EmailActivate = new ClsEmailActivator();

                try
                {
                    Accountmanager.globusHttpHelper = globusHelper;
                    Accountmanager.Username = Email.Replace(" ", "").Replace("\0", "");
                    Accountmanager.Password = Password;
                    Accountmanager.IPAddress = IPAddress;
                    Accountmanager.IPPort = IPPort;
                    Accountmanager.IPUsername = IPUsername;
                    Accountmanager.IPpassword = IPpassword;
                    Accountmanager.Login();

                    if (Accountmanager.IsLoggedIn)
                    {
                        string postData = ("authenticity_token=" + Accountmanager.postAuthenticityToken).Trim();
                        string postdataPageSource = Accountmanager.globusHttpHelper.postFormData(new Uri("https://twitter.com/account/resend_confirmation_email"), postData, "	https://twitter.com/", "", "", "", "");
                    }
                }
                catch { };


                bool verified = EmailActivate.EmailVerification(Email, Password, ref globusHelper);

                if (verified)
                {
                    try
                    {
                        string pageresponce = Accountmanager.globusHttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/"), "", "");

                        //if (pageresponce.Contains("btn resend-confirmation-email-link"))
                        //{
                        //    verified = false;
                        //}
                    }
                    catch (Exception)
                    {
                        AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ Verified Account  login Failed  : " + Email + " ]");
                    }
                }
                if (verified && Accountmanager.IsLoggedIn)
                {

                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + username + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_SuccessfullyVerifiedAccounts);
                    AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ Account Verified : " + Email + " ]");
                }
                else
                {
                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + username + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_VerificationFailedAccounts);
                    AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ Account Couldn't be Email Verified : " + Email + " ]");
                }
            }
            catch (Exception ex)
            {
                //AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ " + ex.Message + " ]");
            }
            finally 
            {
                counter--;
                if (counter == 0)
                {
                    AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                    AddToEmailVerificationLog("------------------------------------------------------------------------------------------------------------------------------------------");
                }
            }
        }
Exemplo n.º 8
0
        public void getLoginandCheckAccount()
        {
            AddToLog_Checker("[ " + DateTime.Now + " ] => [ Process start ]");

            try
            {
                Lst_GetUserNameFromAccThreads.Add(Thread.CurrentThread);
                GetUserNameFromAccThreadStart = true;
                Thread.CurrentThread.IsBackground = true;
            }
            catch { };

            try
            {
                //Get individual Email from Email list

                foreach (string item in listOfTwitterEmailIdAndPassword)
                {
                    TweetAccountManager tweetAccountManager = new TweetAccountManager();

                    GlobusHttpHelper globushttpHelper1 = new GlobusHttpHelper();

                    if (item.Contains(":") && !string.IsNullOrEmpty(item.Split(':')[0]) && !string.IsNullOrEmpty(item.Split(':')[1]))
                    {
                        string userEmail = item.Split(':')[0];
                        string userEmailPass = item.Split(':')[1];

                        tweetAccountManager.Username = userEmail;
                        tweetAccountManager.Password = userEmailPass;

                        tweetAccountManager.logEvents.addToLogger += new EventHandler(logEvents_addToLogger);
                        if (!tweetAccountManager.IsLoggedIn)
                        {
                            tweetAccountManager.Login();
                        }

                        if (tweetAccountManager.IsLoggedIn)
                        {
                            //AddToLog_Checker("Log in Success " + userEmail);

                            if (!tweetAccountManager.IsNotSuspended)
                            {
                                AddToLog_Checker("[ " + DateTime.Now + " ] => [ Account Is suspended :-" + userEmail + " ]");
                                continue;
                            }

                            String userID = tweetAccountManager.userID;

                            String ScreanName = tweetAccountManager.Screen_name;

                            if (!string.IsNullOrEmpty(userID) && !string.IsNullOrEmpty(ScreanName))
                            {
                                if (!File.Exists(Globals.Path_CheckAccountByEmail))
                                {
                                    string Header = "Email" + "," + "User Id" + "," + "Screan Name";
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Header, Globals.Path_CheckAccountByEmail);
                                }

                                string CheckAccountByEmail_Data = userEmail + "," + userID + "," + ScreanName;
                                if (!string.IsNullOrEmpty(userEmail))
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine(CheckAccountByEmail_Data, Globals.Path_CheckAccountByEmail);
                                    AddToLog_Checker("[ " + DateTime.Now + " ] => [ " + userEmail + "-" + userID + "-" + ScreanName + " ]");
                                }
                            }

                            #region Old code from API 1
                            //string URL = string.Empty;
                            ////get data from API Url ...
                            //if (!string.IsNullOrEmpty(tweetAccountManager.userID))
                            //{
                            //    string userID1 = tweetAccountManager.userID;
                            //    URL = "https://api.twitter.com/1/users/show.json?user_id=" + userID1 + "&include_entities=true";
                            //}
                            //else if (!string.IsNullOrEmpty(tweetAccountManager.Screen_name))
                            //{
                            //    string user_screen_name = tweetAccountManager.Screen_name;
                            //    URL = "https://api.twitter.com/1/users/show.json?screen_name=" + user_screen_name + "&include_entities=true";
                            //}
                            //else
                            //{
                            //    AddToLog_Checker("User Id or Screan name is Not avaliable For :- " + userEmail);
                            //    //continue;
                            //}

                            //try
                            //{
                            //    string Data = globushttpHelper1.getHtmlfromUrl(new Uri(URL), "", "");

                            //    //parse data from Json..
                            //    JObject JData = JObject.Parse(Data);
                            //    string ScreanName = (string)JData["screen_name"];
                            //    string userID = ((int)JData["id"]).ToString();
                            //    //get write data in CSV file ...
                            //    if (!string.IsNullOrEmpty(userID) && !string.IsNullOrEmpty(ScreanName))
                            //    {
                            //        if (!File.Exists(Globals.Path_CheckAccountByEmail))
                            //        {
                            //            string Header = "Email" + "," + "User Id" + "," + "Screan Name";
                            //            GlobusFileHelper.AppendStringToTextfileNewLine(Header, Globals.Path_CheckAccountByEmail);
                            //        }

                            //        string CheckAccountByEmail_Data = userEmail + "," + userID + "," + ScreanName;
                            //        if (!string.IsNullOrEmpty(userEmail))
                            //        {
                            //            GlobusFileHelper.AppendStringToTextfileNewLine(CheckAccountByEmail_Data, Globals.Path_CheckAccountByEmail);
                            //            AddToLog_Checker(userEmail + "-" + userID + "-" + ScreanName);
                            //        }
                            //    }
                            //}
                            //catch (Exception)
                            //{

                            //}
                            #endregion
                        }
                    }
                    else
                    {
                        AddToLog_Checker("[ " + DateTime.Now + " ] => [ Account Format is wrong for :- " + item + " ]");
                    }
                }
                AddToLog_Checker("[ " + DateTime.Now + " ] => [ Account Checking Finished ]");

                AddToLog_Checker("-----------------------------------------------------------------------------------------------------------------------");
            }
            catch (Exception)
            {
            }

            finally
            {
                AddToLog_Checker("[ " + DateTime.Now + " ] => [ Finished Getting Username For all Emails ]");
                AddToLog_Checker("-----------------------------------------------------------------------------------------------------------------------");
            }
        }
Exemplo n.º 9
0
        public void GetUserNameToID(string exportPath)
        {
            try
            {
                int counter = 0;
                TweetAccountManager TweetLogin = new TweetAccountManager();
                GlobusHttpHelper globusHttpHelper = new GlobusHttpHelper();
                foreach (KeyValuePair<string, TweetAccountManager> item in TweetAccountContainer.dictionary_TweetAccount)
                {
                    if (counter > TweetAccountContainer.dictionary_TweetAccount.Count)
                    {
                        counter = 0;
                    }
                    TweetLogin = new TweetAccountManager();
                    TweetLogin.Username = item.Key;
                    TweetLogin.Password = item.Value.Password;
                    TweetLogin.proxyAddress = item.Value.proxyAddress;
                    TweetLogin.proxyPort = item.Value.proxyPort;
                    TweetLogin.proxyUsername = item.Value.proxyUsername;
                    TweetLogin.proxyPassword = item.Value.proxyPassword;
                    TweetLogin.Login();
                    if (!TweetLogin.IsNotSuspended)
                    {
                        continue;
                    }
                    else
                    {
                        globusHttpHelper = TweetLogin.globusHttpHelper;
                        counter++;
                        break;
                    }
                }
                string ReturnStatus = string.Empty;

                if (!TweetLogin.IsNotSuspended)
                {
                    AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Please Upload Atleast One Working Account To Get Details ]");
                    return;
                }
                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Starting Scraping For Userids ]");
                foreach (string Username in lstUserNameID)
                {
                    AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Username : "******" ]");
                    string returnStatus = string.Empty;
                    string UserId = TwitterDataScrapper.GetUsernameToUserID_New(Username, out returnStatus, ref globusHttpHelper);
                    if (returnStatus == "No Error" && !string.IsNullOrEmpty(UserId))
                    {
                        AddToScrapeLogs("[ " + DateTime.Now + " ] => [ " + Username + " >>> " + UserId + " ]");
                        GlobusFileHelper.AppendStringToTextfileNewLine(Username + "," + UserId, exportPath);
                        lstScrapedUserID.Add(UserId);
                    }
                    else if (returnStatus == "Rate limit exceeded")
                    {
                        AddToScrapeLogs("[ " + DateTime.Now + " ] => [ " + Username + " >>> " + returnStatus + " ]");
                        break;
                    }
                    else if (returnStatus == "Sorry, that page does not exist")
                    {
                        AddToScrapeLogs("[ " + DateTime.Now + " ] => [ " + Username + " >>> " + returnStatus + " ]");
                    }
                    else if (returnStatus == "User has been suspended")
                    {
                        AddToScrapeLogs("[ " + DateTime.Now + " ] => [ " + Username + " >>> " + returnStatus + " ]");
                    }
                }
                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ " + lstScrapedUserID.Count + " UserId Scraped ]");
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetUserNameToID() --> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetUserNameToID() --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }
        }
Exemplo n.º 10
0
        private void threadStartScrape()
        {
            TwitterDataScrapper dataScrapeer = new TwitterDataScrapper();
            try
            {
                List<string> lst_structTweetFollowersIDs = new List<string>();
                List<string> lst_structTweetFollowingsIds = new List<string>();
                GlobusHttpHelper globusHttpHelper = new GlobusHttpHelper();
                string user_id = string.Empty;
                int counter = 0;
                TweetAccountManager TweetLogin = new TweetAccountManager();
                string ReturnStatus = string.Empty;
                Globals.IsMobileVersion = true;
                if (!Globals.IsMobileVersion)
                {
                    foreach (KeyValuePair<string, TweetAccountManager> item in TweetAccountContainer.dictionary_TweetAccount)
                    {
                        if (counter > TweetAccountContainer.dictionary_TweetAccount.Count)
                        {
                            counter = 0;
                        }

                        TweetLogin = new TweetAccountManager();
                        TweetLogin.Username = item.Key;
                        TweetLogin.Password = item.Value.Password;
                        TweetLogin.proxyAddress = item.Value.proxyAddress;
                        TweetLogin.proxyPort = item.Value.proxyPort;
                        TweetLogin.proxyUsername = item.Value.proxyUsername;
                        TweetLogin.proxyPassword = item.Value.proxyPassword;
                        TweetLogin.Login();

                        if (!TweetLogin.IsLoggedIn)
                        {
                            continue;
                        }
                        else
                        {
                            globusHttpHelper = TweetLogin.globusHttpHelper;
                            counter++;
                            break;
                        }
                    }

                    if (!TweetLogin.IsLoggedIn)
                    {
                        AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Please Upload Atleast One Working Account To Get Details ]");
                        return;
                    }

                }

                foreach (string keyword in lstscrapeUsername)
                {

                    dataScrapeer.CounterDataNo = 500;

                    txtlimitScrapeUsers.Invoke(new MethodInvoker(delegate
                    {
                        if (!string.IsNullOrEmpty(txtlimitScrapeUsers.Text) && NumberHelper.ValidateNumber(txtlimitScrapeUsers.Text))
                        {
                            dataScrapeer.CounterDataNo = Convert.ToInt32(txtlimitScrapeUsers.Text);
                        }
                    }));

                    if (counter > TweetAccountContainer.dictionary_TweetAccount.Count)
                    {
                        counter = 0;
                    }

                    if (chkboxScrapeFollowers.Checked)
                    {
                        try
                        {
                            if (!File.Exists(Globals.Path_ScrapedFollowersList))
                            {
                               // GlobusFileHelper.AppendStringToTextfileNewLine("Name/Id , FollowersUserID , Followers User Name", Globals.Path_ScrapedFollowersList);
                                GlobusFileHelper.AppendStringToTextfileNewLine("Name/Id ,  Followers User Name", Globals.Path_ScrapedFollowersList);
                            }

                            try
                            {
                                dataScrapeer.logEvents.addToLogger += new EventHandler(DataScraperlogger_addToLogger);
                                if (!Globals.IsMobileVersion)
                                {
                                    lst_structTweetFollowersIDs = dataScrapeer.GetFollowers_New(keyword.Trim(), out ReturnStatus, ref globusHttpHelper);
                                }
                                else
                                {
                                    lst_structTweetFollowersIDs = dataScrapeer.GetFollowers_New_ForMobileVersion(keyword.Trim(), out ReturnStatus, ref globusHttpHelper);
                                }
                                dataScrapeer.logEvents.addToLogger -= new EventHandler(DataScraperlogger_addToLogger);
                            }
                            catch (Exception ex)
                            {

                            }
                            if (lst_structTweetFollowersIDs.Count > 0)
                            {
                                //AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Adding To DataBase and File ]");
                                //AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Added " + lst_structTweetFollowersIDs.Count + " Followers to list ]");

                                //foreach (string data in lst_structTweetFollowersIDs)
                                //{
                                //    try
                                //    {
                                //        string[] arr_data = data.Split(':');
                                //        Globals.lstScrapedUserIDs.Add(arr_data[0]);
                                //        GlobusFileHelper.AppendStringToTextfileNewLine(keyword + "," + arr_data[0] + "," + arr_data[1], Globals.Path_ScrapedFollowersList);
                                //    }
                                //    catch (Exception ex)
                                //    {
                                //        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> btnScrapeKeyword_Click() -- lst_structTweetFollowersIDs foreach  --> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                                //        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> btnScrapeKeyword_Click() -- lst_structTweetFollowersIDs foreach --> " + ex.Message, Globals.Path_TwtErrorLogs);
                                //    }
                                //}

                                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Added " + lst_structTweetFollowersIDs.Count + " Followers from User: "******" ]");
                                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Data Exported to " + Globals.Path_ScrapedFollowersList);
                                if (Globals.IsDirectedFromFollower)
                                {
                                    AddToLog_Follower("[ " + DateTime.Now + " ] => [ Added " + lst_structTweetFollowersIDs.Count + " Followers from User: "******" ]");
                                    Thread.Sleep(1000);
                                }
                            }
                            else if (ReturnStatus.Contains("Sorry, that page does not exist"))
                            {
                                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Sorry, That User does not exist =>" + ReturnStatus.Split(':')[1] + " ]");
                                continue;
                            }
                            else if (ReturnStatus == "Account is Suspended. ")
                            {
                                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Account " + keyword + "  is Suspended. ]");
                            }
                            else if (ReturnStatus == "Error")
                            {
                                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Rate Limit Exceeded.Please Try After Some Time ]");
                            }
                            else
                            {
                                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ " + keyword + " User does not exist ]");
                            }
                        }
                        catch (Exception ex)
                        {
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> btnScrapeUser_Click() -- chkboxScrapeFollowers.Checked --> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> btnScrapeUser_Click() -- chkboxScrapeFollowers.Checked --> " + ex.Message, Globals.Path_TwtErrorLogs);
                        }
                    }

                    if (chkboxScrapeFollowings.Checked)
                    {
                        try
                        {
                            if (!File.Exists(Globals.Path_ScrapedFollowingsList))
                            {
                              //  GlobusFileHelper.AppendStringToTextfileNewLine("Name/Id , FollowingsUserID , Following User Name", Globals.Path_ScrapedFollowingsList);
                                GlobusFileHelper.AppendStringToTextfileNewLine("Name/Id , Following User Name", Globals.Path_ScrapedFollowingsList);

                            }
                            string returnStaus = string.Empty;
                            string Screen_name = string.Empty;
                            dataScrapeer.logEvents.addToLogger += new EventHandler(DataScraperlogger_addToLogger);
                           // GlobusHttpHelper globusHttpHelper1 = new GlobusHttpHelper();
                            if (!Globals.IsMobileVersion)
                            {
                                lst_structTweetFollowingsIds = dataScrapeer.GetFollowings_New(keyword.Trim(), out returnStaus, ref  globusHttpHelper);

                            }
                            else
                            {
                                lst_structTweetFollowingsIds = dataScrapeer.GetFollowings_NewForMobileVersion(keyword.Trim(), out returnStaus, ref  globusHttpHelper);
                            }

                            if (lst_structTweetFollowingsIds.Count > 0)
                            {

                                if (lst_structTweetFollowingsIds.Count > 0)
                                {

                                    AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Added " + lst_structTweetFollowingsIds.Count + " Followings from User: "******" ]");
                                    AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Data Exported to " + Globals.Path_ScrapedFollowingsList + " ]");
                                    if (Globals.IsDirectedFromFollower)
                                    {
                                        AddToLog_Follower("[ " + DateTime.Now + " ] => [ Added " + lst_structTweetFollowingsIds.Count + " Followings from User: "******" ]");
                                        Thread.Sleep(1000);
                                        //Tb_AccountManager.Invoke(new MethodInvoker(delegate
                                        //{
                                        //    Tb_AccountManager.SelectedIndex = 2;
                                        //}));
                                        //tabMain.SelectedIndex = 2;
                                    }
                                }
                                else if (returnStaus == "Error")
                                {
                                    AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Rate Limit Exceeded.Please Try After Some Time ]");
                                    break;
                                }
                            }
                            else
                            {
                                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ " + keyword + " User does not have any followings ]");
                            }
                        }
                        catch (Exception ex)
                        {
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> btnScrapeKeyword_Click() -- lst_structTweetFollowingsIds foreach --> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> btnScrapeKeyword_Click() -- lst_structTweetFollowingsIds foreach --> " + ex.Message, Globals.Path_TwtErrorLogs);
                        }
                    }

                    Globals.lstScrapedUserIDs = Globals.lstScrapedUserIDs.Distinct().ToList();
                }

                Globals.IsMobileVersion = false;
                new Thread(() =>
                {
                    try
                    {
                        List<string> temp = new List<string>();
                        foreach (string item in Globals.lstScrapedUserIDs)
                        {
                            temp.Add(item);
                        }

                        foreach (string data in temp)
                        {
                            try
                            {
                                clsDBQueryManager DataBase = new clsDBQueryManager();
                                DataBase.InsertOrUpdateScrapeSetting(data, "", "");
                            }
                            catch (Exception ex)
                            {
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> lstScrapedUserIDs --> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> lstScrapedUserIDs --> " + ex.Message, Globals.Path_TwtErrorLogs);
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }

                }).Start();

                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                AddToScrapeLogs("------------------------------------------------------------------------------------------------------------------------------------------");

                //if (IsUserScrapedDatalist)
                //{
                //    Tb_AccountManager.Invoke(new MethodInvoker(delegate
                //    {
                //        Tb_AccountManager.SelectedIndex = 0;
                //        //Tb_AccountManager.SelectedTab.Name = "tabFollower";
                //    }));
                //}
            }
            catch (Exception)
            {

            }
            finally
            {
                IsStart_ScrapUser = true;
                dataScrapeer.logEvents.addToLogger -= new EventHandler(DataScraperlogger_addToLogger);
            }
        }
Exemplo n.º 11
0
        private void threadStartScrapeInTweetMentionUser()
        {
            TwitterDataScrapper dataScrapeer = new TwitterDataScrapper();
            try
            {
                List<string> lst_structTweetFollowersIDs = new List<string>();
                List<string> lst_structTweetFollowingsIds = new List<string>();
                GlobusHttpHelper globusHttpHelper = new GlobusHttpHelper();
                string user_id = string.Empty;
                int counter = 0;
                TweetAccountManager TweetLogin = new TweetAccountManager();

                foreach (KeyValuePair<string, TweetAccountManager> item in TweetAccountContainer.dictionary_TweetAccount)
                {
                    if (counter > TweetAccountContainer.dictionary_TweetAccount.Count)
                    {
                        counter = 0;
                    }

                    TweetLogin = new TweetAccountManager();
                    TweetLogin.Username = item.Key;
                    TweetLogin.Password = item.Value.Password;
                    TweetLogin.proxyAddress = item.Value.proxyAddress;
                    TweetLogin.proxyPort = item.Value.proxyPort;
                    TweetLogin.proxyUsername = item.Value.proxyUsername;
                    TweetLogin.proxyPassword = item.Value.proxyPassword;
                    AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Logging Process start for scrapping User ]");
                    TweetLogin.Login();
                    if (!TweetLogin.IsLoggedIn)
                    {
                        continue;
                    }
                    else
                    {
                        AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Logged in successful]");
                        globusHttpHelper = TweetLogin.globusHttpHelper;
                        counter++;
                        break;
                    }
                }
                string ReturnStatus = string.Empty;

                if (!TweetLogin.IsLoggedIn)
                {
                    AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Please Upload Atleast One Working Account To Get Details ]");
                    return;
                }

                //foreach (string keyword in listUserIDs)//foreach (string keyword in lstscrapeUsername)
                //{
                string keyword = txtTweetScrapUserData.Text.Trim();

                dataScrapeer.CounterDataNo = 100;
                listUserIDs.Clear();

                txtlimitScrapeUsersINFollower.Invoke(new MethodInvoker(delegate
                {
                    if (!string.IsNullOrEmpty(txtTweetEnteNoofUser.Text) && NumberHelper.ValidateNumber(txtTweetEnteNoofUser.Text))
                    {
                        dataScrapeer.CounterDataNo = Convert.ToInt32(txtTweetEnteNoofUser.Text);
                    }
                }));

                if (counter > TweetAccountContainer.dictionary_TweetAccount.Count)
                {
                    counter = 0;
                }

                if (chkTweetScrapFollowers.Checked)
                {
                    try
                    {
                        if (!File.Exists(Globals.Path_ScrapedFollowersList))
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine("Name/Id , FollowersUserID , Followers User Name", Globals.Path_ScrapedFollowersList);
                        }
                        string returnStatus = string.Empty;
                        dataScrapeer.logEvents.addToLogger += new EventHandler(logEvents_Tweet_addToLogger);
                        lst_structTweetFollowersIDs = dataScrapeer.GetFollowers_New(keyword.Trim(), out ReturnStatus, ref globusHttpHelper);
                        dataScrapeer.logEvents.addToLogger -= new EventHandler(logEvents_Tweet_addToLogger);
                        AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Followers Scrapped ]");
                        //TwitterDataScrapper.logEvents.addToLogger -= new EventHandler(DataScraperlogger_addToLogger);

                        if (lst_structTweetFollowersIDs.Count > 0)
                        {
                            //listUserIDs.Clear();
                            //string item=Globals.Path_ScrapedFollowersList.Split(':')[0];
                            //if (Chk_IsFollowerUserId.Checked)
                            {
                                foreach (string item in lst_structTweetFollowersIDs)
                                {
                                    string userid = item.Split(':')[1];
                                    lst_mentionUser.Add(userid);
                                }
                            }

                            if (lst_structTweetFollowersIDs.Count > 0)
                            {
                                //listUserIDs.AddRange(lst_structTweetFollowersIDs);
                                AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Added " + lst_structTweetFollowersIDs.Count + " Followers from User: "******" ]");
                                AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Data Exported to " + Globals.Path_ScrapedFollowersList);
                            }

                        }
                        else if (ReturnStatus.Contains("Sorry, that page does not exist"))
                        {
                            AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Sorry, That User does not exist =>" + ReturnStatus.Split(':')[1] + " ]");
                            //continue;
                        }
                        else if (ReturnStatus == "Account is Suspended. ")
                        {
                            AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Account " + keyword + "  is Suspended. ]");
                        }
                        else if (ReturnStatus == "Error")
                        {
                            AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Rate Limit Exceeded.Please Try After Some Time ]");
                        }
                        else
                        {
                            AddToLog_Tweet("[ " + DateTime.Now + " ] => [ " + keyword + " does not have any Followers ]");
                        }
                    }
                    catch (Exception ex)
                    {
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> btnScrapeUser_Click() -- chkboxScrapeFollowers.Checked --> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> btnScrapeUser_Click() -- chkboxScrapeFollowers.Checked --> " + ex.Message, Globals.Path_TwtErrorLogs);
                    }
                }

                if (chkRetweetScrapFollowings.Checked)
                {
                    try
                    {
                        if (!File.Exists(Globals.Path_ScrapedFollowingsList))
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine("Name/Id , FollowersUserID , Followers User Name", Globals.Path_ScrapedFollowingsList);
                        }
                        string returnStaus = string.Empty;

                        dataScrapeer.logEvents.addToLogger += new EventHandler(logEvents_Tweet_addToLogger);
                        lst_structTweetFollowingsIds = dataScrapeer.GetFollowings_New(keyword.Trim(), out returnStaus, ref globusHttpHelper);
                        AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Following Scrapped ]");
                        if (lst_structTweetFollowingsIds.Count > 0)
                        {

                            //listUserIDs.Clear();
                            //if (Chk_IsFollowerUserId.Checked)
                            {
                                foreach (string item in lst_structTweetFollowingsIds)
                                {
                                    string userid = item.Split(':')[1];
                                    lst_mentionUser.Add(userid);
                                }
                            }

                            if (lst_structTweetFollowingsIds.Count > 0)
                            {

                                AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Added " + lst_structTweetFollowingsIds.Count + " Followings from User: "******" ]");
                                AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Data Exported to " + Globals.Path_ScrapedFollowingsList + " ]");

                            }

                        }
                        else if (ReturnStatus.Contains("Sorry, that page does not exist"))
                        {
                            AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Sorry, That User does not exist =>" + ReturnStatus.Split(':')[1] + " ]");
                            //continue;
                        }
                        else if (ReturnStatus == "Account is Suspended. ")
                        {
                            AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Account " + keyword + "  is Suspended. ]");
                        }
                        else if (ReturnStatus == "Error")
                        {
                            AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Rate Limit Exceeded.Please Try After Some Time ]");
                        }
                        else
                        {
                            AddToLog_Tweet("[ " + DateTime.Now + " ] => [ " + keyword + " User does not exist ]");
                        }
                    }
                    catch (Exception ex)
                    {
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> btnScrapeKeyword_Click() -- lst_structTweetFollowingsIds foreach --> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> btnScrapeKeyword_Click() -- lst_structTweetFollowingsIds foreach --> " + ex.Message, Globals.Path_TwtErrorLogs);
                    }
                }

            }
            catch (Exception)
            {

            }
            finally
            {
                IsStart_ScrapUser = true;
                dataScrapeer.logEvents.addToLogger -= new EventHandler(logEvents_Tweet_addToLogger);
            }
        }
Exemplo n.º 12
0
        private void ThreadpoolMethod_Retweet(object parameters)
        {
            TweetAccountManager tweetAccountManager = new TweetAccountManager();
            try
            {
                Array paramsArray = new object[1];

                paramsArray = (Array)parameters;

                KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);
                List<TwitterDataScrapper.StructTweetIDs> lst_DivideTweets = new List<TwitterDataScrapper.StructTweetIDs>();
                if (TweetAccountManager.IsRetweetDivideRetweet)
                {
                     lst_DivideTweets = (List<TwitterDataScrapper.StructTweetIDs>)paramsArray.GetValue(1);
                }
                tweetAccountManager = keyValue.Value;

                AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Starting ReTweet For Account : " + keyValue.Key + " ]");

                //Add to Threads Dictionary
                AddThreadToDictionary(strModule(Module.Retweet), tweetAccountManager.Username);
                try
                {
                    //Thread.CurrentThread.Name = "ReTweet_" + tweetAccountManager.Username;
                    //Thread.CurrentThread.IsBackground = true;
                    //dictionary_Threads.Add("ReTweet_" + tweetAccountManager.Username, Thread.CurrentThread);
                    AddThreadToDictionary(strModule(Module.Retweet), tweetAccountManager.Username);
                }
                catch { }

                //Create logger Event for lof MSg's .
                tweetAccountManager.logEvents.addToLogger += new EventHandler(logEvents_Tweet_addToLogger);
                //tweetAccountManager.logEvents.addToLogger += logEvents_Tweet_addToLogger;
                tweetAccountManager.tweeter.logEvents.addToLogger += logEvents_Tweet_addToLogger;

                if (GlobusRegex.ValidateNumber(txtMinDelay_Tweet.Text))
                {
                    retweetMinDealy = Convert.ToInt32(txtMinDelay_Tweet.Text);
                }
                if (GlobusRegex.ValidateNumber(txtMaxDelay_Tweet.Text))
                {
                    retweetMaxDealy = Convert.ToInt32(txtMaxDelay_Tweet.Text);
                }

                if (chkboxRetweetPerDay.Checked)
                {
                    TweetAccountManager.RetweetPerDay = true;
                    if (!string.IsNullOrEmpty(txtMaximumNoRetweet.Text) && NumberHelper.ValidateNumber(txtMaximumNoRetweet.Text))
                    {
                        TweetAccountManager.NoOFRetweetPerDay = Convert.ToInt32(txtMaximumNoRetweet.Text);
                    }
                    else
                    {
                        TweetAccountManager.NoOFRetweetPerDay = 10;
                        AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Setting Maximum No Of ReTweets Per Day as 10 ]");
                    }

                    clsDBQueryManager DbQueryManager = new clsDBQueryManager();
                    DataSet Ds = DbQueryManager.SelectMessageData(keyValue.Key, "ReTweet");

                    int TodayReTweet = Ds.Tables["tb_MessageRecord"].Rows.Count;
                    tweetAccountManager.AlreadyRetweeted = TodayReTweet;

                    if (TodayReTweet >= TweetAccountManager.NoOFRetweetPerDay)
                    {
                        AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Already Retweeted " + tweetAccountManager.AlreadyRetweeted + " ]");
                        return;
                    }
                }

                if (chkCheckDatabaseInEvery2Minutes.Checked == true || chkAutoFavorite.Checked == true)
                {
                    while (true)
                    {
                        try
                        {
                            string count_tweet = string.Empty;
                            string count_tweet1 = string.Empty;

                            TwitterDataScrapper tweetScrapper = new TwitterDataScrapper();
                            TwitterDataScrapper.StructTweetIDs item1 = new TwitterDataScrapper.StructTweetIDs();
                            TweetAccountManager.que_lst_Struct_TweetData.Clear();
                            Queue<TwitterDataScrapper.StructTweetIDs> tempQueue = new Queue<TwitterDataScrapper.StructTweetIDs>();
                            TwitterDataScrapper.noOfRecords = 1;
                            AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Searching tweets for  " + keyValue.Key + " ]");
                            count_tweet = tweetScrapper.countNoOfTweet(txtTweetKeyword.Text.Trim());

                        startAgain:

                            TweetAccountManager.static_lst_Struct_TweetData = tweetScrapper.TweetExtractor_ByUserName_New_New(txtTweetKeyword.Text.Trim());

                            int count = TweetAccountContainer.dictionary_TweetAccount.Count();
                            foreach (TwitterDataScrapper.StructTweetIDs item in TweetAccountManager.static_lst_Struct_TweetData)
                            {
                                //for (int i = 1; i <= count * TweetAccountManager.static_lst_Struct_TweetData.Count(); i++)
                                {
                                    TweetAccountManager.que_lst_Struct_TweetData.Enqueue(item);
                                    tempQueue.Enqueue(item);
                                }

                            }
                            try
                            {
                                if (TweetAccountManager.que_lst_Struct_TweetData.Count > 0)

                                {
                                    item1 = tempQueue.Dequeue();
                                }
                            }
                            catch (Exception ex)
                            {
                                ErrorLogger.AddToErrorLogText(ex.Message);
                                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ThreadpoolMethod_Retweet() --> " + ex.Message, Globals.Path_TweetingErroLog);
                                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ThreadpoolMethod_Retweet() --> " + ex.Message, Globals.Path_TwtErrorLogs);
                            }

                            try
                            {
                                clsDBQueryManager DbQueryManager = new clsDBQueryManager();
                                DataSet Ds = DbQueryManager.SelectMessageDataForRetweet(keyValue.Key, item1.ID_Tweet, "ReTweet");
                                int count_NO_RoWs = Ds.Tables[0].Rows.Count;
                                if (count_NO_RoWs == 0)
                                {
                                    if (chkCheckDatabaseInEvery2Minutes.Checked)
                                    {
                                        tweetAccountManager.ReTweet("", retweetMinDealy, retweetMaxDealy);
                                    }
                                    if (chkAutoFavorite.Checked && tweetAccountManager.IsNotSuspended && tweetAccountManager.IsLoggedIn)
                                    {
                                        string TUri = item1.ID_Tweet.ToString();
                                        AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Added To Favorite : " + TUri + " from " + tweetAccountManager.Username + " ]");
                                        FavoriteOfUrl(new object[] { TUri, keyValue, tweetAccountManager });
                                    }
                                }

                                AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Searching new tweets will start after 3 minutes from " + tweetAccountManager.Username + " ]");
                                Thread.Sleep(3 * 60 * 1000);
                                count_tweet1 = tweetScrapper.countNoOfTweet(txtTweetKeyword.Text.Trim());
                                if (Convert.ToInt32(count_tweet) == Convert.ToInt32(count_tweet1))
                                {
                                    TwitterDataScrapper.noOfRecords = 1;
                                }
                                else if (Convert.ToInt32(count_tweet1) > Convert.ToInt32(count_tweet))
                                {
                                    TwitterDataScrapper.noOfRecords = Convert.ToInt32(count_tweet1) - Convert.ToInt32(count_tweet);
                                }
                                else
                                {
                                    TwitterDataScrapper.noOfRecords = 1;
                                }
                                TweetAccountManager.static_lst_Struct_TweetData.Clear();
                                TweetAccountManager.que_lst_Struct_TweetData.Clear();
                                tempQueue.Clear();
                                count_tweet = count_tweet1;
                            }
                            catch (Exception ex)
                            {
                                ErrorLogger.AddToErrorLogText(ex.Message);
                                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ThreadpoolMethod_Retweet() --> " + ex.Message, Globals.Path_TweetingErroLog);
                                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ThreadpoolMethod_Retweet() --> " + ex.Message, Globals.Path_TwtErrorLogs);
                            }
                            goto startAgain;
                        }
                        catch (Exception ex)
                        {
                            ErrorLogger.AddToErrorLogText(ex.Message);
                            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ThreadpoolMethod_Retweet() --> " + ex.Message, Globals.Path_TweetingErroLog);
                            GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ThreadpoolMethod_Retweet() --> " + ex.Message, Globals.Path_TwtErrorLogs);
                        }
                    }
                }
                else
                {

                    if (TweetAccountManager.IsRetweetDivideRetweet)
                    {
                        tweetAccountManager.ReTweetDivideRetweet(lst_DivideTweets, retweetMinDealy, retweetMaxDealy);
                    }
                    else
                    {
                        tweetAccountManager.ReTweet("", retweetMinDealy, retweetMaxDealy);
                    }
                }

                tweetAccountManager.logEvents.addToLogger -= logEvents_Tweet_addToLogger;
                tweetAccountManager.tweeter.logEvents.addToLogger -= logEvents_Tweet_addToLogger;
            }
            catch (Exception ex)
            {
                ErrorLogger.AddToErrorLogText(ex.Message);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ThreadpoolMethod_Retweet() --> " + ex.Message, Globals.Path_TweetingErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ThreadpoolMethod_Retweet() --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }

            finally
            {
                tweetAccountManager.logEvents.addToLogger -= logEvents_Tweet_addToLogger;
                tweetAccountManager.tweeter.logEvents.addToLogger -= logEvents_Tweet_addToLogger;
            }
        }
Exemplo n.º 13
0
        private void StartTweetingMultithreaded(object parameters)
        {
            Interlocked.Increment(ref countTweetMessageAccount);
            TweetAccountManager tweetAccountManager = new TweetAccountManager();
            try
            {
                Array paramsArray = new object[2];

                paramsArray = (Array)parameters;

                KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);

                //string userIDToFollow = (string)paramsArray.GetValue(1);
                //string tweetMessage = (string)paramsArray.GetValue(1);
                List<string> lst_tweetMessage = (List<string>)paramsArray.GetValue(1);

                //TweetAccountManager tweetAccountManager = keyValue.Value;
                tweetAccountManager = keyValue.Value;

                try
                {
                    Thread.CurrentThread.Name = "Tweet_" + tweetAccountManager.Username;
                    Thread.CurrentThread.IsBackground = true;
                    dictionary_Threads.Add("Tweet_" + tweetAccountManager.Username, Thread.CurrentThread);
                }
                catch { }

                AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Starting Tweet For Account :" + keyValue.Key + " ]");

                if (IsTweetScheduled)
                {
                    try
                    {
                        DateTime d1 = dateTimePicker_tweeterStart.Value;
                        DateTime d2 = dateTimePicker_TwetterEnd.Value;
                        TimeSpan t = d2 - DateTime.Now;

                        if (t.TotalSeconds <= 0)
                        {
                            AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Time Already Completed Stopping For Account : " + tweetAccountManager.Username + " ]");
                            return;
                        }
                        TweetAccountManager.StartTime = d1;
                        TweetAccountManager.EndTime = d2;

                        TimeSpan T = d2 - d1;

                        int Delay = T.Minutes;

                        int TotalTweets = 0;

                        if (!string.IsNullOrEmpty(txtNoOfTweets.Text) && NumberHelper.ValidateNumber(txtNoOfTweets.Text))
                        {
                            TotalTweets = Convert.ToInt32(txtNoOfTweets.Text);
                        }
                        else
                        {
                            TotalTweets = TweetAccountManager.NoOfTweetPerDay - tweetAccountManager.AlreadyTweeted;
                        }

                        int TotalDelay = (Delay * 60) / TotalTweets;

                        TweetAccountManager.DelayTweet = TotalDelay;
                    }
                    catch (Exception ex)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartTweetingMultithreaded() -- Tweet Scheduled --> " + ex.Message, Globals.Path_TweetingErroLog);
                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartTweetingMultithreaded() -- TweetScheduled  --> " + ex.Message, Globals.Path_TwtErrorLogs);
                    }
                }

                if (chkBoxUseGroup.Checked && !string.IsNullOrEmpty(txtTweetUseGroup.Text))
                {
                    if ((txtTweetUseGroup.Text).ToLower() == (tweetAccountManager.GroupName).ToLower())
                    {
                        AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Group Name Matching ]");
                    }
                    else if (txtTweetUseGroup.Text != tweetAccountManager.GroupName)

                    {
                        AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Group Name does not Match. ]");
                        return;
                    }
                }

                if (chkbosUseHashTags.Checked)
                {
                    tweetAccountManager.UseHashTags = true;
                    foreach (string Data in Globals.HashTags)
                    {
                        tweetAccountManager.que_TweetMessages_Hashtags.Enqueue(Data);
                    }
                }
                else
                {
                    tweetAccountManager.UseHashTags = false;
                }

                //Add to Threads Dictionary
                AddThreadToDictionary(strModule(Module.Tweet), tweetAccountManager.Username);

                ///Adding Logs to Logger
                tweetAccountManager.tweeter.logEvents.addToLogger += new EventHandler(logEvents_Tweet_addToLogger);
                tweetAccountManager.logEvents.addToLogger += logEvents_Tweet_addToLogger;

                if (!string.IsNullOrEmpty(txtMinDelay_Tweet.Text) && NumberHelper.ValidateNumber(txtMinDelay_Tweet.Text))
                {
                    tweetMinDealy = Convert.ToInt32(txtMinDelay_Tweet.Text);
                }
                if (!string.IsNullOrEmpty(txtMaxDelay_Tweet.Text) && NumberHelper.ValidateNumber(txtMaxDelay_Tweet.Text))
                {
                    tweetMaxDealy = Convert.ToInt32(txtMaxDelay_Tweet.Text);
                }
                //tweetAccountManager.Login();
                //tweetAccountManager.Tweet(tweetMessage);

                if (ChkboxTweetPerday.Checked)
                {
                    AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Checking Tweets Per Day ]");
                    TweetAccountManager.NoOfTweetPerDay = 0;
                    TweetAccountManager.TweetPerDay = true;
                    if (!string.IsNullOrEmpty(txtMaximumTweet.Text) && NumberHelper.ValidateNumber(txtMaximumTweet.Text))
                    {
                        TweetAccountManager.NoOfTweetPerDay = Convert.ToInt32(txtMaximumTweet.Text);
                        AddToLog_Tweet("[ " + DateTime.Now + " ] => [ " + TweetAccountManager.NoOfTweetPerDay + " Maximum No Of Tweets Per Day ]");
                    }
                    else
                    {
                        TweetAccountManager.NoOfTweetPerDay = 10;
                        AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Setting Maximum No Of Tweets Per Day as 10 ]");
                    }

                    clsDBQueryManager DbQueryManager = new clsDBQueryManager();
                    DataSet Ds = DbQueryManager.SelectMessageData(keyValue.Key, "Tweet");

                    int TodayTweet = Ds.Tables["tb_MessageRecord"].Rows.Count;
                    tweetAccountManager.AlreadyTweeted = TodayTweet;
                    AddToLog_Tweet("[ " + DateTime.Now + " ] => [ " + TodayTweet + " Already tweeted today ]");
                    if (TodayTweet >= TweetAccountManager.NoOfTweetPerDay)
                    {
                        AddToLog_Tweet("[ " + DateTime.Now + " ] => [ Already Tweeted " + TweetAccountManager.NoOfTweetPerDay + " ]");
                        return;
                    }
                }

                if (chkAllTweetsPerAccount.Checked)
                {
                    foreach (string item in lst_tweetMessage)
                    {
                        tweetAccountManager.que_TweetMessages_PerAccount.Enqueue(item);
                    }
                }

                tweetAccountManager.Tweet(lst_tweetMessage, tweetMinDealy, tweetMaxDealy);

                //tweetAccountManager.tweeter.logEvents.addToLogger -= logEvents_Tweet_addToLogger;
                //tweetAccountManager.logEvents.addToLogger -= logEvents_Tweet_addToLogger;
            }
            catch (Exception ex)
            {
                ErrorLogger.AddToErrorLogText(ex.Message);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartTweetingMultithreaded() --> " + ex.Message, Globals.Path_TweetingErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartTweetingMultithreaded() --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }

            finally
            {
                counter_AccountFollwer--;
                tweetAccountManager.tweeter.logEvents.addToLogger -= logEvents_Tweet_addToLogger;
                tweetAccountManager.logEvents.addToLogger -= logEvents_Tweet_addToLogger;
                Interlocked.Decrement(ref countTweetMessageAccount);

                lock (lockerThreadsTweetFeature)
                {
                    Monitor.Pulse(lockerThreadsTweetFeature);
                }

                if (counter_AccountFollwer == 0)
                {
                    if (btnStartFollowing.InvokeRequired)
                    {
                        Globals.TweetRunningText = string.Empty;
                        GlobusFileHelper.AppendStringToTextfileNewLine("Module Tweet count Total: " + Globals.totalcountTweet, Globals.path_CountNoOfProcessDone);
                        btnStartFollowing.Invoke(new MethodInvoker(delegate
                        {
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddToLog_Follower("---------------------------------------------------------------------------------------------------------------------------");

                        }));
                    }
                }
            }
        }
Exemplo n.º 14
0
        private void StartFollowingMultithreaded(object parameters)
        {
            TweetAccountManager tweetAccountManager = new TweetAccountManager();
            try
            {
                Array paramsArray = new object[3];

                paramsArray = (Array)parameters;

                KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);

                List<string> list_userIDsToFollow = (List<string>)paramsArray.GetValue(1);

                bool OtherUser = (bool)paramsArray.GetValue(2);
                int strMinDelay = (int)paramsArray.GetValue(3);
                int strMaxDelay = (int)paramsArray.GetValue(4);

                int intMinDelay = strMinDelay;
                int intMaxDelay = strMaxDelay;

                List<string> lstFollowers = new List<string>();
                List<string> lstFollowings = new List<string>();

                AddToLog_Follower("[ " + DateTime.Now + " ] => [ Starting Follower For Account : " + keyValue.Key + " ]");

                tweetAccountManager = keyValue.Value;
                TweetAccountManager.FileFollowUrlPath = txtPathUserIDs.Text.ToString();

                if (chkboxUseGroups.Checked)
                {
                    if (tweetAccountManager.GroupName != txtUseGroup.Text)
                    {
                        AddToLog_Follower("[ " + DateTime.Now + " ] => [ " + keyValue.Key + " Group Name Does Not Match ]");
                        return;
                    }
                }

                //Add to Threads Dictionary
                AddThreadToDictionary(strModule(Module.Follow), tweetAccountManager.Username);
                tweetAccountManager.follower.logEvents.addToLogger += new EventHandler(logEvents_Follower_addToLogger);
                tweetAccountManager.logEvents.addToLogger += logEvents_Follower_addToLogger;

                if (!tweetAccountManager.IsLoggedIn)
                {
                    tweetAccountManager.Login();
                }

                if (tweetAccountManager.AccountStatus == "Account Suspended")
                {
                    clsDBQueryManager database = new clsDBQueryManager();
                    database.UpdateSuspendedAcc(tweetAccountManager.Username);
                    return;
                }

                try
                {
                    AddToLog_Follower("[ " + DateTime.Now + " ] => [ " + list_userIDsToFollow.Count() + " user id in List ]");
                }
                catch (Exception)
                {
                }

                if (list_userIDsToFollow.Count > 0)
                {

                    tweetAccountManager.FollowUsingURLs(list_userIDsToFollow, intMinDelay, intMaxDelay, OtherUser);
                }
                else
                {
                    AddToLog_Follower("[ " + DateTime.Now + " ] => [ No ID's To Follow ]");
                }

                // tweetAccountManager.follower.logEvents.addToLogger -= logEvents_Follower_addToLogger;
                //tweetAccountManager.logEvents.addToLogger -= logEvents_Follower_addToLogger;
            }
            catch (Exception ex)
            {
                ErrorLogger.AddToErrorLogText(ex.Message);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartFollowingMultithreaded() --> " + ex.Message, Globals.Path_FollowerErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartFollowingMultithreaded() --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }

            finally
            {
                counter_AccountFollwer--;
                //TweetAccountManager tweetAccountManager = new TweetAccountManager();
                tweetAccountManager.follower.logEvents.addToLogger -= new EventHandler(logEvents_Follower_addToLogger);
                tweetAccountManager.logEvents.addToLogger -= logEvents_Follower_addToLogger;

                if (counter_AccountFollwer == 0)
                {
                    if (btnStartFollowing.InvokeRequired)
                    {
                        btnStartFollowing.Invoke(new MethodInvoker(delegate
                        {
                            Globals.FollowerRunningText = string.Empty;
                            GlobusFileHelper.AppendStringToTextfileNewLine("Module Follow count Total: " + Globals.totalcountFollower , Globals.path_CountNoOfProcessDone);
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddToLog_Follower("---------------------------------------------------------------------------------------------------------------------------");

                        }));
                    }
                }
            }
        }
Exemplo n.º 15
0
        private void LoadAccountsModewithMultithreaded(object acc)
        {
            Array paramsArray = new object[0];
            paramsArray = (Array)acc;
            string account = Convert.ToString(((object[])(paramsArray))[0]);
            string[] AccArr = account.Split(':');

            string accountUser = string.Empty;
            string accountPass = string.Empty;
            string screanName = string.Empty;
            string IPAddress = string.Empty;
            string IPPort = string.Empty;
            string IPUsername = string.Empty;
            string IPpassword = string.Empty;
            string status = string.Empty;

            if (AccArr.Count() > 1)
            {
                accountUser = account.Split(':')[0];
                accountPass = account.Split(':')[1];
                screanName = string.Empty;
                IPAddress = string.Empty;
                IPPort = string.Empty;
                IPUsername = string.Empty;
                IPpassword = string.Empty;
                status = string.Empty;

                int DataCount = account.Split(':').Length;
                if (DataCount == 2)
                {
                    //Globals.accountMode = AccountMode.NoIP;
                }
                else if (DataCount == 3)
                {
                    //Globals.accountMode = AccountMode.PublicIP;
                    screanName = account.Split(':')[2];
                }
                else if (DataCount == 4)
                {
                    //Globals.accountMode = AccountMode.PublicIP;
                    IPAddress = account.Split(':')[2];
                    IPPort = account.Split(':')[3];
                }
                else if (DataCount == 5)
                {
                    //Globals.accountMode = AccountMode.PublicIP;
                    screanName = account.Split(':')[2];
                    IPAddress = account.Split(':')[3];
                    IPPort = account.Split(':')[4];
                }
                
                else if (DataCount > 5 && DataCount < 7)
                {
                    //Globals.accountMode = AccountMode.PrivateIP;
                    IPAddress = account.Split(':')[2];
                    IPPort = account.Split(':')[3];
                    IPUsername = account.Split(':')[4];
                    IPpassword = account.Split(':')[5];
                    //dt.Rows.Add(accountUser, accountPass, string.Empty , string.Empty, IPAddress, IPPort, IPUsername, IPpassword, "", "0");
                }
                else if (DataCount == 7)
                {
                    //Globals.accountMode = AccountMode.PrivateIP;
                    screanName = account.Split(':')[2];
                    IPAddress = account.Split(':')[3];
                    IPPort = account.Split(':')[4];
                    IPUsername = account.Split(':')[5];
                    IPpassword = account.Split(':')[6];
                    //dt.Rows.Add(accountUser, accountPass, string.Empty , string.Empty, IPAddress, IPPort, IPUsername, IPpassword, "", "0");
                }
                
                if (Globals.IsFreeVersion)
                {
                    if (dgvAccounts.Rows.Count >= 5)
                    {
                        FrmFreeTrial frmFreeTrial = new FrmFreeTrial();
                        frmFreeTrial.TopMost = true;
                        frmFreeTrial.BringToFront();
                        frmFreeTrial.ShowDialog();
                        //break;
                    }
                }

                //dt.Rows.Add(accountUser, accountPass, screanName, string.Empty, IPAddress, IPPort, IPUsername, IPpassword, "", "0");
                BaseLib.DataBaseHandler.InsertQuery("INSERT INTO tb_FBAccount (UserName, Password, Screen_Name, FollowerCount, IPAddress, IPPort, IPUsername, IPpassword, ProfileName, ProfileStatus, GroupName , Status) VALUES ('" + accountUser + "','" + accountPass + "', '" + screanName + "', '' , '" + IPAddress + "','" + IPPort + "','" + IPUsername + "','" + IPpassword + "','" + "" + "' , '" + "" + "' ,'" + "" + "', '0')", "tb_FBAccount");

                try
                {
                    TweetAccountManager twitter = new TweetAccountManager();
                    twitter.Username = accountUser;
                    twitter.Password = accountPass;
                    twitter.IPAddress = IPAddress;
                    twitter.IPPort = IPPort;
                    twitter.IPUsername = IPUsername;
                    twitter.IPpassword = IPpassword;
                    twitter.profileStatus = 0;
                    twitter.AccountStatus = "";

                    LoadDataGridAfterAccountCreation();
                    if (!string.IsNullOrEmpty(twitter.Username))
                    {
                        TweetAccountContainer.dictionary_TweetAccount.Add(twitter.Username, twitter);
                        dictionary_TweetAccountOne.Add(twitter.Username, twitter);
                    }

                    
                   
                }
                catch { }

            }
            else
            {
                AddToListBox("[ " + DateTime.Now + " ] => [ Account has some problem : " + accountUser + " ]");
            }
        }
Exemplo n.º 16
0
        public void retweetOfUrl(object param)
        {
            string reTweetUrlPageSource = string.Empty;
            string ReTweetId = string.Empty;
            string tweetStatus = "";
            int minDelay = 20;
            int maxDelay = 25;
            int delay = 10 * 1000;
            if (GlobusRegex.ValidateNumber(txtRetweetFavMinDelay.Text) && GlobusRegex.ValidateNumber(txtRetweetFavMinDelay.Text))
            {
                minDelay = Convert.ToInt32(txtRetweetFavMinDelay.Text);
                maxDelay = Convert.ToInt32(txtRetweetFavMaxDelay.Text);
            }
            delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);

            TweetAccountManager tweetAccountManager = new TweetAccountManager();

            try
            {
                Tweeter.Tweeter tweeter = new Tweeter.Tweeter();

                Array ParamArr = (Array)param;

                string RetweetUrl = (string)ParamArr.GetValue(0);

                KeyValuePair<string, TweetAccountManager> keyValue_Item = (KeyValuePair<string, TweetAccountManager>)ParamArr.GetValue(1);

                tweetAccountManager = (TweetAccountManager)ParamArr.GetValue(2);

                try
                {
                    //Get Id of tweet from URL..
                    if (RetweetUrl.Contains("/"))
                    {
                        string[] SplitReTweetUrl = RetweetUrl.Split('/');
                        ReTweetId = SplitReTweetUrl[SplitReTweetUrl.Count() - 1];

                    }
                    else
                    {
                        AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ URL is in wrong Formate   > " + RetweetUrl + " ]");
                    }
                }
                catch (Exception)
                {
                    AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ URL is in wrong Formate   > " + RetweetUrl + " ]");
                }

                if (!string.IsNullOrEmpty(RetweetUrl))
                {

                    //check Coount is loged in or Is not suspended ..
                    if (tweetAccountManager.IsLoggedIn)
                    {
                        if (tweetAccountManager.IsNotSuspended)
                        {
                            try
                            {
                                //Get the page Source from URL...
                                //reTweetUrlPageSource = tweetAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(RetweetUrl), "", "");

                                //finally post retweet on Given Url ...
                                tweeter.ReTweetByUrl(ref tweetAccountManager.globusHttpHelper, tweetAccountManager.postAuthenticityToken, ReTweetId, out tweetStatus);

                                //check the return value from with condition ...if its succesfully retweeted or not ...
                                if (tweetStatus == "posted")
                                {
                                    //RetweetCount++;
                                    //Prnt in logger is posted..
                                    AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Retweeted :" + RetweetUrl + " from " + tweetAccountManager.Username + " ]");
                                    AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Success fully Retweeted Form Account > " + keyValue_Item.Key);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(keyValue_Item.Key + ":" + tweetAccountManager.Password + ":" + tweetAccountManager.proxyAddress + ":" + tweetAccountManager.proxyPort + ":" + tweetAccountManager.proxyUsername + ":" + tweetAccountManager.proxyPassword, Globals.path_SucessfullyRetweetToUrlFromId);
                                }
                                else
                                {
                                    AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Fail/Already Retweeted From Account  > " + keyValue_Item.Key + " ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(keyValue_Item.Key + ":" + tweetAccountManager.Password + ":" + tweetAccountManager.proxyAddress + ":" + tweetAccountManager.proxyPort + ":" + tweetAccountManager.proxyUsername + ":" + tweetAccountManager.proxyPassword, Globals.path_FailureRetweetToUrlFromId);
                                }
                                AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Retweet delay for "+delay+" secs ]");
                                //AddToLog_RetweetAndFavorite("Retweet delay for "+delay+" secs");
                                Thread.Sleep(delay * 1000);
                            }
                            catch (Exception ex)
                            {
                                //AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Error :-  > " + ex.Message + " ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine("Error :- Mathod Name :- retweetOfUrl- 1; Error Text :- " + ex.Message, Globals.path_LogErrorFromRetweetAndFavorit);
                            }
                        }
                        else
                        {
                            AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Account Is suspended  >" + keyValue_Item.Key + " ]");
                        }
                    }
                    else
                    {
                        AddToLog_RetweetAndFavorite("[ " + DateTime.Now + " ] => [ Account Login Faile   >" + keyValue_Item.Key + " ]");
                    }
                }
            }
            catch (Exception ex)
            {
                //AddToLog_RetweetAndFavorite("Error :-  > " + ex.Message);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error :- Mathod Name :- retweetOfUrl- 2; Error Text :- " + ex.Message, Globals.path_LogErrorFromRetweetAndFavorit);
            }
        }
Exemplo n.º 17
0
        private void LoadDataGridAfterAccountCreation()
        {
           
            try
            {
                DataTable dt = objclsFBAccount.SelectAccoutsForGridView();

                //ds = new DataSet();
                //ds.Tables.Add(dt);

                dgvAccounts.Invoke(new MethodInvoker(delegate
                {
                    dgvAccounts.DataSource = dt;
                }));

                Globals.listAccounts.Clear();
                TweetAccountContainer.dictionary_TweetAccount.Clear();
                ///Add Twitter instances to TweetAccountContainer.dictionary_TweetAccount

                foreach (DataRow dRow in dt.Rows)
                {
                    try
                    {
                        TweetAccountManager twitter = new TweetAccountManager();
                        twitter.Username = dRow[0].ToString();
                        twitter.Password = dRow[1].ToString();
                        twitter.Screen_name = dRow[2].ToString();
                        twitter.FollowerCount = dRow[3].ToString();
                        twitter.FollwingCount = dRow[4].ToString();
                        twitter.IPAddress = dRow[5].ToString();
                        twitter.IPPort = dRow[6].ToString();
                        twitter.IPUsername = dRow[7].ToString();
                        twitter.IPpassword = dRow[8].ToString();
                        twitter.GroupName = dRow[11].ToString();
                        twitter.AccountStatus = dRow[12].ToString();

                        //if (!string.IsNullOrEmpty(dRow[8].ToString()))
                        //{
                        //    facebooker.profileStatus = int.Parse(dRow[7].ToString());
                        //}
                        if (!string.IsNullOrEmpty(twitter.Username))
                        {
                            if (twitter.AccountStatus != "Suspended")
                            {
                                Globals.listAccounts.Add(twitter.Username + ":" + twitter.Password + ":" + twitter.IPAddress + ":" + twitter.IPPort + ":" + twitter.IPUsername + ":" + twitter.IPpassword + ":" + twitter.GroupName + ":" + twitter.AccountStatus);
                                TweetAccountContainer.dictionary_TweetAccount.Add(twitter.Username, twitter);

                                //Checked if user working on free version the it will not allowed to use mex 5 accounts.
                                if (Globals.IsFreeVersion)
                                {
                                    if (TweetAccountContainer.dictionary_TweetAccount.Count >= 5)
                                    {
                                        if (TweetAccountContainer.dictionary_TweetAccount.Count >= 5)
                                        {
                                            FrmFreeTrial frmFreeTrial = new FrmFreeTrial();
                                            frmFreeTrial.TopMost = true;
                                            frmFreeTrial.BringToFront();
                                            frmFreeTrial.ShowDialog();
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        GlobusFileHelper.AppendStringToTextfileNewLine("Method Name :- LoadDataGrid   >>  Error :- " + ex.StackTrace, Globals.Path_AccountUploadingErrorLog);
                    }
                }
               
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("Method Name :- LoadDataGrid   >>  Error :- " + ex.StackTrace, Globals.Path_AccountUploadingErrorLog);
            }
        
            

            this.Invoke(new MethodInvoker(delegate
            {
                if (TweetAccountContainer.dictionary_TweetAccount.Count > 0)
                {
                    lblAcccountStatus.Text = " " + TweetAccountContainer.dictionary_TweetAccount.Count + " Accounts loaded (" + lst_AccountForUpload.Count() + ") ";
                    //AddToListBox("[ " + DateTime.Now + " ] => [ " + TweetAccountContainer.dictionary_TweetAccount.Count + " Accounts loaded ]");
                    //Log("[ " + DateTime.Now + " ] => [ " + TweetAccountContainer.dictionary_TweetAccount.Count + " Accounts loaded ]");
                }
            }));

           
        }
Exemplo n.º 18
0
        public void startAccountCheckingByEmail(string Lst_EmailsForAccountChecking_item, int NoOfThreads)
        {
            try
            {
                accountCheckerThreadStartByEmail = true;
                Lst_accountCheckerThreadByEmail.Add(Thread.CurrentThread);
                Thread.CurrentThread.IsBackground = true;
            }
            catch (Exception)
            {
            }

            string email = string.Empty;
            string EmailPass = string.Empty;
            string proxyAddress = string.Empty;
            string port = string.Empty;
            string proxyusername = string.Empty;
            string proxypass = string.Empty;

            try
            {
                //Check all special carector which is not supported in twiter
                if (!Lst_EmailsForAccountChecking_item.Contains(":"))
                {
                    Regex objNotNaturalPattern = new Regex(@"[^\w\*]");
                    if (objNotNaturalPattern.IsMatch(Lst_EmailsForAccountChecking_item))
                    {
                        ThreadCount++;
                        AddToLog_Checker("[ " + DateTime.Now + " ] => [ User name is not Correct : " + Lst_EmailsForAccountChecking_item + " ]");
                        return;
                    }
                }

                if (!string.IsNullOrEmpty(Lst_EmailsForAccountChecking_item))
                {
                    string[] EmailArr = Lst_EmailsForAccountChecking_item.Split(':');

                    if (EmailArr.Count() == 2)
                    {
                        email = EmailArr[0];
                        EmailPass = EmailArr[1];
                    }
                    else if (EmailArr.Count() == 4)
                    {
                        email = EmailArr[0];
                        EmailPass = EmailArr[1];
                        proxyAddress = EmailArr[2];
                        port = EmailArr[3];
                    }
                    else if (EmailArr.Count() == 6)
                    {
                        email = EmailArr[0];
                        EmailPass = EmailArr[1];
                        proxyAddress = EmailArr[2];
                        port = EmailArr[3];
                        proxyusername = EmailArr[4];
                        proxypass = EmailArr[5];
                    }
                    else
                    {
                        ThreadCount++;
                        AddToLog_Checker("[ " + DateTime.Now + " ] => [ Uploaded Email Not in Correct Format ]");
                        return;
                    }
                }

                if (!string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(EmailPass))
                {

                    TweetAccountManager AccountManager = new TweetAccountManager();

                    AccountManager.logEvents.addToLogger += new EventHandler(logEvents_addToLogger);
                    // AccountManager.logEvents.addToLogger += logEvents_addToLogger;

                    AccountManager.Username = email;
                    AccountManager.Password = EmailPass;
                    AccountManager.proxyAddress = proxyAddress;
                    AccountManager.proxyPort = port;
                    AccountManager.proxyUsername = proxyusername;
                    AccountManager.proxyPassword = proxypass;

                    AccountManager.Login();

                    //ThreadCount++;

                    if (AccountManager.IsLoggedIn && AccountManager.IsNotSuspended && !AccountManager.Isnonemailverifiedaccounts)
                    {
                        AddToLog_Checker("[ " + DateTime.Now + " ] => [ Account : " + AccountManager.Username + " is Active ]");
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(AccountManager.Username + ":" + EmailPass + ":" + proxyAddress + ":" + port + ":" + proxyusername + ":" + proxypass, Globals.path_ActiveEmailAccounts);
                    }
                    else if (!AccountManager.IsLoggedIn && AccountManager.globusHttpHelper.gResponse.ResponseUri.AbsoluteUri.Contains("https://twitter.com/login/captcha"))
                    {
                        AddToLog_Checker("[ " + DateTime.Now + " ] => [ Account : " + AccountManager.Username + " Asking for captcha ]");
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(AccountManager.Username + ":" + EmailPass + ":" + proxyAddress + ":" + port + ":" + proxyusername + ":" + proxypass, Globals.path_EmailisNotCurrectOrIncorrectPass);
                    }
                    //Not necesary its allready done on followercount() method in account login
                    //else if (!AccountManager.IsNotSuspended)
                    //{
                    //    AddToLog_Checker("[ " + DateTime.Now + " ] => [ Account : " + AccountManager.Username + " is suspended ]");
                    //    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(AccountManager.Username + ":" + EmailPass + ":" + proxyAddress + ":" + port + ":" + proxyusername + ":" + proxypass, Globals.path_SuspendedEmailAccounts);
                    //}
                    else if (AccountManager.Isnonemailverifiedaccounts)
                    {
                        AddToLog_Checker("[ " + DateTime.Now + " ] => [ Account : " + AccountManager.Username + " is Required Email Verification ]");
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(AccountManager.Username + ":" + EmailPass + ":" + proxyAddress + ":" + port + ":" + proxyusername + ":" + proxypass, Globals.path_RequiredEmailVerificationAccounts);
                    }
                    else
                    {
                        AddToLog_Checker("[ " + DateTime.Now + " ] => [ Email is not exist/incorrect pass : "******" ]");
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(AccountManager.Username + ":" + EmailPass + ":" + proxyAddress + ":" + port + ":" + proxyusername + ":" + proxypass, Globals.path_EmailisNotCurrectOrIncorrectPass);
                    }

                    AccountManager.logEvents.addToLogger -= new EventHandler(logEvents_addToLogger);
                    AccountManager.logEvents.addToLogger -= logEvents_addToLogger;

                }
            }
            catch (Exception ex)
            {
                //ThreadCount++;
                //AddToLog_Checker("[ " + DateTime.Now + " ] => [ " + ex.Message + " ]");
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> CheckAccountsByEmail() --> " + ex.Message, Globals.Path_AccountCheckerErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> CheckAccounts() --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }
            finally
            {
                ThreadCount++;
                if (Lst_EmailsForAccountChecking.Count == ThreadCount)
                {
                    IsEmailProcessStart = true;
                    AddToLog_Checker("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED for Account checker by Email. ]");
                    AddToLog_Checker("------------------------------------------------------------------------------------------------------------------------------------------");
                }
                _TheadSem.Release();
            }
        }
Exemplo n.º 19
0
        public List<string> GetNonFollowingsBeforeSpecifiedDate(int noOfDays, ref TweetAccountManager AcManger)
        {
            TwitterDataScrapper followingScrapper = new TwitterDataScrapper();
            string status = string.Empty;
            followingScrapper.CounterDataNo = noOfUnfollows;
            List<string> followers = followingScrapper.GetFollowers_New(AcManger.Screen_name, out status, ref AcManger.globusHttpHelper);
            List<string> followings = followingScrapper.GetFollowings_New(AcManger.Screen_name, out status, ref AcManger.globusHttpHelper);

            List<string> nonFollowings = followings.Except(followers).ToList();

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

            ///Get list of Already Followings
            clsDBQueryManager queryManager = new clsDBQueryManager();
            DataTable dt_AlreadyFollowed = queryManager.SelectFollowData(Username);
            foreach (DataRow item in dt_AlreadyFollowed.Rows)
            {
                string user_AlreadyFollowed = item["following_id"].ToString();

                if (nonFollowings.Exists(s => ((s.Split(':')[0]) == user_AlreadyFollowed)))
                {
                    DateTime dt_Now = DateTime.Today;

                    string DateFollowed = item["DateFollowed"].ToString();
                    DateTime dt_DateFollowed1 = Convert.ToDateTime(DateFollowed);
                    //DateTime dt_DateFollowed = DateTime.Parse(String.Format("{0:d/M/yyyy HH:mm:ss}", dt_DateFollowed1));
                    DateTime dt_DateFollowed = dt_DateFollowed1;

                    TimeSpan dt_Difference = dt_Now.Subtract(dt_DateFollowed);
                    double dt_Difference1 = dt_Difference.Days;

                    if (dt_Difference.Days >= noOfDays)
                    {
                        requiredNonFollowingList.Add(user_AlreadyFollowed);
                    }
                }
            }

            return requiredNonFollowingList;
        }
Exemplo n.º 20
0
        public void StartCampaign()
        {
            try
            {
                AddToLog_Follower("[ " + DateTime.Now + " ] => [ Starting Campaign ]");
                string KeywordList = string.Empty;
                string UsernameList = string.Empty;
                if (Globals.Array[3] == "Username")
                {
                    Globals.Campaign_Name = Globals.Array[0];
                    Globals.IsCampaign = true;
                    AddToLog_Follower("[ " + DateTime.Now + " ] => [ Getting Followers & Following ]");
                    UsernameList = Globals.Array[1];
                    ReloadAccountsFromDataBase();
                    Globussoft.GlobusHttpHelper globusHttpHelper = new GlobusHttpHelper();
                    if (File.Exists(UsernameList))
                    {
                        List<string> LstUsernameCampiagn = GlobusFileHelper.ReadLargeFile(UsernameList);
                        listUserIDs = new List<string>();
                        List<string> ListUsername = new List<string>();
                        foreach (KeyValuePair<string, TweetAccountManager> item in TweetAccountContainer.dictionary_TweetAccount)
                        {
                            if (counter > TweetAccountContainer.dictionary_TweetAccount.Count)
                            {
                                counter = 0;
                            }
                            TweetAccountManager TweetLogin = new TweetAccountManager();
                            TweetLogin.Username = item.Key;
                            TweetLogin.Password = item.Value.Password;
                            TweetLogin.proxyAddress = item.Value.proxyAddress;
                            TweetLogin.proxyPort = item.Value.proxyPort;
                            TweetLogin.proxyUsername = item.Value.proxyUsername;
                            TweetLogin.proxyPassword = item.Value.proxyPassword;
                            TweetLogin.Login();
                            if (!TweetLogin.IsNotSuspended)
                            {
                                continue;
                            }
                            globusHttpHelper = TweetLogin.globusHttpHelper;
                            counter++;
                            break;
                        }
                        foreach (string keyword in LstUsernameCampiagn)
                        {
                            TwitterDataScrapper dataScrapeer = new TwitterDataScrapper();
                            try
                            {
                                string FollowerStatus = string.Empty;
                                string FollowingStatus = string.Empty;
                                AddToLog_Follower("[ " + DateTime.Now + " ] => [ Scraping Followers For : " + keyword + " ]");
                                dataScrapeer.CounterDataNo = 2000;
                                dataScrapeer.logEvents.addToLogger += new EventHandler(logEvents_Follower_addToLogger);
                                List<string> followerList = dataScrapeer.GetFollowers_New(keyword, out FollowerStatus, ref globusHttpHelper);

                                if (followerList.Count != 0)
                                {
                                    try
                                    {
                                        List<string> Temp_followers = new List<string>();
                                        followerList.ForEach(s =>
                                        {
                                            if (s.Contains(":"))
                                            {
                                                Temp_followers.Add(s.Split(':')[0]);
                                            }
                                            else
                                            {
                                                Temp_followers.Add(s.ToString());
                                            }
                                        });

                                        if (Temp_followers.Count != 0)
                                        {
                                            followerList.Clear();
                                            followerList.AddRange(Temp_followers);
                                        }
                                    }
                                    catch { };
                                }
                                followerList.ForEach(s => s.Split(':'));
                                dataScrapeer.logEvents.addToLogger -= new EventHandler(logEvents_Follower_addToLogger);
                                AddToLog_Follower("[ " + DateTime.Now + " ] => [ Follower For " + keyword + " >> " + followerList.Count + " ]");
                                if (FollowerStatus == "No Error")
                                {
                                    foreach (string lst in followerList)
                                    {
                                        listUserIDs.Add(lst);
                                    }
                                }
                                Thread.Sleep(5000);
                                AddToLog_Follower("[ " + DateTime.Now + " ] => [ Scraping Followings For : " + keyword + " ]");
                                dataScrapeer.logEvents.addToLogger += new EventHandler(logEvents_Follower_addToLogger);
                                List<string> followingList = dataScrapeer.GetFollowings_New(keyword, out FollowingStatus, ref globusHttpHelper);
                                dataScrapeer.logEvents.addToLogger -= new EventHandler(logEvents_Follower_addToLogger);
                                AddToLog_Follower("[ " + DateTime.Now + " ] => [ Following For " + keyword + " >> " + followingList.Count + " ]");
                                if (FollowingStatus == "No Error")
                                {
                                    foreach (string lst in followerList)
                                    {
                                        listUserIDs.Add(lst);
                                    }
                                }
                                Thread.Sleep(5000);
                            }
                            catch (Exception ex)
                            {
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartingCampaign() -- chkboxScrapeFollowers.Checked --> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartingCampaign() -- chkboxScrapeFollowers.Checked --> " + ex.Message, Globals.Path_TwtErrorLogs);
                            }
                        }

                        StartFollowing();
                    }
                    else
                    {
                        AddToLog_Follower("[ " + DateTime.Now + " ] => [ File : " + UsernameList + ". Does Not Exsist ]");
                    }
                }
                else if (Globals.Array[3] == "Keyword")
                {
                    KeywordList = Globals.Array[2];
                    ReloadAccountsFromDataBase();
                    if (File.Exists(KeywordList))
                    {
                        List<string> KeywordListdata = GlobusFileHelper.ReadLargeFile(KeywordList);
                        List<TwitterDataScrapper.StructTweetIDs> ids = new List<TwitterDataScrapper.StructTweetIDs>();
                        foreach (string id in KeywordListdata)
                        {
                            TwitterDataScrapper dataScrpeer = new TwitterDataScrapper();
                            TwitterDataScrapper.noOfRecords = 2000;
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ Scraping Users From Keyword : " + id + " ]");
                            dataScrpeer.logEvents.addToLogger += new EventHandler(logEvents_Follower_addToLogger);
                            ids = dataScrpeer.NewKeywordStructData(id);
                            dataScrpeer.logEvents.addToLogger -= new EventHandler(logEvents_Follower_addToLogger);
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ Total Users From Keyword : " + id + " : " + ids.Count + " ]");
                            foreach (TwitterDataScrapper.StructTweetIDs lst in ids)
                            {
                                listUserIDs.Add(lst.ID_Tweet_User);
                            }
                        }
                        StartFollowing();
                    }
                    else
                    {
                        AddToLog_Follower("[ " + DateTime.Now + " ] => [ File : " + KeywordList + ".Does Not Exsist ]");
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> Campaign --> startFlyCreationEvent_addToLogger() --> " + ex.Message, Globals.Path_CampaignManager);
            }
        }
Exemplo n.º 21
0
        public void StartResendEmailForVerification(object parameters)
        {
            try
            {
                lstEmailVarificationThread.Add(Thread.CurrentThread);
                lstEmailVarificationThread.Distinct().ToList();
                Thread.CurrentThread.IsBackground = true;

                Array paramsArray = new object[2];
                paramsArray = (Array)parameters;

                string Email = string.Empty;
                string Password = string.Empty;
                string username = string.Empty;
                string IPAddress = string.Empty;
                string IPPort = string.Empty;
                string IPUsername = string.Empty;
                string IPpassword = string.Empty;
                string IP = string.Empty;
                string tempEmail = string.Empty;
                string postdataPageSource = string.Empty;
                        
                counter = Lst_NonVerifiedEmailAccount.Count();
                string item = paramsArray.GetValue(0).ToString();


                try
                {
                    string[] arrItem = Regex.Split(item, ":");
                    tempEmail = arrItem[0];
                    if (arrItem.Length == 2)
                    {
                        Email = arrItem[0]; //item.Key;
                        Password = arrItem[1];//item.Value._Password;
                    }
                    else if (arrItem.Length == 4)
                    {
                        Email = arrItem[0]; //item.Key;
                        Password = arrItem[1];//item.Value._Password;
                        IPAddress = arrItem[2];//item.Value._IPAddress;
                        IPPort = arrItem[3];
                    }
                    else if (arrItem.Length == 6)
                    {
                        Email = arrItem[0]; //item.Key;
                        Password = arrItem[1];//item.Value._Password;
                        IPAddress = arrItem[2];//item.Value._IPAddress;
                        IPPort = arrItem[3];//item.Value._IPPort;
                        IPUsername = arrItem[4];//item.Value._IPUsername;
                        IPpassword = arrItem[5];//item.Value._IPpassword;
                    }
                    else
                    {
                        AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ Wrong Format For Email Password ]");
                        return;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error >>> " + ex.StackTrace);
                }


                Globussoft.GlobusHttpHelper globusHelper = new Globussoft.GlobusHttpHelper();
                TweetAccountManager Accountmanager = new TweetAccountManager();

                Accountmanager.logEvents.addToLogger += new EventHandler(logEvents_addToLogger);

                ClsEmailActivator EmailActivate = new ClsEmailActivator();

                try
                {
                    Accountmanager.globusHttpHelper = globusHelper;
                    Accountmanager.Username = Email.Replace(" ", "").Replace("\0", "");
                    Accountmanager.Password = Password;
                    Accountmanager.IPAddress = IPAddress;
                    Accountmanager.IPPort = IPPort;
                    Accountmanager.IPUsername = IPUsername;
                    Accountmanager.IPpassword = IPpassword;
                    Accountmanager.Login();

                    if (Accountmanager.IsLoggedIn)
                    {
                        string postData = ("authenticity_token=" + Accountmanager.postAuthenticityToken).Trim();
                        postdataPageSource = Accountmanager.globusHttpHelper.postFormData(new Uri("https://twitter.com/account/resend_confirmation_email"), postData, "	https://twitter.com/", "", "", "", "");
                    }
                }
                catch { };


                if (postdataPageSource.Contains("A confirmation email has been sent to you."))
                {
                    AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ Email send to confirmation for Account : " + Email + " ]");
                }
                
                else
                {
                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + username + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_VerificationFailedAccounts);
                    AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ Email not send to confirmation for Account : " + Email + " ]");
                }
            }
            catch (Exception ex)
            {
                //AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ " + ex.Message + " ]");
            }
            finally
            {
                counter--;
                if (counter == 0)
                {
                    AddToEmailVerificationLog("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                    AddToEmailVerificationLog("------------------------------------------------------------------------------------------------------------------------------------------");
                }
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// Gets the Accounts from "tb_FBAccount" and adds to Dictionary
        /// </summary>
        private void ReloadAccountsFromDataBase()
        {
            try
            {
                clsFBAccount objclsFBAccount = new clsFBAccount();

                DataTable dt = objclsFBAccount.SelectAccoutsForGridView();

                if (dt.Rows.Count > 0)
                {
                    Globals.listAccounts.Clear();
                    TweetAccountContainer.dictionary_TweetAccount.Clear();

                    ///Add Twitter instances to TweetAccountContainer.dictionary_TweetAccount
                    foreach (DataRow dRow in dt.Rows)
                    {
                        try
                        {
                            TweetAccountManager facebooker = new TweetAccountManager();
                            facebooker.Username = dRow[0].ToString();
                            facebooker.Password = dRow[1].ToString();
                            facebooker.Screen_name = dRow[2].ToString();
                            facebooker.FollowerCount = dRow[3].ToString();
                            facebooker.proxyAddress = dRow[5].ToString();
                            facebooker.proxyPort = dRow[6].ToString();
                            facebooker.proxyUsername = dRow[7].ToString();
                            facebooker.proxyPassword = dRow[8].ToString();
                            if (!string.IsNullOrEmpty(dRow[10].ToString()))
                            {
                                facebooker.profileStatus = int.Parse(dRow[10].ToString());
                            }

                            if (!string.IsNullOrEmpty(facebooker.Username))
                            {
                                Globals.listAccounts.Add(facebooker.Username + ":" + facebooker.Password + ":" + facebooker.proxyAddress + ":" + facebooker.proxyPort + ":" + facebooker.proxyUsername + ":" + facebooker.proxyPassword);
                                TweetAccountContainer.dictionary_TweetAccount.Add(facebooker.Username, facebooker);
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ReloadAccountsFromDataBase() -- Rows From DB --> " + ex.Message, Globals.Path_ProxySettingErroLog);
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ReloadAccountsFromDataBase() -- Rows From DB --> " + ex.Message, Globals.Path_TwtErrorLogs);
                        }

                    }
                    Console.WriteLine(Globals.listAccounts.Count + " Accounts loaded");
                    AddToGeneralLogs("[ " + DateTime.Now + " ] => [ " + Globals.listAccounts.Count + " Accounts loaded ]");
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ReloadAccountsFromDataBase() --> " + ex.Message, Globals.Path_ProxySettingErroLog);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ReloadAccountsFromDataBase() --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }
        }