private void ScrapeKeywordSeacrh() { try { TwitterDataScrapper TweetData = new TwitterDataScrapper(); txtRecords.Invoke(new MethodInvoker(delegate { if (!string.IsNullOrEmpty(txtRecords.Text.Trim()) && NumberHelper.ValidateNumber(txtRecords.Text.Trim())) { TwitterDataScrapper.noOfRecords = Convert.ToInt32(txtRecords.Text.Trim()); if (TwitterDataScrapper.noOfRecords == 0) { AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Do not put Zero value ]"); AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Default number of records is 100 ]"); TwitterDataScrapper.noOfRecords = 100; } } else { AddToScrapeLogs("[ " + DateTime.Now + " ] => [ please enter value in number of users ]"); return; } })); AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Scrape by Keyword ]"); //List<TwitterDataScrapper.StructTweetIDs> data = TweetData.GetTweetData(txtScrapeKeyword.Text); //TweetData.logEvents.addToLogger += new EventHandler(DataScraperlogger_addToLogger); TweetData.logEvents.addToLogger += new EventHandler(DataScraperlogger_addToLogger); List<TwitterDataScrapper.StructTweetIDs> data = new List<TwitterDataScrapper.StructTweetIDs>(); foreach (string itemKeyword in lstSearchByKeywords) { if (!chkSearchByKeyWordByPeople.Checked) { data = TweetData.NewKeywordStructDataForSearchByKeyword(itemKeyword.Trim()); data = data.Distinct().ToList(); } else { data = TweetData.NewKeywordStructDataSearchByPeople(itemKeyword.Trim()); } } //TweetData.logEvents.addToLogger -= new EventHandler(DataScraperlogger_addToLogger); TweetData.logEvents.addToLogger -= new EventHandler(DataScraperlogger_addToLogger); data = DistinctDataList(data); if (!(data.Count() > 0)) { //AddToScrapeLogs("Request Not Completed"); AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Requesting For 100 User ids ]"); data = TweetData.NewKeywordStructData(txtScrapeKeyword.Text); } // AddToScrapeLogs("[ " + DateTime.Now + " ] => [ " + data.Count + " User ids Scraped ]"); AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Please Wait Till Data Is Retrieving ]"); #region commentedRegion //if (!chkSearchByKeyWordByPeople.Checked) //{ // if (!File.Exists(Globals.Path_KeywordScrapedListData + "-" + txtScrapeKeyword.Text + ".csv")) // { // GlobusFileHelper.AppendStringToTextfileNewLine("USERID , USERNAME , PROFILE NAME , BIO , LOCATION , WEBSITE , NO OF TWEETS , FOLLOWERS , FOLLOWINGS", Globals.Path_KeywordScrapedListData + "-" + txtScrapeKeyword.Text + ".csv"); // } // foreach (TwitterDataScrapper.StructTweetIDs item in data) // { // 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; // ChilkatHttpHelpr objChilkat = new ChilkatHttpHelpr(); // GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); // string ProfilePageSource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + item.username__Tweet_User), "", ""); // 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 // int counterdata = 0; // xBeginSearchAfter = null; // string dataDescription = string.Empty; // //xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "profile-field"); // xNode = xml.SearchForAttribute(xBeginSearchAfter, "h1", "class", "ProfileHeaderCard-name"); // while ((xNode != null)) // { // xBeginSearchAfter = xNode; // if (counterdata == 0) // { // ProfileName = xNode.AccumulateTagContent("text", "script|style"); // counterdata++; // } // else if (counterdata == 1) // { // website = xNode.AccumulateTagContent("text", "script|style"); // if (website.Contains("Twitter Status")) // { // website = "N/A"; // } // 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, "p", "class", "ProfileHeaderCard-bio u-dir");//bio profile-field"); // while ((xNode != null)) // { // xBeginSearchAfter = xNode; // Bio = xNode.AccumulateTagContent("text", "script|style").Replace("'", "'").Replace(" ", 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; // } // int counterData = 0; // 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(item.username__Tweet_User) && item.ID_Tweet_User != "null") // { // string Id_user = item.ID_Tweet_User.Replace("}]", string.Empty).Trim(); // Globals.lstScrapedUserIDs.Add(Id_user); // GlobusFileHelper.AppendStringToTextfileNewLine(Id_user + "," + item.username__Tweet_User + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location.Replace(",", "") + "," + website + "," + NoOfTweets.Replace(",", "").Replace("Tweets", "") + "," + Followers.Replace(",", "").Replace("Following", "") + "," + Followings.Replace(",", "").Replace("Followers", "").Replace("Follower", ""), Globals.Path_KeywordScrapedListData + "-" + txtScrapeKeyword.Text + ".csv"); // AddToScrapeLogs("[ " + DateTime.Now + " ] => [ " + Id_user + "," + item.username__Tweet_User + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location + "," + website + "," + NoOfTweets + "," + Followers + "," + Followings + " ]"); // } // } //} #endregion //AddToScrapeLogs("Retrieving data"); AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Adding Data To DataBase ]"); Globals.lstScrapedUserIDs = Globals.lstScrapedUserIDs.Distinct().ToList(); thread_AddingKeywordScrape = new Thread(() => { foreach (TwitterDataScrapper.StructTweetIDs item in data) { if (!string.IsNullOrEmpty(item.username__Tweet_User) && item.ID_Tweet_User != "null") { //AddToScrapeLogs(item.ID_Tweet_User); clsDBQueryManager DataBase = new clsDBQueryManager(); DataBase.InsertOrUpdateScrapeSetting(item.ID_Tweet_User, item.username__Tweet_User, item.ID_Tweet); } } AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Exported location :- " + Globals.Path_KeywordScrapedList + " ]"); AddToScrapeLogs("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); AddToScrapeLogs("------------------------------------------------------------------------------------------------------------------------------------------"); }); thread_AddingKeywordScrape.Start(); if (Globals.IsDirectedFromFollower) { Thread.Sleep(1000); Globals.IsDirectedFromFollower = false; AddToLog_Follower("[ " + DateTime.Now + " ] => [ " + data.Count + " User ids Scraped and Added To Follow List ]"); Tb_AccountManager.Invoke(new MethodInvoker(delegate { Tb_AccountManager.SelectedIndex = 2; })); //tabMain.SelectedIndex = 2; } } catch (Exception ex) { Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ScrapeKeywordSeacrh() --> " + ex.Message, Globals.Path_ScrapeUsersErroLog); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ScrapeKeywordSeacrh() --> " + ex.Message, Globals.Path_TwtErrorLogs); } }
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); } }
public void btn_FollowByKeyWordStart_Click(object sender, EventArgs e) { CheckNetConn = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable(); if (CheckNetConn) { if (!string.IsNullOrEmpty(txt_FollowBySearchKey.Text)) { objclsSettingDB.InsertOrUpdateSetting("Follower", "FollowBySearchKey", StringEncoderDecoder.Encode(txt_FollowBySearchKey.Text)); } if (IsFollowByKeyWordStart) { IsFollowByKeyWordStart = false; // new Thread(() => // { Dic_Thread.Clear(); Thread.CurrentThread.Name = "Thread_FollowByKeyword"; Dic_Thread.Add(Thread.CurrentThread.Name, Thread.CurrentThread); //TweetAccountManager TweetAccountManager = new TweetAccountManager(); //TwitterDataScrapper TwitterDataScrapper = new TwitterDataScrapper(); //int FollowLimitCounter = 0; //int AccountCounter = 0; FollowtweetKeywordList.ForEach(i => { searchkeywordqueue.Enqueue(i); }); int NoOfThreads = int.Parse(txtNoOfFollowThreads.Text); int DelayStart = 0; int DelayEnd = 0; bool _IsValue = false; _IsValue = int.TryParse((txtFollowMinDelay.Text), out DelayStart); if (!_IsValue) { IsFollowByKeyWordStart = true; return; } _IsValue = false; _IsValue = int.TryParse((txtFollowMaxDelay.Text), out DelayEnd); if (!_IsValue) { IsFollowByKeyWordStart = true; return; } string SeachKey = string.Empty; List<TwitterDataScrapper.StructTweetIDs> KeywordStructData = new List<TwitterDataScrapper.StructTweetIDs>(); TwitterDataScrapper TwitterDataScrapper = new TwitterDataScrapper(); if (FollowtweetKeywordList.Count != 0) { //TwitterDataScrapper.noOfRecords = int.Parse(txt_FollowByPerAccount.Text); txt_FollowByPerAccount.Invoke(new MethodInvoker(delegate { if (!string.IsNullOrEmpty(txt_FollowByPerAccount.Text)) { TwitterDataScrapper.noOfRecords = int.Parse(txt_FollowByPerAccount.Text); } else { TwitterDataScrapper.noOfRecords = 5; } })); if (!chk_followbysinglekeywordperaccount.Checked) { try { if (searchkeywordqueue.Count == 0) { return; } SeachKey = searchkeywordqueue.Dequeue().ToString();//FollowtweetKeywordList[counterThreadsFollowByKeyWord]; AddToLog_Follower("[ " + DateTime.Now + " ] => [ Start Scraping User for keyword= " + SeachKey + " ]"); 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) { AddToLog_Follower("[ " + DateTime.Now + " ] => [ Start Scraping User for keyword= " + SeachKey_item + " . ]"); 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 == TwitterDataScrapper.noOfRecords) { break; } else { KeywordStructData.Add(KeywordStructData1_item); datacounter++; } } } } } else { MessageBox.Show("Please Upload Keywords"); //break; } List<List<TwitterDataScrapper.StructTweetIDs>> list_lstTargetUsers = new List<List<TwitterDataScrapper.StructTweetIDs>>(); int index = 0; if (chkUseDivide.Checked || IsUsingDivideData) { int splitNo = 0; if (rdBtnDivideEqually.Checked) { splitNo = KeywordStructData.Count / TweetAccountContainer.dictionary_TweetAccount.Count; } else if (rdBtnDivideByGivenNo.Checked) { if (!string.IsNullOrEmpty(txtScrapeNoOfUsers.Text) && NumberHelper.ValidateNumber(txtScrapeNoOfUsers.Text)) { int res = Convert.ToInt32(txtScrapeNoOfUsers.Text); splitNo = res;//listUserIDs.Count / res; } } if (splitNo == 0) { splitNo = RandomNumberGenerator.GenerateRandom(0, KeywordStructData.Count - 1); } list_lstTargetUsers = Split(KeywordStructData, splitNo); } if (TweetAccountContainer.dictionary_TweetAccount.Count > 0) { NoOfLoadAccount = TweetAccountContainer.dictionary_TweetAccount.Count; try { double Num; bool isNum = double.TryParse((txt_FollowByPerAccount.Text.Trim()), out Num); if (isNum) { AddToLog_Follower("[ " + DateTime.Now + " ] => [ Start process from follow by search keyword. ]"); ThreadPool.SetMaxThreads(NoOfThreads, 5); foreach (KeyValuePair<string, TweetAccountManager> item in TweetAccountContainer.dictionary_TweetAccount) { #region << Old Code >> //string profileUsername = string.Empty; //string profileUserpass = string.Empty; //profileUsername = item.Key; //profileUserpass = item.Value.Password; ////******search profile By keyWords //string SeachKey = string.Empty; //List<TwitterDataScrapper.StructTweetIDs> KeywordStructData = new List<TwitterDataScrapper.StructTweetIDs>(); //if (FollowtweetKeywordList.Count != 0) //{ // if (!chk_followbysinglekeywordperaccount.Checked) // { // try // { // SeachKey = FollowtweetKeywordList[AccountCounter]; // KeywordStructData = TwitterDataScrapper.GetTweetData_New(SeachKey); // if (KeywordStructData.Count == 0) // { // KeywordStructData = TwitterDataScrapper.NewKeywordStructData(SeachKey); // } // } // catch (Exception) // { // } // } // else // { // foreach (string SeachKey_item in FollowtweetKeywordList) // { // List<TwitterDataScrapper.StructTweetIDs> KeywordStructData1 = new List<TwitterDataScrapper.StructTweetIDs>(); // int datacounter = 0; // KeywordStructData1 = TwitterDataScrapper.NewKeywordStructData(SeachKey_item); // if (KeywordStructData1.Count == 0) // { // KeywordStructData1 = TwitterDataScrapper.KeywordStructData(SeachKey_item); // } // if (KeywordStructData1.Count == 0) // { // AddToLog_Follower("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; //} ////************* //try //{ // if (KeywordStructData.Count > 0) // { // TweetAccountManager AccountManager = (TweetAccountManager)item.Value; // AccountManager.logEvents.addToLogger += new EventHandler(logEvents_Follower_addToLogger); // int DelayStart = 0; // int DelayEnd = 0; // bool _IsValue = false; // _IsValue = int.TryParse((txtFollowMinDelay.Text), out DelayStart); // if (!_IsValue) // { // return; // } // _IsValue = false; // _IsValue = int.TryParse((txtFollowMaxDelay.Text), out DelayEnd); // if (!_IsValue) // { // return; // } // if (!AccountManager.IsLoggedIn) // { // AccountManager.Login(); // } // 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; // ///Return if Suspended // if (AccountManager.AccountStatus == "Account Suspended") // { // AddToLog_Follower(profileUsername + " : Suspended"); // break; // } // else if ((AccountManager.globusHttpHelper.gResponse.ResponseUri.ToString().ToLower()).Contains("captcha")) // { // AddToLog_Follower(profileUsername + " : Asking for captcha."); // break; // } // getFollowUserBySearch(new object[] { AccountManager, AccountId }); // int Delay = RandomNumberGenerator.GenerateRandom(DelayStart, DelayEnd); // AddToLog_Follower("Delay :- " + Delay + " Seconds."); // Thread.Sleep(Delay); // } // } // else // { // //Message List is Empty // AddToLog_Follower("Key Word File is Empty or Wrong Formate"); // break; // } //} //catch (Exception) //{ //} //if (AccountCounter > TweetAccountContainer.dictionary_TweetAccount.Count) //{ // AccountCounter = 0; //} //else //{ // AccountCounter++; //} #endregion if (counterThreadsFollowByKeyWord >= NoOfThreads) { lock (lockerThreadsFollowByKeyWord) { Monitor.Wait(lockerThreadsFollowByKeyWord); } } if (chkUseDivide.Checked || IsUsingDivideData) { KeywordStructData = list_lstTargetUsers[index]; } //ThreadPool.QueueUserWorkItem(new WaitCallback(StartFollowByKeyWord), new object[] { item, DelayStart, DelayEnd }); Thread threadGetStartProcessForfollow = new Thread(StartFollowByKeyWord); threadGetStartProcessForfollow.Name = "Thread_FollowByKeyword" + "_" + item.Key; threadGetStartProcessForfollow.IsBackground = true; threadGetStartProcessForfollow.Start(new object[] { item, DelayStart, DelayEnd, KeywordStructData }); index++; Thread.Sleep(1000); } }//isNum If End else { MessageBox.Show("Please enter No of follow By per account"); AddToLog_Follower("[ " + DateTime.Now + " ] => [ Please enter No of follow By per account ]"); } } catch (Exception) { } finally { //if (FollowtweetKeywordList.Count == 0) //{ // AddToLog_Follower("Please Upload Keywords"); //} //else //{ // AddToLog_Follower("Follow By key Word Process is Finished."); //} } } else { MessageBox.Show("Please Upload Twitter Account"); AddToLog_Follower("[ " + DateTime.Now + " ] => [ Please Upload Twitter Account ]"); } IsFollowByKeyWordStart = true; // }).Start(); } } else { MessageBox.Show("Your Internet Connection is disabled ! or not working, Please Check Your Internet Connection..."); AddToLog_Follower("[ " + DateTime.Now + " ] => [ Your Internet Connection is disabled ! or not working, Please Check Your Internet Connection... ]"); } }