public string RegisterUser(string Username, string Password, string cpuID, string TransactionID, string Email, string servr) { GlobusHttpHelper HttpHelpr = new GlobusHttpHelper(); string res = string.Empty; string url = string.Empty; //getHtmlfromUrl(new Uri(Photolink), "",""); url = "http://" + servr + "/register.php?user="******"&pass="******"&cpid=" + cpuID + "&transid=" + TransactionID + "&email=" + Email + "&LicType=" + Globals.licType + " "; try { res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", ""); //res = HttpHelpr.GetHtml(url); if (string.IsNullOrEmpty(res)) { System.Threading.Thread.Sleep(1000); res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", ""); //res = HttpHelpr.GetHtml(url); } if (string.IsNullOrEmpty(res)) { Gtk.Application.Quit(); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt"); } return(res); }
public void CheckLDAccount(string item) { GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); try { LinkedinLogin Login = new LinkedinLogin(); _Email = item; string account = item; string[] AccArr = account.Split(':'); if (AccArr.Count() > 1) { Login.accountUser = account.Split(':')[0]; Login.accountPass = account.Split(':')[1]; //Username = account.Split(':')[0]; //Password = account.Split(':')[1]; int DataCount = account.Split(':').Length; if (DataCount == 4) { Login.proxyAddress = account.Split(':')[2]; Login.proxyPort = account.Split(':')[3]; //proxyAddress = account.Split(':')[2]; //proxyPort = account.Split(':')[3]; } else if (DataCount == 6) { Login.proxyAddress = account.Split(':')[2]; Login.proxyPort = account.Split(':')[3]; Login.proxyUserName = account.Split(':')[4]; Login.proxyPassword = account.Split(':')[5]; //proxyAddress = account.Split(':')[2]; //proxyPort = account.Split(':')[3]; //proxyUserName = account.Split(':')[4]; //proxyPassword = account.Split(':')[5]; } } Login.logger.addToLogger += new EventHandler(logger_addToLogger); Login.LoginHttpHelper_Checker(ref objGlobusHttpHelper); } catch { } finally { Counter++; if (CheckAccount.TotalEmails <= Counter) { AddToListBox("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED For Account Checking ]"); AddToListBox("------------------------------------------------------------------------------------------------------------------------------------"); } } }
protected override string GetPostData() { GlobusHttpHelper httphelper = new GlobusHttpHelper(); string yahoopge = httphelper.getHtmlfromUrl(new Uri("https://login.yahoo.com/config/login?.done=http://answers.yahoo.com%2findex&.src=knowsrch&.intl=us")); string splitstring = ((yahoopge.Substring(yahoopge.IndexOf("onsubmit=") + 30, yahoopge.IndexOf("form: login information") - (yahoopge.IndexOf("onsubmit=") + 60))).Replace("\n", "").Replace("\t", "").Replace("<input type=\"hidden\" name=", "&").Replace(">", "").Replace("value", "").Replace("\"", "") + "&login="******"manish_patel226" + "&passwd=" + "man_007" + "&.save=Sign+In").Replace(" ", "").Replace("index", ""); splitstring = splitstring.Substring(1, splitstring.Length - 1).Replace(":", "%3A").Replace("/", "%2F").Replace("knowsrch_ver=0&c=&ivt=&sg=", "knowsrch_ver%3D0%26c%3D%26ivt%3D%26sg%3D"); return(splitstring); }
public bool HotmailWithoutReference(string Email, string Password) { GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); bool activate = false; Chilkat.Http http = new Chilkat.Http(); #region Hotmail try { if (Email.Contains("@hotmail")) { if (popClient.Connected) { popClient.Disconnect(); } popClient.Connect("pop3.live.com", int.Parse("995"), true); popClient.Authenticate(Email, Password); int Count = popClient.GetMessageCount(); for (int i = Count; i >= 1; i--) { OpenPOP.MIME.Message Message = popClient.GetMessage(i); string subject = string.Empty; subject = Message.Headers.Subject; if (Message.Headers.Subject.Contains("[WordPress] Activate") && Message.Headers.Subject.Contains("wordpress.com")) { foreach (string href in GetUrlsFromStringHotmail(Message.MessageBody[0])) { try { string staticUrl = string.Empty; staticUrl = href; string res = HttpHelper.getHtmlfromUrl(new Uri(staticUrl), "", ""); responce = http.QuickGetStr(staticUrl); if (responce.Contains("Your account is now active")) { Log("[ " + DateTime.Now + " ] => [ Account activated ]"); activate = true; } } catch (Exception ex) { } } } } } } catch { }; #endregion return(activate); }
public void withDrawConnection(ref GlobusHttpHelper HttpHelper, Dictionary <string, string> SlectedContacts, string UserName) { try { string csrfToken = string.Empty; string sourceAlias = string.Empty; string referer = "https://www.linkedin.com/people/invites?trk=connect_hub_manage_invitations_sent"; string actionUrl = "https://www.linkedin.com/people/invites/withdraw?isInvite=true"; string postData = string.Empty; string url = "https://www.linkedin.com/people/invites?trk=connect_hub_manage_invitations_sent"; string src = HttpHelper.getHtmlfromUrl(new Uri(url)); if (src.Contains("csrfToken=")) { try { csrfToken = Utils.getBetween(src, "csrfToken=", "\""); if (csrfToken.Contains("%3A")) { csrfToken = csrfToken.Replace("%3A", ":"); } } catch { } } if (src.Contains("sourceAlias")) { try { sourceAlias = Utils.getBetween(src, "sourceAlias", "}"); sourceAlias = Utils.getBetween(sourceAlias, "value\":\"", "\""); if (sourceAlias.Contains("\\u002d")) { sourceAlias = sourceAlias.Replace("\u002d", "-"); } } catch { } } foreach (KeyValuePair <string, string> item in SlectedContacts) { string invitationId = item.Value.Split(':')[1]; postData = "csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "&Ids=" + invitationId; string responce = HttpHelper.postDataFormessagePosting(new Uri(actionUrl), postData, referer); if (responce.Contains("status\":\"ok\"")) { //AddLoggerManageConnection(""); } } } catch { } }
private void CheckVersion() { try { thisVersionNumber = GetAssemblyVersion(); string textFileLocationOnServer = "http://licensing.facedominator.com/licensing/ID/IDCheckVer/IDLatestVersion.txt"; GlobusHttpHelper httpHelper = new GlobusHttpHelper(); string textFileData = httpHelper.getHtmlfromUrl(new Uri(textFileLocationOnServer)); string verstatus = string.Empty; if (Globals.IsProVersion) { verstatus = "Fdpro Version"; } if (Globals.IsBasicVersion) { verstatus = "Fdbasic Version"; } else if (Globals.IsProVersion && Globals.IsBasicVersion) { verstatus = Globals.Licence_Details.Split('&')[1]; } string latestVersion = Regex.Split(textFileData, "<:>")[0]; string updateVersionPath = Regex.Split(textFileData, "<:>")[1]; if (thisVersionNumber == latestVersion) { this.Dispatcher.Invoke(new Action(delegate { ModernDialog.ShowMessage("You have the Updated Version", "Information", btnMessage); })); } else { this.Dispatcher.Invoke(new Action(delegate { var check = ModernDialog.ShowMessage("An Updated Version Available - Do you Want to Upgrade!", "Update Available", btnUsed); if (check.ToString().Equals("Yes")) { System.Diagnostics.Process.Start("iexplore", updateVersionPath); this.Dispatcher.Invoke(new Action(delegate { this.Close(); })); } })); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
//public bool LoginHttpHelper(string username, string password, string proxyaddress, string proxyport, string proxyusername, string proxypassword, ref GlobusHttpHelper HttpHelper, ref string Message) //{ // LoggerLoginLogout("Logging Block............."); // string Url = string.Empty; // int port = 888; // Regex PortCheck = new Regex("^[0-9]*$"); // _AccountUser = username; // _AccountPass = password; // _ProxyAddress = proxyaddress; // _ProxyPort = proxyport; // _ProxyUserName = proxyusername; // _ProxyPassword = proxypassword; // if (PortCheck.IsMatch(_ProxyPort) && !string.IsNullOrEmpty(_ProxyPort)) // { // port = int.Parse(_ProxyPort); // } // Url = "https://www.linkedin.com/"; // ////string pageSrcLogin = HttpChilkat.GetHtmlProxy(Url, proxyAddress, proxyPort, proxyUserName, proxyPassword); // string pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, port, _ProxyUserName, _ProxyPassword); // string postdata = string.Empty; // string postUrl = string.Empty; // string ResLogin = string.Empty; // string csrfToken = string.Empty; // string sourceAlias = string.Empty; // if (pageSrcLogin.Contains("csrfToken")) // { // csrfToken = pageSrcLogin.Substring(pageSrcLogin.IndexOf("csrfToken"), 100); // string[] Arr = csrfToken.Split('"'); // csrfToken = Arr[2]; // } // if (pageSrcLogin.Contains("sourceAlias")) // { // sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100); // string[] Arr = sourceAlias.Split('"'); // sourceAlias = Arr[2]; // } // //_AccountUser = "******"; // //_AccountPass = "******"; // _AccountUser = _AccountUser.Replace("@", "%40"); // postUrl = "https://www.linkedin.com/uas/login-submit"; // postdata = "session_key=" + _AccountUser + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; // ResLogin = HttpHelper.postFormData(new Uri(postUrl), postdata); // if (ResLogin.Contains("The email address or password you provided does not match our records")) // { // //Message = "The email address or password does not match our records"; // //return false; // } // else if (ResLogin.Contains("Sign Out") && ResLogin.Contains("Profiles")) // { // Message = "Logged in"; // return true; // } // else if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted")) // { // Message = "Your LinkedIn account has been temporarily restricted"; // return false; // } // Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; // pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyPassword, port, _ProxyUserName, _ProxyPassword); // //LogoutHttpHelper(ref HttpHelper); // //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; // //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyPassword, 888, _ProxyUserName, _ProxyPassword); // return true; //} public void LogoutHttpHelper(ref GlobusHttpHelper HttpHelper) { string Url = string.Empty; Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; ////string pageSrcLogin = HttpChilkat.GetHtmlProxy(Url, proxyAddress, proxyPort, proxyUserName, proxyPassword); string pageSrcHome = HttpHelper.getHtmlfromUrl1(new Uri(Url)); Url = "https://www.linkedin.com/secure/login?session_full_logout=&trk=hb_signout"; string pageSrcLogout = HttpHelper.getHtmlfromUrl1(new Uri(Url)); }
public void AddProfilePicture(ref GlobusHttpHelper GlobusHttpHelper, string Email, string Password, string proxyAddress, int ProxyPort, string proxyUsername, string proxyPassword) { try { IsCloseCalledForProfileManager = false; lstThreadForLinkedInProfileManager.Clear(); if (CampainGroupCreate.lstProfilePic.Count < 1) { MessageBox.Show("Please Upload Profile Image !"); AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Please Upload Profile Image ! ]"); //return; } if (rdbUnique.Checked) { try { LinkedinProfileImgUploader.AddProfilePic_Unique = true; } catch { } } else { try { LinkedinProfileImgUploader.AddProfilePic_Random = true; } catch { } } LinkedinProfileImgUploader obj_LinkedinProfileManager = new LinkedinProfileImgUploader(Email, Password, proxyAddress, ProxyPort.ToString(), proxyUsername, proxyPassword); obj_LinkedinProfileManager.LinkedInProfileManagerLogEvents.addToLogger += new EventHandler(logger_LinkedInProfileManageraddToLogger); obj_LinkedinProfileManager.SetProfilePic(ref GlobusHttpHelper); //if (NumberHelper.ValidateNumber(txtThreads.Text)) //{ // threads = int.Parse(txtThreads.Text); //} //Thread thread_AddaCover = new Thread(thread_AddaCoverStart); //thread_AddaCover.Start(); //thread_AddaCoverStart(); } catch { } }
public void SearchConnection(ref GlobusHttpHelper GlobusHttpHelper, string Email, string Password, string proxyAddress, int ProxyPort, string proxyUsername, string proxyPassword) { try { Campaign_lstSearchconnectionThread.Clear(); int SearchMinDelay = 0; int SearchMaxDelay = 0; bool DelayReset = true; if (chkUniqueConnectin.Checked) { ManageConnections.ConnectUsing_Search.UseuniqueConn = true; foreach (string itemKeyword in CampainGroupCreate.Campaign_lstConnectionSearchKeyword) { try { ManageConnections.ConnectUsing_Search.lstQueuKeywords.Enqueue(itemKeyword); } catch { } } } if (CampainGroupCreate.Campaign_lstConnectionSearchKeyword.Count == 0) { MessageBox.Show("Please Add Keywords!"); AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Please Add Keywords! ]"); return; } else { Queue <string> que_SearchKeywords = new Queue <string>(); foreach (string itemKeyword in CampainGroupCreate.Campaign_lstConnectionSearchKeyword) { que_SearchKeywords.Enqueue(itemKeyword); } LinkedInMaster LinkedIn_Master = new LinkedInMaster(); ManageConnections.ConnectUsing_Search ConnectUsing_Search = new ConnectUsing_Search(Email, Password, proxyAddress, ProxyPort.ToString(), proxyUsername, proxyPassword, que_SearchKeywords); ManageConnections.ConnectUsing_Search.ConnectSearchUsingkeyword(ref ConnectUsing_Search, SearchMinDelay, SearchMaxDelay); //ConnectUsing_Search.ConnectionSearch(); //ConnectUsingSearch obj_ConnectUsingSearch = new ConnectUsingSearch(Email, Password, proxyAddress, ProxyPort.ToString(), proxyUsername, proxyPassword); //obj_ConnectUsingSearch.ConnectionSearch(); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Connection --> btnSearchConnection_Click() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Connection --> btnSearchConnection_Click() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddConnectionErrorLogs); } }
public static void ParsePAge(string url) { var gcc = new GlobusHttpHelper(); var html = gcc.getHtmlfromUrl(new Uri(url)); html = File.ReadAllText("F:/Matrix.html"); var hd = new HtmlAgilityPack.HtmlDocument(); hd.LoadHtml(html); var hn = hd.DocumentNode.SelectNodes("//*"); }
public bool ActivateAccount(string Email, string Password, ref GlobusHttpHelper globusHelper) { EmailActivator.ClsEmailActivator EmailActivate = new EmailActivator.ClsEmailActivator(); bool verified = EmailActivate.EmailVerification(Email.Replace(" ", ""), Password, ref globusHelper); if (verified) { return verified; } else { return verified; } }
public string GetProfileId(ref GlobusHttpHelper httpHelper, string loggedInPageSource) { string profileId = string.Empty; try { //profileId = httpHelper.GetUniqueKeyBasedValue(loggedInPageSource, "user_id:"); profileId = httpHelper.GetUniqueKeyBasedValue(loggedInPageSource, "<li class=\"nav-item account-settings-tab\">"); } catch { } return(profileId); }
public bool ActivateAccount(string Email, string Password, ref GlobusHttpHelper globusHelper) { EmailActivator.ClsEmailActivator EmailActivate = new EmailActivator.ClsEmailActivator(); bool verified = EmailActivate.EmailVerification(Email.Replace(" ", ""), Password, ref globusHelper); if (verified) { return(verified); } else { return(verified); } }
//public void ScraperHasTage(ref FacebookUser fbUser, string Hash, Guid BoardfbPageId) //{ // GlobusHttpHelper HttpHelper = fbUser.globusHttpHelper; // string KeyWord = Hash; // string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/hashtag/" + KeyWord)); // List<string> pageSouceSplit = new List<string>(); // string[] trendingArr = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "li data-topicid="); // string[] PagesLink = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "uiLikePageButton"); // foreach (var item in PagesLink) // { // pageSouceSplit.Add(item); // } // PagesLink = PagesLink.Skip(1).ToArray(); // foreach (var item_pageSouceSplit in pageSouceSplit) // { // try // { // if (item_pageSouceSplit.Contains("<!DOCTYPE html>")) // { // continue; // } // Dictionary<string, string> listContent = ScrapHasTagPages(item_pageSouceSplit); // Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds(); // fbfeed.Id = Guid.NewGuid(); // fbfeed.Isvisible = true; // fbfeed.Message = listContent["Message"]; // fbfeed.Image = listContent["PostImage"]; // fbfeed.Description = listContent["Title"]; // string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at"); // string d = splitdate[0].Trim(); // string t = splitdate[1].Trim(); // fbfeed.Createddate = Convert.ToDateTime(d + " " + t); // fbfeed.Feedid = listContent["PostId"]; // fbfeed.Type = listContent["Type"]; // fbfeed.Type = listContent["Link"]; // fbfeed.Fbpageprofileid = BoardfbPageId; // if (!boardrepo.checkFacebookFeedExists(fbfeed.Feedid, BoardfbPageId)) // { // boardrepo.addBoardFbPageFeed(fbfeed); // } // // Please Write Code get Dictionary data // // // } // catch { }; // } // try // { // string ajaxpipe_token = Utils.getBetween(pageSource_Home, "\"ajaxpipe_token\":\"", "\""); // string[] data_c = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "data-cursor="); // string cursor = Utils.getBetween(data_c[4], "\"", "="); // if (cursor.Contains("data-dedupekey")) // { // cursor = "-" + cursor; // cursor = Utils.getBetween(cursor, "-", "\""); // } // string sectionid = Utils.getBetween(pageSource_Home, "section_id\\\":", ","); // string userid = Utils.getBetween(pageSource_Home, "USER_ID\":\"", "\""); // string feed_Id = "90842368"; // string pager_id = "u_ps_0_0_1n"; // for (int i = 2; i < 50; i++) // { // try // { // Thread.Sleep(30 * 1000); // List<string> pageSouceSplitPagination = new List<string>(); // if (string.IsNullOrEmpty(fbUser.username)) // { // break; // } // //GlobusLogHelper.log.Info("Please wait... Searching for data from Page :" + i + " with User Name : " + fbUser.username); // string req = "https://www.facebook.com/ajax/pagelet/generic.php/LitestandMoreStoriesPagelet?ajaxpipe=1&ajaxpipe_token=" + ajaxpipe_token + "&no_script_path=1&data=%7B%22cursor%22%3A%22" + cursor + "%22%2C%22preload_next_cursor%22%3Anull%2C%22pager_config%22%3A%22%7B%5C%22edge%5C%22%3Anull%2C%5C%22source_id%5C%22%3Anull%2C%5C%22section_id%5C%22%3A" + sectionid + "%2C%5C%22pause_at%5C%22%3Anull%2C%5C%22stream_id%5C%22%3Anull%2C%5C%22section_type%5C%22%3A1%2C%5C%22sizes%5C%22%3Anull%2C%5C%22most_recent%5C%22%3Afalse%2C%5C%22unread_session%5C%22%3Afalse%2C%5C%22continue_top_news_feed%5C%22%3Afalse%2C%5C%22ranking_model%5C%22%3Anull%2C%5C%22unread_only%5C%22%3Afalse%7D%22%2C%22pager_id%22%3A%22" + pager_id + "%22%2C%22scroll_count%22%3A1%2C%22start_unread_session%22%3Afalse%2C%22start_continue_top_news_feed%22%3Afalse%2C%22feed_stream_id%22%3A" + feed_Id + "%2C%22snapshot_time%22%3Anull%7D&__user="******"&__a=1&__dyn=7nm8RW8BgCBynzpQ9UoHaEWCueyrhEK49oKiWFaaBGeqrYw8popyujhElx2ubhHximmey8szoyfwgo&__req=jsonp_2&__rev=1583304&__adt=" + i + ""; // // string respReq = HttpHelper.getHtmlfromUrl(new Uri(req)); // respReq = respReq.Replace("\\", "").Replace("u003C", "<"); // string[] arrrespReq = System.Text.RegularExpressions.Regex.Split(respReq, "source_id"); // feed_Id = Utils.getBetween(respReq, "feed_stream_id", "snapshot_time"); // feed_Id = Utils.getBetween(feed_Id, "A", "u"); // string[] pager_id1 = System.Text.RegularExpressions.Regex.Split(respReq, "_4-u2 mbl "); // pager_id = Utils.getBetween(pager_id1[2], "id=\"", "\""); // data_c = System.Text.RegularExpressions.Regex.Split(respReq, "data-cursor="); // if (data_c.Length < 8) // { // cursor = Utils.getBetween(data_c[data_c.Length - 1], "\"", "="); // } // cursor = Utils.getBetween(data_c[8], "\"", "="); // if (cursor.Contains("data-dedupekey")) // { // cursor = "-" + cursor; // cursor = Utils.getBetween(cursor, "-", "\""); // } // string[] PagesLinkPagination = System.Text.RegularExpressions.Regex.Split(respReq, "<span>Suggested Post</span>"); // foreach (var item in PagesLinkPagination) // { // pageSouceSplitPagination.Add(item); // } // PagesLink = System.Text.RegularExpressions.Regex.Split(respReq, "uiLikePageButton"); // foreach (var item in PagesLink) // { // pageSouceSplitPagination.Add(item); // } // foreach (var item_pageSouceSplit in pageSouceSplit) // { // try // { // if (item_pageSouceSplit.Contains("<!DOCTYPE html>")) // { // continue; // } // Dictionary<string, string> listContent = ScrapHasTagPages(item_pageSouceSplit); // Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds(); // fbfeed.Id = Guid.NewGuid(); // fbfeed.Isvisible = true; // fbfeed.Message = listContent["Message"]; // fbfeed.Image = listContent["PostImage"]; // fbfeed.Description = listContent["Title"]; // string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at"); // string d = splitdate[0].Trim(); // string t = splitdate[1].Trim(); // fbfeed.Createddate = Convert.ToDateTime(d + " " + t); // fbfeed.Feedid = listContent["PostId"]; // fbfeed.Type = listContent["Type"]; // fbfeed.Type = listContent["Link"]; // fbfeed.Fbpageprofileid = BoardfbPageId; // if (!boardrepo.checkFacebookFeedExists(fbfeed.Feedid, BoardfbPageId)) // { // boardrepo.addBoardFbPageFeed(fbfeed); // } // // Please Write Code get Dictionary data // // // } // catch { }; // } // } // catch (Exception ex) // { //GlobusLogHelper.log.Error(ex.StackTrace); // } // } // } // catch // { } //} //public Dictionary<string, string> ScrapHasTagPages(string Value) //{ // string redirectionHref = string.Empty; // string title = string.Empty; // List<string[]> Likedata = new List<string[]>(); // Dictionary<string, string> HasTagData = new Dictionary<string, string>(); // // foreach (var Value in Likepages) // { // try // { // redirectionHref = Utils.getBetween(Value, "href=\"", "\""); // string profileUrl = redirectionHref;//1 // if (redirectionHref.Contains("https://www.facebook.com")) // { // string[] Arr_Title = System.Text.RegularExpressions.Regex.Split(Value, "<span class=\"fwb fcg\""); // foreach (var valuetitle in Arr_Title) // { // try // { // // title = Utils.getBetween(valuetitle, "<a", "/a>"); // title = Utils.getBetween(valuetitle, "\">", "/a>"); // if (!title.Equals(string.Empty)) // { // title = Utils.getBetween(title, "\">", "<"); // if (!string.IsNullOrEmpty(title)) // { // break; // } // } // } // catch (Exception) // { // } // } // string profileName = title;//2 // string Message = Utils.getBetween(Value, "<p>", "<").Replace("@", "@").Replace("&", "&").Replace("u0025", "%");//7 // string[] timeDetails = Regex.Split(Value, "<abbr"); // string postedTime = string.Empty; // try // { // postedTime = Utils.getBetween(timeDetails[1], "=\"", "\""); // } // catch { }; // string postid = string.Empty; // try // { // postid = Utils.getBetween(timeDetails[0], "fbid=", "&"); // if (postid == "") // { // postid = Utils.getBetween(timeDetails[0], "/posts/", "\" target="); // } // } // catch // { // } // string[] DetailedInfo = System.Text.RegularExpressions.Regex.Split(Value, "<div class=\"_6m7\">"); // string detail = string.Empty; // try // { // detail = "-" + DetailedInfo[1];//8 // detail = Utils.getBetween(detail, "-", "</div>").Replace("&", "&").Replace("u0025", "%"); // if (detail.Contains("<a ")) // { // string GetVisitUrl = Utils.getBetween(detail, "\">", "</a>"); // detail = Utils.getBetween("$$$####" + detail, "$$$####", "<a href=") + "-" + GetVisitUrl; // } // } // catch // { }; // string[] ArrDetail = System.Text.RegularExpressions.Regex.Split(Value, "<div class=\"mbs _6m6\">"); // string Titles = string.Empty; // // string Url = Utils.getBetween(ArrDetail[0], "", ""); // try // { // Titles = Utils.getBetween(ArrDetail[1], ">", "</a>").Replace("@", "@").Replace("&", "&").Replace("u0025", "%");//6 // if (Titles.Contains("Sachin Tendulkar")) // { // } // } // catch { }; // string SiteRedirectionUrl = string.Empty; // try // { // SiteRedirectionUrl = Utils.getBetween(ArrDetail[1], "LinkshimAsyncLink.swap(this, "", ");"); // } // catch { }; // try // { // SiteRedirectionUrl = Uri.UnescapeDataString(SiteRedirectionUrl).Replace("\\u0025", "%").Replace("\\", "");//4 // } // catch { }; // string websiteUrl = string.Empty; // try // { // websiteUrl = Utils.getBetween(SiteRedirectionUrl, "//", "/"); // } // catch { }; // string redirectionImg = string.Empty; // try // { // string[] adImg = System.Text.RegularExpressions.Regex.Split(Value, "<img class=\"scaledImageFitWidth img\""); // redirectionImg = Utils.getBetween(adImg[1], "src=\"", "\"").Replace("&", "&"); // } // catch { }; // string[] profImg = System.Text.RegularExpressions.Regex.Split(Value, "<img class=\"_s0 5xib 5sq7 _rw img\""); // string profileImg = string.Empty; // try // { // profileImg = Utils.getBetween(profImg[0], "src=\"", "\"").Replace("&", "&"); // } // catch { }; // HasTagData.Add("Title", title); // HasTagData.Add("Time", postedTime); // HasTagData.Add("Type", "link"); // HasTagData.Add("Message", Message); // HasTagData.Add("Image", profileImg); // HasTagData.Add("PostImage", redirectionImg); // HasTagData.Add("PostId", postid); // HasTagData.Add("Link", SiteRedirectionUrl); // } // } // catch { }; // } // return HasTagData; //} public static List <Domain.Socioboard.Domain.DiscoverySearch> ScraperHasTage(string Hash) { GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); string KeyWord = Hash; string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/hashtag/" + KeyWord)); List <string> pageSouceSplit = new List <string>(); string[] PagesLink = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "_4-u2 mbm _5jmm _5pat _5v3q _4-u8"); foreach (var item in PagesLink) { pageSouceSplit.Add(item); } PagesLink = PagesLink.Skip(1).ToArray(); List <Domain.Socioboard.Domain.DiscoverySearch> discSearchList = new List <Domain.Socioboard.Domain.DiscoverySearch>(); foreach (var item_pageSouceSplit in pageSouceSplit) { Domain.Socioboard.Domain.DiscoverySearch discSearchObj = new Domain.Socioboard.Domain.DiscoverySearch(); try { if (item_pageSouceSplit.Contains("<!DOCTYPE html>")) { continue; } Dictionary <string, string> listContent = ScrapHasTagPages(item_pageSouceSplit); // Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds(); discSearchObj.Id = Guid.NewGuid(); discSearchObj.Message = listContent["Message"]; //discSearchObj.Image = listContent["PostImage"]; //discSearchObj.Description = listContent["Title"]; string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at"); string d = splitdate[0].Trim(); string t = splitdate[1].Trim(); discSearchObj.CreatedTime = Convert.ToDateTime(d + " " + t); discSearchObj.MessageId = listContent["PostId"]; //discSearchObj.Type = listContent["Type"]; //discSearchObj.Link = listContent["Link"]; discSearchObj.FromId = listContent["FromId"]; discSearchObj.FromName = listContent["FromName"]; //discSearchObj.Fbpageprofileid = BoardfbPageId; discSearchList.Add(discSearchObj); } catch { }; } return(discSearchList); }
public void SetProfilePic(ref GlobusHttpHelper httpHelper) { try { string homePageSource = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com")); string ProfileID = GetProfileId(ref httpHelper, homePageSource); string Url = "http://www.linkedin.com/profile/view?id=" + ProfileID + "&trk=tab_pro"; string ProfilePageSource = httpHelper.getHtmlfromUrl1(new Uri(Url)); if (!string.IsNullOrEmpty(homePageSource)) { try { if (ProfilePageSource.Contains("link__nprofileEdit")) { try { string link__nprofileEdit = httpHelper.GetUniqueKeyBasedValue(ProfilePageSource, "link__nprofileEdit"); } catch { } } if (ProfilePageSource.Contains("link__editPictureInfo")) { try { string link__editPictureInfo = httpHelper.GetUniqueKeyBasedValue(ProfilePageSource, "link__editPictureInfo"); } catch { } } string refere = string.Empty; try { UploadPic(ref httpHelper, ProfilePageSource, refere); } catch { } } catch { } } } catch { } finally { Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); Log("--------------------------------------------------------------------------------------------------------------------------------------------"); } }
public void StartSendInvitations(ref GlobusHttpHelper httpHelper) { try { foreach (var item in LstProfileURL) { Connect(ref httpHelper, item); } } catch (Exception ex) { Console.WriteLine("Error >>> " + ex.StackTrace); } Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED With Username >>> " + _UserName + " ]"); }
private void LoginWithMobileDevice(ref InstagramUser objInstagramUser) { try { string guid = string.Empty; string deviceId = string.Empty; guid = GenerateGuid(); if (!string.IsNullOrEmpty(guid)) { objInstagramUser.guid = guid; } deviceId = "android-" + guid; if (!string.IsNullOrEmpty(deviceId)) { objInstagramUser.deviceid = deviceId; } string Data = "{\"device_id\":\"" + deviceId + "\",\"guid\":\"" + guid + "\",\"username\":\"" + objInstagramUser.username + "\",\"password\":\"" + objInstagramUser.password + "\",\"Content-Type\":\"application/x-www-form-urlencoded; charset=UTF-8\"}"; Data = "{\"device_id\":\"" + deviceId + "\",\"guid\":\"" + guid + "\",\"username\":\"" + objInstagramUser.username + "\",\"password\":\"" + objInstagramUser.password + "\",\"Content-Type\":\"application/x-www-form-urlencoded; charset=UTF-8\"}"; string Sig = GenerateSignature(Data); string Data_HttpUtility = HttpUtility.UrlEncode(Data); string postDataLoginMobile = "signed_body=" + Sig + "." + Data_HttpUtility + "&ig_sig_key_version=6"; string postUrlLogin = "******"; string loginResponse = objInstagramUser.globusHttpHelper.postFormDataFromProxyMobileLogin(new Uri(postUrlLogin), postDataLoginMobile, objInstagramUser.proxyip, int.Parse(objInstagramUser.proxyport), objInstagramUser.proxyusername, objInstagramUser.proxypassword); GlobusHttpHelper objGlobusshttpHelper = new GlobusHttpHelper(); // string resp = objGlobusshttpHelper.postFormDataMobileLogin(new Uri(postUrlLogin), postDataLoginMobile); if (loginResponse.Contains(objInstagramUser.username.ToLower()) && !loginResponse.Contains("lt-ie7 not-logged-in"))//marieturnipseed55614 { GlobusLogHelper.log.Info("[ Logged in with Account Success :" + objInstagramUser.username + " ]"); objInstagramUser.isloggedin = true; objInstagramUser.LogInStatus = "Success"; } else { objInstagramUser.LogInStatus = "Fail"; GlobusLogHelper.log.Info("[ Logged in with Account Fail : " + objInstagramUser.username + " ]"); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error ==> " + ex.Message); } }
public static List <string> GetLatestTrendsFromTwiter() { ILog logger = LogManager.GetLogger(typeof(TwitterScrapeHelper)); List <string> lstOfTrends = new List <string>(); try { GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); string homepageUrl = "https://twitter.com/"; string trendsUrl = "https://twitter.com/i/trends?k=0b49e0976b&pc=true&personalized=false&show_context=true&src=module&woeid=23424977"; string homePageResponse = objGlobusHttpHelper.getHtmlfromUrl(new Uri(trendsUrl), "", ""); try { string[] GetTrends = Regex.Split(homePageResponse, "data-trend-name="); GetTrends = GetTrends.Skip(1).ToArray(); foreach (string item in GetTrends) { try { string trend = Utils.getBetween(item, "\"", "\\\"").Replace("'", "'"); lstOfTrends.Add(trend); } catch (Exception ex) { //GlobusLogHelper.log.Error("Error Get Current Trends ==> " + ex.Message); logger.Error("Error Get Current Trends ==> " + ex.Message); logger.Error(ex.StackTrace); } } } catch (Exception ex) { logger.Error("Error Get Current Trends ==> " + ex.Message); logger.Error(ex.StackTrace); } } catch (Exception ex) { logger.Error("Error Get Current Trends ==> " + ex.Message); logger.Error(ex.StackTrace); } return(lstOfTrends); }
private void StartArabFollowMultithreaded(object parameters) { try { if (IsstopAppFollow) { return; } lstThreadAppFollow.Add(Thread.CurrentThread); lstThreadAppFollow = lstThreadAppFollow.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch { } try { Array paramsArray = new object[2]; paramsArray = (Array)parameters; KeyValuePair <string, TweetAccountManager> keyValue = (KeyValuePair <string, TweetAccountManager>)paramsArray.GetValue(0); GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); TweetAccountManager tweetAccountManager = keyValue.Value; tweetAccountManager.logEventsArabFollower.addToLogger += new EventHandler(logEvents_Follower_addToLogger); //tweetAccountManager.logEventsArabFollower.addToLogger += logEvents_Follower_addToLogger; //if (!tweetAccountManager.IsLoggedIn) { tweetAccountManager.LoginApplicationFollow(); } } catch { } finally { counter_Account--; if (counter_Account == 0) { AddtoLoggerViewAccounts("Process completed."); } } }
public void StartSalesavigatorScraper(ref GlobusHttpHelper objHttpHelper, string mainUrl) { try { //("[ " + DateTime.Now + " ] => [ Select The Email Id From The Dropdown and Fill All Mandatory (*) Fields ]"); Pagination(ref objHttpHelper, mainUrl); //ScrapeProfileDetails(ref objHttpHelper); try { string[] profileUrls = lstProfileUrls.ToArray(); System.IO.File.WriteAllLines(Globals.profileUrlsSalesNavigatorScraper, profileUrls); } catch { } } catch { } }
public Dictionary <string, string> getAllMembers(ref GlobusHttpHelper HttpHelper, string userName) { Dictionary <string, string> details = new Dictionary <string, string>(); try { string url = "https://www.linkedin.com/people/invites?trk=connect_hub_manage_invitations_sent"; string src = HttpHelper.getHtmlfromUrl(new Uri(url)); if (src.Contains("{\"lastName\"")) { string[] arr = Regex.Split(src, "{\"lastName\""); foreach (string item in arr) { try { if (!item.Contains("<!DOCTYPE")) { string invitationId = string.Empty; string Id = string.Empty; string fullName = Utils.getBetween(item, "i18n_check_to_remove\":\"", "\","); fullName = Utils.getBetween(fullName + "###", "to remove", "###"); fullName = fullName.Trim(); if (item.Contains("")) { invitationId = Utils.getBetween(item, "\"invitationId\":\"", "\",\""); } if (item.Contains("memberId\":")) { Id = Utils.getBetween(item, "memberId\":", "}"); } Id = userName + ":" + Id; details.Add(Id, fullName + ":" + invitationId); } } catch { } } } } catch { } return(details); }
public static List <string> Scrape(string Html) { var urls = new List <string>(); var gcc = new GlobusHttpHelper(); //Html = gcc.getHtmlfromUrl(new Uri("https://www.google.com/search?q=mobile+phones+under+5000&oq=mobile+phone")); var hd = new HtmlDocument(); hd.LoadHtml(Html); var nodeCommercialUnit = hd.DocumentNode.SelectSingleNode("//div[contains(@class, 'commercial-unit')]"); if (nodeCommercialUnit.SelectNodes(".//*[@class='pla-unit-container']") != null) { var nodeUnitContainer = nodeCommercialUnit.SelectNodes(".//*[@class='pla-unit-container']").Descendants().Where(x => x.Attributes.Contains("class") && x.Attributes["class"].Value == "D6nsM"); foreach (var node in nodeUnitContainer) { foreach (var link in node.Descendants().Where(x => x.Attributes.Contains("href")).Select(y => y.Attributes["href"].Value)) { if (!(link.StartsWith("https://www.googleadservices.com/") || link.StartsWith("/aclk?"))) { urls.Add(link); } } } } else if (nodeCommercialUnit.SelectNodes(".//div/div//a[2]") != null) { var nodes = nodeCommercialUnit.SelectNodes(".//div/div//a[2]"); foreach (var node in nodes) { var link = node.GetAttributeValue("href", ""); if (!(link.StartsWith("https://www.googleadservices.com/") || link.StartsWith("/aclk?"))) { urls.Add(link); } } } //var nods = nodeCommercialUnit.SelectNodes(".//td/div/div//a[2]"); return(urls.Distinct().ToList()); }
private void StartCompanyEmployeeSearch() { if (IsStop_CompanyEmployeeScraperThread) { return; } lstCompanyEmployeeScraperThread.Add(Thread.CurrentThread); lstCompanyEmployeeScraperThread = lstCompanyEmployeeScraperThread.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; HttpHelper = new GlobusHttpHelper(); LinkedinSearch objlinkscrCompanyFilter = new LinkedinSearch(); bool isLoggedIn = Login_InBoardProGetData(); if (rdbCompanyEmployeeScraperKeyword.Checked) { rdbCompanyEmployeeScraperKeyword.Checked = false; //AddLoggerCompanyEmployeeSearch("[ " + DateTime.Now + " ] => [ Search Through Keyword ]"); //_IsKeyword_CompanyEmployeeScraper = true; //objlinkscrCompanyFilter._RdbCompanyEmployeeSearchKeyword = true; //InBoardPro.LinkedinSearch._Keyword = txtCompanyEmployeeScraperKeyword.Text; } if (!(rdbCompnayEmployeeScraperURL.Checked)) { rdbCompnayEmployeeScraperURL.Checked = true; AddLoggerCompanyEmployeeSearch("[ " + DateTime.Now + " ] => [ Search Through Url ]"); _IsProfileURL_CompanyEmployeeScraper = true; objlinkscrCompanyFilter._RdbCompanyEmployeeSearchURL = true; } LinkedinSearch._Search = "CompanyEmployeeSearch"; if (isLoggedIn) { AddLoggerCompanyEmployeeSearch("[ " + DateTime.Now + " ] => [ Start LinkedIn Crawling ]"); objlinkscrCompanyFilter.StartLinkedInSearch(ref HttpHelper); } }
public void StartSalesNavigator(ref LinkedinUser objLinkedinUser) { try { GlobusHttpHelper objHttpHelper = objLinkedinUser.globusHttpHelper; string mainUrl = string.Empty; mainUrl = FormURL(ref objLinkedinUser); Pagination(ref objHttpHelper, mainUrl); //ScrapeProfileDetails(ref objHttpHelper); try { string[] profileUrls = lstProfileUrls.ToArray(); System.IO.File.WriteAllLines(FilePath.profileUrlsSalesNavigatorScraper, profileUrls); } catch { } } catch (Exception ex) { } }
//New method added by Lijo John 16/10/2014 public bool CheckProxy(string IPAddress, int Port, string Username, string Password, string URL) { GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); bool status = false; try { System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch(); string ResponseTime = string.Empty; timer.Start(); string Response = objGlobusHttpHelper.getHtmlfromUrlProxy(new Uri(URL), IPAddress, Port, Username, Password); timer.Stop(); TimeSpan timeTaken = timer.Elapsed; ResponseTime = timeTaken.ToString(); if (string.IsNullOrEmpty(Response)) { timeTaken = new TimeSpan(); timer.Start(); Response = objGlobusHttpHelper.getHtmlfromUrlProxy(new Uri(URL), IPAddress, Port, Username, Password); timer.Stop(); timeTaken = timer.Elapsed; ResponseTime = timeTaken.ToString(); } if (!string.IsNullOrEmpty(Response) && !Response.Contains("Internet Explorer cannot display the webpage")) { status = true; } else { status = false; } } catch (Exception ex) { GlobusLogHelper.log.Error(ex.StackTrace); } return(status); }
public void StartSendInvitations_DivideUrlsAccordingAccount(ref GlobusHttpHelper httpHelper, List <string> lstProfileURL) { try { foreach (var item in lstProfileURL) { try { Connect(ref httpHelper, item); } catch (Exception ex) { Console.WriteLine("Error >>> " + ex.StackTrace); } } } catch (Exception ex) { Console.WriteLine("Error >>> " + ex.StackTrace); Log("[ " + DateTime.Now + " ] => [ Error >>> ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ex.StackTrace >>> " + ex.StackTrace + " ]"); } Log("[ " + DateTime.Now + " ] => [ Process Completed With Username >>> " + _UserName + " ]"); }
public void CommentOperation(string Acc, string[] Hash) { try { lstThreadsCommentPoster.Add(Thread.CurrentThread); lstThreadsCommentPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { string status = string.Empty; string[] arrAcc = Regex.Split(Acc, ":"); InstagramUser objInstagramUser = new InstagramUser(arrAcc[0], arrAcc[1], arrAcc[2], arrAcc[3]); GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); objInstagramUser.globusHttpHelper = objGlobusHttpHelper; AccountManager objAccountManager = new AccountManager(); if (!objInstagramUser.isloggedin) { status = objAccountManager.LoginUsingGlobusHttp(ref objInstagramUser); } if (status == "Success" || (objInstagramUser.isloggedin)) { foreach (string itemHash in Hash) { if (!string.IsNullOrEmpty(itemHash)) { //Operation string[] Data_ID = Regex.Split(itemHash, ","); string daaa = objInstagramUser.username; foreach (string Photo_ID in Data_ID) { if (!string.IsNullOrEmpty(Photo_ID)) { // CommentOnSnapsVideos(ref objInstagramUser, Photo_ID); getComment(Photo_ID, ref objInstagramUser); } else { break; } if (minDelayCommentPoster != 0) { mindelay = minDelayCommentPoster; } if (maxDelayCommentPoster != 0) { maxdelay = maxDelayCommentPoster; } Random obj_rn = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = obj_rn.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } } GlobusLogHelper.log.Info("========================="); GlobusLogHelper.log.Info("Process Completed !!!"); GlobusLogHelper.log.Info("========================="); } } } catch (Exception ex) { GlobusLogHelper.log.Info("Error : " + ex.StackTrace); } }
public void BoardMethod(string BoardName, string BoardUrl, ref PinInterestUser objPinInUser) { try { try { lstThreadsBoards.Add(Thread.CurrentThread); lstThreadsBoards.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; lock (this) { string BoardId = string.Empty; AddNewPinManager objaddnewPin = new AddNewPinManager(); RePinManager objRepin = new RePinManager(); try { boardinput.Add(Thread.CurrentThread); boardinput.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; if (string.IsNullOrEmpty(BoardName)) { try { List<string> baordnames = GetAllBoardNames_new(ref objPinInUser); BoardName = baordnames[RandomNumberGenerator.GenerateRandom(0, baordnames.Count - 1)]; BoardId = objaddnewPin.GetBoardId(BoardName, ref objPinInUser); } catch (Exception ex) { }; } else { //testing GlobusHttpHelper objHttp = new GlobusHttpHelper(); try { BoardId = objaddnewPin.GetBoardId_Board(BoardName, ref objPinInUser); } catch (Exception ex) { Console.Write(ex.Message); } } if (string.IsNullOrEmpty(BoardId)) { BoardId = objaddnewPin.GetBoardId(BoardName, ref objPinInUser); } int counter = 0; int RepinCounter = 0; if (!BoardId.Contains("failure")) { if (!string.IsNullOrEmpty(BoardId)) { if (PDGlobals.ValidateNumber(BoardId)) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Adding Pins From Board :" + BoardUrl + " ]"); clsSettingDB db = new clsSettingDB(); List<string> lstPins = new List<string>(); lstPins = GetBoardPinsNew(BoardId, BoardUrl, 10, ref objPinInUser); lstPins.Distinct(); List<string> lstOfRepin = new List<string>(); lstOfRepin.AddRange(lstPins); string[] lstPinNo = null; lstPinNo = lstPins.ToArray(); //getting lstPins length int lenOFlstPins = lstOfRepin.Count; foreach (string Pins in lstPinNo) { if (MaxRePinCount > RepinCounter) { string Message = string.Empty; if (ClGlobul.lstBoardRepinMessage.Count > 0) { if (counter < ClGlobul.lstBoardRepinMessage.Count) { Message = ClGlobul.lstBoardRepinMessage[counter]; } else { counter = 0; Message = ClGlobul.lstBoardRepinMessage[counter]; } } bool IsReppined = false; if (!Pins.Contains("n")) { try { int index = lstOfRepin.Where(x => x == Pins).Select(x => lstOfRepin.IndexOf(x)).Single<int>(); string NoOfPages = Convert.ToString(index / lenOFlstPins); IsReppined = objRepin.RepinwithMessage(Pins, Message, BoardId, NoOfPages, ref objPinInUser); } catch { } if (IsReppined) { //GlobusLogHelper.log.Info("[ => [ Repin Id : " + Pins + " ]"); #region AccountReport string module = "Boards"; string status = "Repined"; Qm.insertAccRePort(objPinInUser.Username, module, "https://www.pinterest.com/pin/" + Pins, BoardName, "", "", "", "", status, "", "", DateTime.Now); objBoardDelegate(); #endregion GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Repin Pin : " + Pins + " to Account : " + objPinInUser.Username + " In " + BoardName + " ]"); try { string CSV_Header = "Date" + "," + "UserName" + "," + "Message" + "," + "Pin" + "Board Id"; string CSV_Data = System.DateTime.Now.ToString() + "," + objPinInUser.Username + "," + Message + "," + "https://www.pinterest.com/pin/" + Pins + "," + BoardId; PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, Boardpath + "\\Board.csv"); RepinCounter++; } catch (Exception ex) { Console.Write(ex.Message); } //kept here int delay = RandomNumberGenerator.GenerateRandom(minDelayBoards, maxDelayBoards); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay for " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } else { } counter++; } } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED " + " For " + objPinInUser.Username + " In " + BoardName + "]"); GlobusLogHelper.log.Info("-----------------------------------------------------------------------------"); break; } } } } } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ You already have a board with that name. " + objPinInUser.Username + " ]"); } } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
public string PostAddCompanyUsingUrl(ref GlobusHttpHelper HttpHelper, string username, int mindelay, int maxdelay) { string ReturnString = string.Empty; try { string IncodePost = string.Empty; string PostMessage = string.Empty; string MemFullName = string.Empty; string SearchId = string.Empty; string CompanyName = string.Empty; string IsOpenGrp = string.Empty; string CompanyType = string.Empty; string CompanyId = string.Empty; string goback = string.Empty; List <string> checkDupcompanyId = new List <string>(); List <string> tempcompanyUrl = new List <string>(); CompanyDtl.Clear(); //---------------------------------------------------------------------------------------------------------------------- string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string sourceAlias = string.Empty; string MessageText = string.Empty; string PostedMessage = string.Empty; string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top")); if (pageSource.Contains("csrfToken")) { csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50); string[] Arr = csrfToken.Split('<'); csrfToken = Arr[0]; csrfToken = csrfToken.Replace(":", "%3A").Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace(">", string.Empty); csrfToken = csrfToken.Replace("\n<script src", "").Trim(); } if (pageSource.Contains("sourceAlias")) { sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2]; } //------------------------------------------------------------------------------------------------------------------------------- foreach (var CompanywithUrl in lstLinkedinCompanyURL) { try { string finalurl = string.Empty; if (!CompanywithUrl.Contains("http")) { finalurl = "http://" + CompanywithUrl; } else { finalurl = CompanywithUrl;; } string pageSource1 = HttpHelper.getHtmlfromUrl1(new Uri(finalurl)); string[] RgxCompanyData1 = System.Text.RegularExpressions.Regex.Split(pageSource1, "<h1 class=\"name\""); try { int startindex = RgxCompanyData1[1].IndexOf("<span itemprop=\"name\">"); string start = RgxCompanyData1[1].Substring(startindex); int endIndex = start.IndexOf("</span>"); CompanyName = start.Substring(0, endIndex).Replace("<span itemprop=\"name\">", string.Empty).Replace("\n", string.Empty).Replace("\\u002d", "-").Trim(); if (CompanyName.Contains("<img src=")) { CompanyName = CompanyName.Split('>')[0]; } } catch { CompanyName = getBetween(pageSource1, "company_name", "</a>").Replace("\n", "").Replace(">", "").Replace("\"", "").Trim(); } try { int startindex1 = RgxCompanyData1[1].IndexOf("/company/follow/submit?id="); string start1 = RgxCompanyData1[1].Substring(startindex1); int endIndex1 = start1.IndexOf("&"); CompanyId = start1.Substring(0, endIndex1).Replace("/company/follow/submit?id=", string.Empty).Replace("&", string.Empty).Trim(); //int startindex1 = pageSource1.IndexOf("X-FS-Origin-Request"); //string start1 = pageSource1.Substring(startindex1); //int endIndex1 = start1.IndexOf("?"); //CompanyId = start1.Substring(0, endIndex1).Replace("X-FS-Origin-Request", string.Empty).Replace("?", string.Empty).Replace("\"", "").Replace("company", "").Replace("/", "").Replace(":", "").Trim(); } catch { CompanyId = getBetween(pageSource1, "submit?id=", "&").Replace("\n", "").Replace(">", "").Replace("\"", "").Trim(); } try { int startindex1 = pageSource1.IndexOf("goback="); string start1 = pageSource1.Substring(startindex1); int endIndex1 = start1.IndexOf("&"); goback = start1.Substring(0, endIndex1).Replace("goback=", string.Empty); } catch { } string txid = (UnixTimestampFromDateTime(System.DateTime.Now) * 1000).ToString(); //postUrl = "https://www.linkedin.com/uas/login-submit"; //postdata = "session_key=" + username + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; //ResLogin = HttpHelper.postFormData(new Uri(postUrl), postdata); try { //string GoBack = "%2Ebzo_*1_*1_*1_*1_*1_*1_*1_" + CompanyId; Log("[ " + DateTime.Now + " ] => [ ID: " + username + " has Follow the Company: " + CompanyName.ToString() + " ]"); //string pageGetreq = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/company/follow/submit?id=" + CompanyId + "&fl=start&version=2&ft=pageKey%3Dbiz-overview-internal%3Bmodule%3Dbutton&sp=biz-overview&csrfToken=" + csrfToken + "&goback=" + GoBack)); string pageGetreq = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/company/follow/submit?id=" + CompanyId + "&fl=start&version=2&ft=pageKey%3Dbiz-overview%3Bmodule%3Dbutton&sp=biz-overview&csrfToken=" + csrfToken + "&goback=" + goback + "&ajax=&rnd=" + txid)); if (pageGetreq.Contains("Following")) { ReturnString = "Your request to Follow the: " + CompanyName.ToString() + " company has been Successfully Followed."; Log("[ " + DateTime.Now + " ] => [ " + ReturnString + " ]"); #region Data Saved In CSV File if (!string.IsNullOrEmpty(CompanywithUrl) || !string.IsNullOrEmpty(CompanyName)) { try { string CSVHeader = "Companyurl" + "," + "CompanyName" + "," + "LoginID"; string CSV_Content = CompanywithUrl.Replace(",", ";") + "," + CompanyName.Replace(",", ";") + "," + username; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_LinkedinFollowCompanyUsingUrl); Log("[ " + DateTime.Now + " ] => [ Company Name: " + CompanyName.Replace(",", ";") + " in Account : " + username.Replace(",", ";") + " ]"); Log("[ " + DateTime.Now + " ] => [ Data Saved In CSV File ! ]"); tempcompanyUrl.Add(CompanywithUrl); } catch { } } #endregion } else if (pageGetreq.Contains("Error")) { Log("[ " + DateTime.Now + " ] => [ Error In Follow Company ]"); GlobusFileHelper.AppendStringToTextfileNewLine(username + ":" + "Error In Follow Company", Globals.path_Not_FollowCompany); } else { Log("[ " + DateTime.Now + " ] => [ Company Could Not Be Followed ]"); GlobusFileHelper.AppendStringToTextfileNewLine(username + ":" + "Company Could Not Be Followed", Globals.path_Not_FollowCompany); } } catch { } if (checkDupcompanyId.Count != 0) { if (checkDupcompanyId.Contains(CompanyId)) { } else { checkDupcompanyId.Add(CompanyId); CompanyDtl.Add(CompanyName, CompanyId); Log("[ " + DateTime.Now + " ] => [ Founded Company Name : " + CompanyName + " ]"); } } else { CompanyDtl.Add(CompanyName, CompanyId); } } catch { } if (tempcompanyUrl.Count() == CountPerAccount) { break; } int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Search Company for follow --> PostAddCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Search Company for follow --> PostAddCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinFollowCompanyErrorLogs); return(ReturnString); } return(ReturnString); }
/// <summary> /// Returns Captcha Image from Facebook /// </summary> /// <param name="responseMessage"></param> /// <returns></returns> public string GetCaptchaImageMulti(string email, ref GlobusHttpHelper HttpHelper, ref string post_form_id, ref string lsd, ref string reg_instance, ref string firstname, ref string lastname, ref string reg_email__, ref string reg_email_confirmation__, ref string reg_passwd__, ref string sex, ref string birthday_month, ref string birthday_day, ref string birthday_year, ref string captcha_persist_data, ref string captcha_session, ref string extra_challenge_params, ref string recaptcha_public_key, ref string authp_pisg_nonce_tt, ref string authp, ref string psig, ref string nonce, ref string tt, ref string time, ref string challenge, ref string CaptchaSummit) { string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUsername = string.Empty; string proxyPassword = string.Empty; string FirstName = string.Empty; string LastName = string.Empty; string Email = string.Empty; string Password = string.Empty; string DOB = string.Empty; Email = email.Split(':')[0]; Password = email.Split(':')[1]; if (email.Split(':').Length > 5) { proxyAddress = email.Split(':')[2]; proxyPort = email.Split(':')[3]; proxyUsername = email.Split(':')[4]; proxyPassword = email.Split(':')[5]; //AddToListBox("Setting proxy " + proxyAddress + ":" + proxyPort); } else if (email.Split(':').Length == 4) { //MessageBox.Show("Private proxies not loaded with emails \n Accounts will be created with public proxies"); proxyAddress = email.Split(':')[2]; proxyPort = email.Split(':')[3]; } if (listFirstName.Count > 0) { try { FirstName = listFirstName[RandomNumberGenerator.GenerateRandom(0, listFirstName.Count)]; } catch (Exception ex) { FirstName = string.Empty; } } if (listLastName.Count > 0) { try { LastName = listLastName[RandomNumberGenerator.GenerateRandom(0, listLastName.Count)]; } catch (Exception ex) { LastName = string.Empty; } } #region Get Params //string post_form_id = string.Empty; //string lsd = string.Empty; //string reg_instance = string.Empty; //string firstname = string.Empty; //string lastname = string.Empty; //string reg_email__ = string.Empty; //string reg_email_confirmation__ = string.Empty; //string reg_passwd__ = string.Empty; //string sex = string.Empty; //string birthday_month = string.Empty; //string birthday_day = string.Empty; //string birthday_year = string.Empty; //string captcha_persist_data = string.Empty; //string captcha_session = string.Empty; //string extra_challenge_params = string.Empty; //string recaptcha_public_key = string.Empty; //string authp_pisg_nonce_tt = null; //string authp = string.Empty; //string psig = string.Empty; //string nonce = string.Empty; //string tt = string.Empty; //string time = string.Empty; //string challenge = string.Empty; //string CaptchaSummit = string.Empty; int intProxyPort = 80; Regex IdCheck = new Regex("^[0-9]*$"); if (!string.IsNullOrEmpty(proxyPort) && IdCheck.IsMatch(proxyPort)) { intProxyPort = int.Parse(proxyPort); } AddToListBox("Fetching Captcha"); LogFacebookCreator("Fetching Captcha"); //GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); //Create new instance string pageSource = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.facebook.com/"), proxyAddress, intProxyPort, proxyUsername, proxyPassword); #region CSS, JS, & Pixel requests to avoid Socket Detection ///JS, CSS, Image Requests //RequestJSCSSIMG(pageSource, ref HttpHelper); RequestsJSCSSIMG.RequestJSCSSIMG(pageSource, ref HttpHelper); //try //{ // string req1 = HttpHelper.getHtmlfromUrl(new Uri("http://static.ak.fbcdn.net/rsrc.php/v1/yC/r/6n91uRFZJAi.js")); //} //catch (Exception) //{ //} //try //{ // string req2 = HttpHelper.getHtmlfromUrl(new Uri("http://static.ak.fbcdn.net/rsrc.php/v1/yd/r/dpT-tcRYFZy.js")); //} //catch (Exception) //{ //} ///Pixel request string reg_instanceValue = GetParamValue(pageSource, "reg_instance"); //string asyncSignal = RandomNumberGenerator.GenerateRandom(3000, 4000).ToString(); string asyncSignal = string.Empty; try { asyncSignal = RandomNumberGenerator.GenerateRandom(3000, 8000).ToString(); } catch (Exception) { } string pixel = HttpHelper.getHtmlfromUrl(new Uri("http://pixel.facebook.com/ajax/register/logging.php?action=form_focus®_instance=" + reg_instanceValue + "&asyncSignal=" + asyncSignal + "&__user=0")); #endregion //Delay after loading Sign Up //Thread.Sleep(12000); //string Response1 = HttpHelper.postFormDataProxy(new Uri("http://ocsp.digicert.com/"), "", proxyAddress, intProxyPort, proxyUsername, proxyPassword); //string Response12 = HttpHelper.postFormDataProxy(new Uri("http://ocsp.digicert.com/"), "", proxyAddress, intProxyPort, proxyUsername, proxyPassword); //string pageSource12 = HttpHelper.getHtmlfromUrlProxy(new Uri("http://static.ak.fbcdn.net/rsrc.php/v1/yS/r/STeWPW2kh0m.png"), proxyAddress, intProxyPort, proxyUsername, proxyPassword); //**** update by ritesh 20-9-11 *****///////////////////////////////// //*** For post_form_id ********//////////////////////////////////////////////// AddToListBox("searching the captcha data" + Email); if (pageSource.Contains("post_form_id")) { string post_id = pageSource.Substring(pageSource.IndexOf("post_form_id"), 200); string[] Arr1 = post_id.Split('"'); post_form_id = Arr1[2]; } if (pageSource.Contains("lsd")) { string lsd_val = pageSource.Substring(pageSource.IndexOf("lsd"), 100); string[] Arr_lsd = lsd_val.Split('"'); lsd = Arr_lsd[2]; } if (pageSource.Contains("reg_instance")) { string reg_instance_val = pageSource.Substring(pageSource.IndexOf("reg_instance"), 200); string[] Arr_reg = reg_instance_val.Split('"'); reg_instance = Arr_reg[4]; } firstname = FirstName.Replace(" ", "%20"); lastname = LastName.Replace(" ", "%20"); reg_email__ = Email.Replace("@", "%40"); reg_email_confirmation__ = Email.Replace("@", "%40"); reg_passwd__ = Password.Replace("@", "%40"); sex = SexSelect; birthday_month = RandomNumberGenerator.GenerateRandom(1, 12).ToString(); birthday_day = RandomNumberGenerator.GenerateRandom(1, 28).ToString(); birthday_year = RandomNumberGenerator.GenerateRandom(1980, 1990).ToString(); if (pageSource.Contains("captcha_persist_data")) { string captcha_persist_data_val = pageSource.Substring(pageSource.IndexOf("captcha_persist_data"), 500); string[] Arr_captcha_persist_data_val = captcha_persist_data_val.Split('"'); captcha_persist_data = Arr_captcha_persist_data_val[4]; } if (pageSource.Contains("captcha_session")) { string captcha_session_val = pageSource.Substring(pageSource.IndexOf("captcha_session"), 200); string[] Arr_captcha_session_val = captcha_session_val.Split('"'); captcha_session = Arr_captcha_session_val[4]; } if (pageSource.Contains("extra_challenge_params")) { string extra_challenge_params_val = pageSource.Substring(pageSource.IndexOf("extra_challenge_params"), 500); string[] Arr_extra_challenge_params_val = extra_challenge_params_val.Split('"'); authp_pisg_nonce_tt = Arr_extra_challenge_params_val[4]; extra_challenge_params = Arr_extra_challenge_params_val[4]; extra_challenge_params = extra_challenge_params.Replace("=", "%3D"); extra_challenge_params = extra_challenge_params.Replace("&", "%26"); } #endregion //AddToListBox("get the first url" + Email); ///Delay after filling info //int delay = 0; //try //{ // delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay) * 1000; // if (delay < 4000) // { // delay = RandomNumberGenerator.GenerateRandom(8000, 12000); // } //} //catch (Exception) //{ //} //AddToListBox("Delaying for " + delay / 1000 + " seconds"); //Thread.Sleep(delay); //Thread.Sleep(RandomNumberGenerator.GenerateRandom(4000, 8000)); //////////////////////////////*****Gets Captcha URL****//////////////////////////////////////////////// string pageSourceCaptcha = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/ajax/register.php?__a=4&post_form_id=" + post_form_id + "&lsd=" + lsd + "®_instance=" + reg_instance + "&locale=en_US&terms=on&abtest_registration_group=1&referrer=&md5pass=&validate_mx_records=1&ab_test_data=&firstname=" + firstname + "&lastname=" + lastname + "®_email__=" + reg_email__ + "®_email_confirmation__=" + reg_email_confirmation__ + "®_passwd__=" + reg_passwd__ + "&sex=" + sex + "&birthday_month=" + birthday_month + "&birthday_day=" + birthday_day + "&birthday_year=" + birthday_year + "&captcha_persist_data=" + captcha_persist_data + "&captcha_session=" + captcha_session + "&extra_challenge_params=" + extra_challenge_params + "&recaptcha_type=password&captcha_response=&ignore=captcha%7Cpc&__user=0")); //JS, CSS, Image Requests RequestsJSCSSIMG.RequestJSCSSIMG(pageSourceCaptcha, ref HttpHelper); if (!pageSourceCaptcha.Contains("There is an existing account associated with this email")) { if (pageSource.Contains("RegUtil.recaptcha_public_key")) { string recaptcha_public_key_val = pageSource.Substring(pageSource.IndexOf("RegUtil.recaptcha_public_key"), 200); string[] Arr_recaptcha_public_key = recaptcha_public_key_val.Split('"'); recaptcha_public_key = Arr_recaptcha_public_key[1]; } if (authp_pisg_nonce_tt != null) { string[] ArrpisgTemp = authp_pisg_nonce_tt.Split('='); authp = ArrpisgTemp[1]; authp = authp.Replace("&psig", ""); psig = ArrpisgTemp[2]; psig = psig.Replace("&nonce", ""); nonce = ArrpisgTemp[3]; nonce = nonce.Replace("&tt", ""); tt = ArrpisgTemp[4]; tt = tt.Replace("&time", ""); time = ArrpisgTemp[5]; time = time.Substring(0, 10); } AddToListBox("loading captcha" + Email); string pageSourceCaptcha1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.google.com/recaptcha/api/challenge?k=" + recaptcha_public_key + "&ajax=1&xcachestop=0.4159115800857506&authp=" + authp + "&psig=" + psig + "&nonce=" + nonce + "&tt=" + tt + "&time=" + time + "&new_audio_default=1")); ////JS, CSS, Image Requests //RequestsJSCSSIMG.RequestJSCSSIMG(pageSourceCaptcha1, ref HttpHelper); // string challenge = string.Empty; if (pageSourceCaptcha1.Contains("challenge")) { string challenge_val = pageSourceCaptcha1.Substring(pageSourceCaptcha1.IndexOf("challenge"), 300); string[] Arr_challenge = challenge_val.Split('\''); challenge = Arr_challenge[1]; } return "http://www.google.com/recaptcha/api/image?c=" + challenge; //string pageSourceCaptcha2 = HttpHelper.getHtmlfromUrlImage(new Uri("http://www.google.com/recaptcha/api/image?c=" + challenge)); } else { //responseMessage = "There is an existing account with " + Email; AddToListBox("There is an existing account with " + Email); return null; } }
public static List<string> GetPhotoId(string hashTag) { string url = "http://websta.me/" + "tag/" + hashTag; GlobusHttpHelper objInstagramUser = new GlobusHttpHelper (); List<string> lstPhotoId = new List<string> (); int counter = 0; string pageSource = objInstagramUser.getHtmlfromUrl(new Uri(url),"",""); if (!string.IsNullOrEmpty (pageSource)) { if (pageSource.Contains ("<div class=\"mainimg_wrapper\">")) { string[] arr = Regex.Split (pageSource, "<div class=\"mainimg_wrapper\">"); if (arr.Length > 1) { arr = arr.Skip (1).ToArray (); foreach (string itemarr in arr) { try { string startString = "<a href=\"/p/"; string endString = "\" class=\"mainimg\""; string imageId=string.Empty; string imageSrc = string.Empty; if(itemarr.Contains("<a href=\"/p/")) { int indexStart = itemarr.IndexOf("<a href=\"/p/"); string itemarrNow = itemarr.Substring(indexStart); if (itemarrNow.Contains(startString) && itemarrNow.Contains(endString)) { try { imageId = GlobusHttpHelper.getBetween(itemarrNow, startString, endString).Replace("/",""); } catch { } if (!string.IsNullOrEmpty(imageId)) { lstPhotoId.Add(imageId); lstPhotoId.Distinct(); if(lstPhotoId.Count>=counterPhotoId) { return lstPhotoId; } //imageId = "http://websta.me"+imageId; } } } } catch(Exception ex) { } } #region pagination string pageLink = string.Empty; while (true) { //if (stopScrapImageBool) return; string startString = "<a href=\""; string endString = "\" class=\"mainimg\""; string imageId = string.Empty; string imageSrc = string.Empty; if (!string.IsNullOrEmpty(pageLink)) { pageSource = objInstagramUser.getHtmlfromUrl(new Uri(pageLink),"",""); } if (pageSource.Contains("<ul class=\"pager\">") && pageSource.Contains("rel=\"next\">")) { try { pageLink = GlobusHttpHelper.getBetween(pageSource, "<ul class=\"pager\">", "rel=\"next\">"); } catch { } if (!string.IsNullOrEmpty(pageLink)) { try { int len = pageLink.IndexOf("<a href=\""); len = len + ("<a href=\"").Length; pageLink = pageLink.Substring(len); pageLink = pageLink.Trim(); pageLink = pageLink.TrimEnd(new char[] { '"' }); pageLink = "http://websta.me/" + pageLink; } catch { } if (!string.IsNullOrEmpty(pageLink)) { string response = string.Empty; try { response = objInstagramUser.getHtmlfromUrl(new Uri(pageLink),"",""); } catch { } if (!string.IsNullOrEmpty(response)) { if (response.Contains("<div class=\"mainimg_wrapper\">")) { try { string[] arr1 = Regex.Split(response, "<div class=\"mainimg_wrapper\">"); if (arr1.Length > 1) { arr1 = arr1.Skip(1).ToArray(); foreach (string items in arr1) { try { //if (stopScrapImageBool) return; if (items.Contains("<a href=\"/p/")) { int indexStart = items.IndexOf("<a href=\"/p/"); string itemarrNow = items.Substring(indexStart); try { imageId = GlobusHttpHelper.getBetween(itemarrNow, startString, endString).Replace("/",""); } catch { } if (!string.IsNullOrEmpty(imageId)) { lstPhotoId.Add(imageId); lstPhotoId.Distinct(); if(lstPhotoId.Count>=counterPhotoId) { return lstPhotoId; } //imageId = "http://websta.me"+imageId; } counter++; //Addtologger("Image DownLoaded with ImageName "+imageId+"_"+counter); if(lstPhotoId.Count>=counterPhotoId) { return lstPhotoId; } } } catch { } } if(lstPhotoId.Count>=counterPhotoId) { return lstPhotoId; } } } catch { } } } else { } } else { break; } } else { break; } } else { break; } } #endregion } } } return lstPhotoId; }
private void RequestJSCSSIMG(string pageSource, ref GlobusHttpHelper HttpHelper) { ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; //CSS Request foreach (string item in GetHrefsFromString(pageSource)) { if (item.Contains(".css")) { string cssSource = item.Replace(" ", "").Trim(); try { string res = HttpHelper.getHtmlfromUrl(new Uri(cssSource)); } catch (Exception) { Thread.Sleep(500); try { string res = HttpHelper.getHtmlfromUrl(new Uri(cssSource)); } catch (Exception) { } } } } //JS Request string[] scriptArr = Regex.Split(pageSource, "/script>"); foreach (string item in scriptArr) { if (item.Contains("static.ak.") || item.Contains("profile.ak.")) { int startIndx = item.LastIndexOf("src=") + "src=".Length + 1; int endIndx = item.IndexOf(">", startIndx) - 1; string jsSource = item.Substring(startIndx, endIndx - startIndx); if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.")) { try { string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource)); } catch (Exception) { Thread.Sleep(500); try { string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource)); } catch (Exception) { } } } } } ///IMG Request string[] imageArr = Regex.Split(pageSource, "<img"); foreach (string item in imageArr) { if (item.Contains("static.ak.") || item.Contains("profile.ak.")) { int startIndx = item.IndexOf("src=") + "src=".Length + 1; int endIndx = item.IndexOf("\"", startIndx + 1); string jsSource = item.Substring(startIndx, endIndx - startIndx); if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.")) { if (jsSource.Contains(".png") || jsSource.Contains(".gif") || jsSource.Contains(".jpg") || jsSource.Contains(".jpeg")) { try { string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource)); } catch (Exception) { Thread.Sleep(500); try { string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource)); } catch (Exception) { } } } } } } }
/// <summary> /// Email Verifies account once successfully created /// Also inserts account to Database /// Verifies Yahoo, Gmail & Hotmail /// </summary> public void VerifiyAccountMultiThreaded(string email, string password, string proxyAddress, string proxyPort, string proxyUser, string proxyPassword, ref GlobusHttpHelper HttpHelper) { try { POPClient popClient = new POPClient(); AddToListBox("Verifying through Email: " + email); AddToListBox("It may take some time, please wait..."); #region Gmail if (email.Contains("@gmail")) { if (popClient.Connected) popClient.Disconnect(); popClient.Connect("pop.gmail.com", int.Parse("995"), true); popClient.Authenticate(email, password); int Count = popClient.GetMessageCount(); for (int i = Count; i >= 1; i--) { OpenPOP.MIME.Message Message = popClient.GetMessage(i); string subject = Message.Headers.Subject; if (Message.Headers.Subject.Contains("Action Required: Confirm Your Facebook Account")) { foreach (string href in GetUrlsFromString(Message.MessageBody[0])) { try { string staticUrl = string.Empty; string email_open_log_picUrl = string.Empty; string strBody = Message.MessageBody[0]; string[] arr = Regex.Split(strBody, "src="); foreach (string item in arr) { if (!item.Contains("<!DOCTYPE")) { if (item.Contains("static")) { string[] arrStatic = item.Split('"'); staticUrl = arrStatic[1]; } if (item.Contains("email_open_log_pic")) { string[] arrlog_pic = item.Split('"'); email_open_log_picUrl = arrlog_pic[1]; email_open_log_picUrl = email_open_log_picUrl.Replace("amp;", ""); break; } } } string href1 = href.Replace("&report=1", ""); href1 = href.Replace("amp;", ""); EmailVerificationMultithreaded(href1, staticUrl, email_open_log_picUrl, email, password, proxyAddress, proxyPort, proxyUser, proxyPassword, ref HttpHelper); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } else if (Message.Headers.Subject.Contains("Just one more step to get started on Facebook")) { foreach (string href in GetUrlsFromString(Message.MessageBody[0])) { try { string staticUrl = string.Empty; string email_open_log_picUrl = string.Empty; string strBody = Message.MessageBody[0]; string[] arr = Regex.Split(strBody, "src="); foreach (string item in arr) { if (!item.Contains("<!DOCTYPE")) { if (item.Contains("static")) { string[] arrStatic = item.Split('"'); staticUrl = arrStatic[1]; } if (item.Contains("email_open_log_pic")) { string[] arrlog_pic = item.Split('"'); email_open_log_picUrl = arrlog_pic[1]; email_open_log_picUrl = email_open_log_picUrl.Replace("amp;", ""); break; } } } string href1 = href.Replace("&report=1", ""); href1 = href.Replace("amp;", ""); EmailVerificationMultithreaded(href1, staticUrl, email_open_log_picUrl, email, password, proxyAddress, proxyPort, proxyUser, proxyPassword, ref HttpHelper); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } } } #endregion #region Yahoo else if (email.Contains("@yahoo")) { ChilkatIMAP imap = new ChilkatIMAP(); imap.proxyAddress = proxyAddress; imap.proxyPort = proxyPort; imap.proxyUser = proxyUser; imap.proxyPass = proxyPassword; imap.GetFBMails(email, password); } #endregion #region Hotmail else if (email.Contains("@hotmail")) { if (popClient.Connected) popClient.Disconnect(); popClient.Connect("pop3.live.com", int.Parse("995"), true); popClient.Authenticate(email, password); int Count = popClient.GetMessageCount(); for (int i = Count; i >= 1; i--) { OpenPOP.MIME.Message Message = popClient.GetMessage(i); string subject = Message.Headers.Subject; if (Message.Headers.Subject.Contains("Action Required: Confirm Your Facebook Account")) { foreach (string href in GetUrlsFromString(Message.MessageBody[0])) { try { string staticUrl = string.Empty; string email_open_log_picUrl = string.Empty; string strBody = Message.MessageBody[0]; string[] arr = Regex.Split(strBody, "src="); foreach (string item in arr) { if (!item.Contains("<!DOCTYPE")) { if (item.Contains("static")) { string[] arrStatic = item.Split('"'); staticUrl = arrStatic[1]; } if (item.Contains("email_open_log_pic")) { string[] arrlog_pic = item.Split('"'); email_open_log_picUrl = arrlog_pic[1]; email_open_log_picUrl = email_open_log_picUrl.Replace("amp;", ""); break; } } } string href1 = href.Replace("&report=1", ""); href1 = href.Replace("amp;", ""); EmailVerificationMultithreaded(href1, staticUrl, email_open_log_picUrl, email, password, proxyAddress, proxyPort, proxyUser, proxyPassword, ref HttpHelper); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } else if (Message.Headers.Subject.Contains("Just one more step to get started on Facebook")) { foreach (string href in GetUrlsFromString(Message.MessageBody[0])) { try { string staticUrl = string.Empty; string email_open_log_picUrl = string.Empty; string strBody = Message.MessageBody[0]; string[] arr = Regex.Split(strBody, "src="); foreach (string item in arr) { if (!item.Contains("<!DOCTYPE")) { if (item.Contains("static")) { string[] arrStatic = item.Split('"'); staticUrl = arrStatic[1]; } if (item.Contains("email_open_log_pic")) { string[] arrlog_pic = item.Split('"'); email_open_log_picUrl = arrlog_pic[1]; email_open_log_picUrl = email_open_log_picUrl.Replace("amp;", ""); break; } } } string href1 = href.Replace("&report=1", ""); href1 = href.Replace("amp;", ""); EmailVerificationMultithreaded(href1, staticUrl, email_open_log_picUrl, email, password, proxyAddress, proxyPort, proxyUser, proxyPassword, ref HttpHelper); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } } } #endregion } catch (Exception ex) { Console.WriteLine(ex.StackTrace); if (ex.Message.Contains("InvalidPasswordException")) { //AddToListBox("Invalid Password :"******"--- " + email); } } finally { //Write to text file //Also insert in Database try { GlobusFileHelper.AppendStringToTextfileNewLine(email + ":" + password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUser + ":" + proxyPassword, Path.Combine(Globals.FD_DesktopPath, "CreatedAccounts.txt")); DataBaseHandler.InsertQuery("Insert into tb_FBAccount values('" + email + "','" + password + "','" + proxyAddress + "','" + proxyPort + "','" + proxyUser + "','" + proxyPassword + "','" + "" + "','" + "" + "','" + AccountStatus.Status(ProfileStatus.AccountCreated) + "')", "tb_FBAccount"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } }
public List<string> UserPins_Repin(string UserName, ref PinInterestUser objPinUser) { List<string> lstUsernamePin = new List<string>(); try { GlobusRegex objGlobusRegex = new GlobusRegex(); GlobusHttpHelper objglobusHttpHelper = new GlobusHttpHelper(); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Start Getting Pins For this User " + UserName + " ]"); string UserPins = string.Empty; if (UserName.Contains("pinterest.com")) { UserUrl = UserName; UserPins = UserName + "pins/"; } else { UserUrl = "https://pinterest.com/" + UserName + "/"; UserPins = "https://pinterest.com/" + UserName + "/pins/"; } try { UserPageSource = objglobusHttpHelper.getHtmlfromUrl(new Uri(UserUrl), "http://pinterest.com/", string.Empty, objPinUser.UserAgent); UserPinPageSource = objglobusHttpHelper.getHtmlfromUrl(new Uri(UserPins), UserUrl, string.Empty, objPinUser.UserAgent); } catch (Exception ex) { } List<string> lst = objGlobusRegex.GetHrefUrlTagsForPinDescription(UserPinPageSource); lst = lst.Distinct().ToList(); string PinUrl = string.Empty; foreach (string item in lst) { try { if (item.Contains("/pin/")) { if (!item.Contains("/pin/A")) { try { int FirstPinPoint = item.IndexOf("/pins/"); int SecondPinPoint = item.IndexOf("class="); PinUrl = Utils.Utils.getBetween(item, "/pin/", "/\" class="); if (!string.IsNullOrEmpty(PinUrl)) { lstUsernamePin.Add(PinUrl); } } catch (Exception ex) { PinUrl = item.Replace("/pins/", ""); lstUsernamePin.Add(PinUrl); } } } } catch (Exception ex) { } } lstUsernamePin = lstUsernamePin.Distinct().ToList(); lstUsernamePin.Reverse(); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Total Pin Urls Collected " + lstUsernamePin.Count + " ]"); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } return lstUsernamePin; }
public List<string> GetUserFollowing(string UserName, int NoOfPage, int FollowingCount) { try { string FollowUrl = string.Empty; string AppVersion = string.Empty; string bookmark = string.Empty; string referer = string.Empty; string User = string.Empty; List<string> followings = new List<string>(); ClGlobul.lstTotalUserScraped.Clear(); List<string> lstFollowing = new List<string>(); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Starting Extraction Of Following For " + UserName + " ]"); GlobusHttpHelper globusHttpHelper = new GlobusHttpHelper(); string TotalFollowingUrl = "https://pinterest.com/" + UserName; string responseFollowingUrl = globusHttpHelper.getHtmlfromUrl(new Uri(TotalFollowingUrl), referer, string.Empty, ""); int TotalFollowing = int.Parse(Utils.Utils.getBetween(responseFollowingUrl, "following_count\":", ",")); int PageCount = TotalFollowing / 12 + 1; for (int i = 1; i <= PageCount; i++) { try { string FollowerPageSource = string.Empty; if (i == 1) { FollowUrl = "http://pinterest.com/" + UserName + "/following/"; FollowerPageSource = globusHttpHelper.getHtmlfromUrl(new Uri(FollowUrl), referer, string.Empty, ""); referer = FollowUrl; } else { FollowUrl = "https://pinterest.com/resource/UserFollowingResource/get/?source_url=%2F" + UserName + "%2Ffollowing%2F&data=%7B%22options%22%3A%7B%22username%22%3A%22" + UserName + "%22%2C%22bookmarks%22%3A%5B%22" + bookmark + "%3D%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App(module%3D%5Bobject+Object%5D)&_=144204352215" + (i - 1); try { FollowerPageSource = globusHttpHelper.getHtmlfromUrlProxy(new Uri(FollowUrl), referer, "", 80, string.Empty, "", ""); } catch { FollowerPageSource = globusHttpHelper.getHtmlfromUrlProxy(new Uri(FollowUrl), "", Convert.ToInt32(""), "", ""); } if (FollowerPageSource.Contains("Whoops! We couldn't find that page.")) { break; } } ///Get App Version if (FollowerPageSource.Contains("app_version") && string.IsNullOrEmpty(AppVersion)) { string[] ArrAppVersion = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "app_version"); if (ArrAppVersion.Count() > 0) { string DataString = ArrAppVersion[ArrAppVersion.Count() - 1]; int startindex = DataString.IndexOf("\": \""); int endindex = DataString.IndexOf("\", \""); AppVersion = DataString.Substring(startindex, endindex - startindex).Replace("\": \"", ""); } } ///get bookmarks value from page /// if (FollowerPageSource.Contains("bookmarks")) { string[] bookmarksDataArr = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "bookmarks"); string Datavalue = string.Empty; if (bookmarksDataArr.Count() > 2) Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 2]; else Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 1]; bookmark = Datavalue.Substring(Datavalue.IndexOf(": [\"") + 4, Datavalue.IndexOf("]") - Datavalue.IndexOf(": [\"") - 5); } try { if (!FollowerPageSource.Contains("No one has followed")) { List<string> lst = objGlobusRegex.GetHrefUrlTags(FollowerPageSource); if (lst.Count == 0) { lst = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "href").ToList(); if (lst.Count() == 1) { lst = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "\"username\":").ToList(); } } foreach (string item in lst) { if (item.Contains("class=\"userWrapper") || item.Contains("class=\\\"userWrapper")) { try { if (item.Contains("\\")) { int FirstPinPoint = item.IndexOf("=\\\"/"); int SecondPinPoint = item.IndexOf("/\\\""); User = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("=", string.Empty).Replace("/", string.Empty).Trim(); } else { int FirstPinPoint = item.IndexOf("href="); int SecondPinPoint = item.IndexOf("class="); User = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\"", string.Empty).Replace("href=", string.Empty).Replace("/", string.Empty).Trim(); } if (followings.Count == FollowingCount) { break; } followings.Add(User); //GlobusLogHelper.log.Info(" => [ " + User + " ]"); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } } if (i > 1) { if (item.Contains("\"request_identifier\":")) { continue; } else { try { User = Utils.Utils.getBetween(item, "\"", "\""); if (User == UserName) { break; } followings.Add(User); //GlobusLogHelper.log.Info(" => [ " + User + " ]"); if (followings.Count == FollowingCount) { break; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } } } } followings = followings.Distinct().ToList(); foreach (string lstdata in followings) { lstFollowing.Add(lstdata); #region AccountReport //string module = "Scraper"; //string status = "Following"; //qm.insertAccReportScrapeUser(module, lstdata, status, DateTime.Now); //objScraperDelegate(); #endregion if (lstFollowing.Count >= maxNoOfRePinCount) { break; } } ClGlobul.lstTotalUserScraped = lstFollowing.Distinct().ToList(); if (ClGlobul.lstTotalUserScraped.Count >= maxNoOfRePinCount) { return ClGlobul.lstTotalUserScraped; } Thread.Sleep(1000); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ No following ]"); break; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); break; } } GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Total Followings : " + ClGlobul.lstTotalUserScraped.Count + " ]"); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } return ClGlobul.lstTotalUserScraped; }
public void StartActionMultithreadRePin(ref PinInterestUser objPinUserRepin, List<string> Usercount) { try { try { lstThreadsRePin.Add(Thread.CurrentThread); lstThreadsRePin.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; PinInterestUser objPinUser = (PinInterestUser)objPinUserRepin; string screen_Name = objPinUser.ScreenName; clsSettingDB db = new clsSettingDB(); if (ObjAccountManager.Boards.Count <= 0) { try { GetBoardsForRepinUpdated(ref objPinUser, screen_Name); //new Thread(() => GetBoardsForRepinUpdated(ref objPinUser, screen_Name)).Start(); // Not returning only Board but Pics also //GetBoardsForRepinUpdated(ref objPinUser, screen_Name); } catch (Exception Ex) { } } if (objPinUser.Boards.Count > 0 || objPinUser.Boards.Count == 0) { Random Boardrnd = new Random(); int BoardNum = 0; try { BoardNum = Boardrnd.Next(0, objPinUser.Boards.Count - 1); } catch (Exception ex) { // GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 1--> " + ex.Message, ApplicationData.ErrorLogFile); } string BoardNumber = string.Empty; try { BoardNum = Boardrnd.Next(0, objPinUser.Boards.Count - 1); BoardNumber = objPinUser.Boards[BoardNum]; } catch (Exception ex) { //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 1--> " + ex.Message, ApplicationData.ErrorLogFile); } int RepinCount = 0; if (!rdbUsePinNo) { try { if (rdbRepinNormalType == true) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Getting Normal Pins From Account ]"); lstAllPins = objLikeManager.GetPins(ref objPinUser, maxNoOfRePinCount); Random Pinrnd = new Random(); ClGlobul.lstPins = lstAllPins.OrderBy(x => Pinrnd.Next()).ToList(); } else { try { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Getting Random Users Pins From Account ]"); string userName = objPinUser.ScreenName; userName = screen_Name; //lstFollowings = objScrape.GetUserFollowing_new(userName, 1, maxNoOfRePinCount);//GetUserFollowing lstFollowings = GetUserFollowing(userName, 1, maxNoOfRePinCount); foreach (string FollowName in lstFollowings) { try { Random rnd = new Random(); int FollowingNum = rnd.Next(0, lstFollowings.Count - 1); FollowingName = lstFollowings[FollowingNum]; ClGlobul.lstPins.Clear(); List<string> lstRepinPin = UserPins_Repin(FollowingName, ref objPinUser); ClGlobul.lstPins.AddRange(lstRepinPin); ClGlobul.lstPins = ClGlobul.lstPins.Distinct().ToList(); if (maxNoOfRePinCount < ClGlobul.lstPins.Count) { break; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } // ClGlobul.lstPins = UserPins_Repin(FollowingName, ref objPinUser); //ClGlobul.lstPins = objLikeManager.GetPins(ref objPinUser, maxNoOfRePinCount); //checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } string Message = string.Empty; string[] lstPinsArray = ClGlobul.lstPins.ToArray(); foreach (string Pin in lstPinsArray) { try { if (NumberHelper.ValidateNumber(Pin)) { try { if (maxNoOfRePinCount == RepinCount) { break; } if (maxNoOfRePinCount >= RepinCount) { Random Messagernd = new Random(); int MessageNum = 0; if (ClGlobul.RepinMessagesList.Count == 2) { try { foreach (var itemMsg in ClGlobul.RepinMessagesList) { if (Message == itemMsg) { continue; } else { Message = itemMsg; break; } } GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Message :" + Message + " ]"); } catch (Exception ex) { } } else if (ClGlobul.RepinMessagesList.Count > 0) { try { MessageNum = Messagernd.Next(0, ClGlobul.RepinMessagesList.Count - 1); Message = ClGlobul.RepinMessagesList[MessageNum].Trim(); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Message :" + Message + " ]"); } catch (Exception ex) { //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 2--> " + ex.Message, ApplicationData.ErrorLogFile); } } try { string NoOfPages = "0";//No use as far as I know try { int index = ClGlobul.lstPins.Where(x => x == Pin).Select(x => ClGlobul.lstPins.IndexOf(x)).Single<int>(); NoOfPages = Convert.ToString(index / 25); } catch { } try { Random rndBoard = new Random(); int NumBoard = rndBoard.Next(0, objPinUser.Boards.Count - 1); BoardNumber = objPinUser.Boards[NumBoard]; } catch (Exception ex) { } string Url = "https://www.pinterest.com/" + objPinUser.ScreenName; if (string.IsNullOrEmpty(oneTimePagesource)) { try { GlobusHttpHelper objHttp = new GlobusHttpHelper(); oneTimePagesource = objHttp.getHtmlfromUrl(new Uri(Url), "", "", ""); } catch { }; } if (arrBoardName == null) { try { arrBoardName = Regex.Split(oneTimePagesource, "board\", \"id\""); } catch { }; } foreach (var itemBoardName in arrBoardName) { try { if (itemBoardName.Contains(BoardNumber))//&&itemBoardName.Contains("board\", \"id\"")) { BoardName = Utils.Utils.getBetween(itemBoardName, "name", "}").Replace(":", "").Replace("\"", "").Trim(); } } catch (Exception ex) { } } BoardName = BoardName.Replace(" ", "-").ToLower().Replace("(", "").Replace(")", "").Replace("!", "").Trim(); bool IsRePined = RepinwithMessage(Pin, Message, BoardNumber, NoOfPages, ref objPinUser); if (IsRePined) { #region AccountReport // string module = "RePin"; // string status = "Repined"; // Qm.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + Pin, "", "", Message, "", "", status, "", "", DateTime.Now); // objRepinDelegate(); #endregion db.insertRePinRecord(objPinUser.Username, objPinUser.Niches, Pin); RepinCount++; try { string CSV_Header = "UserName" + "," + "Pin" + "," + "Message" + "," + "Board Number" + "," + "BoardUrl" + "," + "Date"; string CSV_Data = objPinUser.Username + "," + "https://www.pinterest.com/pin/" + Pin + "," + Message + "," + "Board No. : " + BoardNumber + "," + Url + "/" + BoardName + "," + System.DateTime.Now.ToString(); string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Repin"); PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\Repin.csv"); } catch (Exception ex) { } } else { RepinCount++; } if (rdbDivideGivenByUser_RePin == true) { CountGivenByUser_RePin--; if (CountGivenByUser_RePin < 0) { break; } } int delay = RandomNumberGenerator.GenerateRandom(minDelayRePin, maxDelayRePin); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } catch (Exception ex) { //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 3--> " + ex.Message, ApplicationData.ErrorLogFile); } } } catch (Exception ex) { // GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 4--> " + ex.Message, ApplicationData.ErrorLogFile); } } } catch (Exception ex) { } } } catch (Exception ex) { } } else if (rdbUsePinNo == true) { try { if (ClGlobul.lstRepinUrl.Count < maxNoOfRePinCount) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [Repin Count can't be greater than uploaded Pins.]"); return; } GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining Uploaded Pins ]"); int RepinCount_ListRepin_New = maxNoOfRePinCount; foreach (string RepinUrl in Usercount) { try { if (RepinCount_ListRepin_New <= 0) { break; } //} } catch { }; string NoOfPages = "0"; try { int index = ClGlobul.lstRepinUrl.Where(x => x == RepinUrl).Select(x => ClGlobul.lstRepinUrl.IndexOf(x)).Single<int>(); NoOfPages = Convert.ToString(index / 25); } catch { }; string Message = string.Empty; if (ClGlobul.RepinMessagesList.Count > 1) { Message = ClGlobul.RepinMessagesList[RandomNumberGenerator.GenerateRandom(0, ClGlobul.RepinMessagesList.Count - 1)]; } else if (ClGlobul.RepinMessagesList.Count == 1) { Message = ClGlobul.RepinMessagesList[0]; } else { Message = ""; } Thread.Sleep(1000); bool IsRepinned = RepinwithMessage(RepinUrl.Replace(" ", ""), Message, BoardNumber, NoOfPages, ref objPinUser); if (IsRepinned) { #region AccountReport // string module = "RePin"; // string status = "Repined"; // Qm.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + RepinUrl, "", "", Message, "", "", status, "", "", DateTime.Now); // objRepinDelegate(); #endregion GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repin Pin : " + RepinUrl + " ]"); db.insertRePinRecord(objPinUser.Username, objPinUser.Niches, RepinUrl); RepinCount++; RepinCount_ListRepin_New--; try { string CSV_Header = "UserName" + "," + "RepinUrl" + "," + "Message" + "," + "Board Number" + "," + "Date"; string CSV_Data = objPinUser.Username + "," + "https://www.pinterest.com/pin/" + RepinUrl + "," + Message + "," + "Board No. : " + BoardNumber + "," + System.DateTime.Now.ToString(); string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Repin"); PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\UsePin.csv"); } catch (Exception ex) { } } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Not Repin Pin : " + RepinUrl + " ]"); } int Delay = RandomNumberGenerator.GenerateRandom(minDelayRePin, maxDelayRePin); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Delay for " + Delay + " Seconds ]"); Thread.Sleep(Delay * 1000); } } catch (Exception ex) { }; } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ No Boards Found in Account :" + objPinUser.Username + " ]"); } } } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } finally { RePindata_count--; try { if (countThreadControllerRePin >= NoOfThreadsRePin) { lock (RePinObjThread) { Monitor.Pulse(RePinObjThread); } } } catch (Exception Ex) { } countThreadControllerRePin--; if (RePindata_count == 0 || CountGivenByUser_RePin < 0) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ PROCESS COMPLETED ]"); GlobusLogHelper.log.Info("-------------------------------------------------------------------------------------"); } } }
public void GetBoardsForRepinUpdated(ref PinInterestUser objPinUser, string Username) { try { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Start Getting Boards For User " + Username + " ]"); try { if (string.IsNullOrEmpty(Globals.ItemSelect)) { UserUrl = "http://pinterest.com/" + Username; } else { UserUrl = "http://pinterest.com/" + Username + "/" + Globals.ItemSelect; } GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); string aa = objGlobusHttpHelper.getHtmlfromUrl(new Uri(UserUrl), "", "", objPinUser.UserAgent); string[] Items = Regex.Split(aa, Username); Items = Items.Skip(1).ToArray(); foreach (string item in Items) { try { if (item.Contains("board_id")) { string[] Data = System.Text.RegularExpressions.Regex.Split(item, "board_id");//{"board_id": foreach (string Dataitem in Data) { try { if (Dataitem.Contains("-end-")) { continue; } if (Dataitem.Contains("_1399706961_75.jpg")) { continue; } if (Dataitem.Contains("board_name") || Dataitem.Contains("name\": \"Board") || Dataitem.Contains("anchored\": true")) //"board_name": { try { int LastPoint = Dataitem.IndexOf("board_name");//board_name //Board if (LastPoint <= 0) { LastPoint = Dataitem.IndexOf(","); ac = Dataitem.Substring(0, LastPoint).Replace("\": \"", string.Empty).Replace("\"", "").Replace(", ", string.Empty).Replace("field_set_keygrid_item}}name", string.Empty).Trim(); } else { ac = Dataitem.Substring(0, LastPoint).Replace("\": \"", string.Empty).Replace("\"", "").Replace(", ", string.Empty).Replace("field_set_keygrid_item}}name", string.Empty).Trim(); } if (!objPinUser.Boards.Contains(ac)) { //I have to validate here so that only BoardId gets through if (NumberHelper.ValidateNumber(ac)) { objPinUser.Boards.Add(ac); } } } catch (Exception ex) { } } } catch(Exception ex) { }; }//end of Foreach loop } } catch (Exception ex) { } } objPinUser.Boards.Count(); //objPinUser.Boards.AddRange(Boards); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Get All Boards for User " + objPinUser.Name + " ]"); } catch (Exception ex) { }; } catch (Exception ex) { GlobusLogHelper.log.Error(" => [ Boards Getting Process Failed ]"); } }
public void StartLikePageMultiThreads(object parameters) { try { if (!isStopFanPageLiker) { try { lstThreadsFanPageLiker.Add(Thread.CurrentThread); lstThreadsFanPageLiker.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { Array paramsArray = new object[1]; paramsArray = (Array)parameters; FacebookUser objFacebookUser = (FacebookUser)paramsArray.GetValue(0); if (!objFacebookUser.isloggedin) { GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); objFacebookUser.globusHttpHelper = objGlobusHttpHelper; //Login Process Accounts.AccountManager objAccountManager = new AccountManager(); objAccountManager.LoginUsingGlobusHttp(ref objFacebookUser); } if (objFacebookUser.isloggedin) { // Call LikePage StartFanPageLikerProcess(ref objFacebookUser); } else { GlobusLogHelper.log.Info("Couldn't Login With Username : "******"Couldn't Login With Username : "******"Error : " + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } finally { try { // if (!isStopFanPageLiker) { lock (lockrThreadControllerFanPageLiker) { countThreadControllerFanPageLiker--; Monitor.Pulse(lockrThreadControllerFanPageLiker); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } }
public void PostRemovePendingGroups(object parameter) { try { try { if (IsStop) { return; } if (!IsStop) { lstRemovePendingGroupThread.Add(Thread.CurrentThread); lstRemovePendingGroupThread.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } } catch { } Array paramsArray = new object[1]; paramsArray = (Array)parameter; KeyValuePair <string, LinkedInMaster> item = (KeyValuePair <string, LinkedInMaster>)paramsArray.GetValue(0); GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); LinkedinLogin Login = new LinkedinLogin(); Login.accountUser = item.Key; Login.accountPass = item.Value._Password; Login.proxyAddress = item.Value._ProxyAddress; Login.proxyPort = item.Value._ProxyPort; Login.proxyUserName = item.Value._ProxyUsername; Login.proxyPassword = item.Value._ProxyPassword; GroupStatus obj_GroupStatus = new GroupStatus(); obj_GroupStatus = new GroupStatus(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword); obj_GroupStatus.loggerRemPendingGroup.addToLogger += new EventHandler(GroupStatus_addToLogger); if (!Login.IsLoggedIn) { Login.LoginHttpHelper(ref HttpHelper); } List <string> SelectedItem = new List <string>(); try { if (label1.Text == Login.accountUser) { #region old commented code //if (IsallaccChecked) //{ // try // { // foreach (string SelectedGrp in chkPendingGroup.CheckedItems) // { // foreach (var itemID in LinkdInContacts) // { // if (SelectedGrp.Split(':')[0] == itemID.Key) // { // if (label1.Text == itemID.Key) // { // foreach (KeyValuePair<string, string> itemGid in itemID.Value) // { // if (SelectedGrp.Split(':')[1] == itemGid.Key.Split(':')[1]) // { // try // { // lstPendingGroup.Add(itemGid.Key + ":" + itemGid.Value); // } // catch // { // } // } // } // } // } // } // } // if (lstPendingGroup.Count > 0) // { // try // { // GroupStatus.lstPendingGroup = lstPendingGroup; // } // catch // { // } // } // int minDelay = 20; // int maxDelay = 25; // if (!string.IsNullOrEmpty(txtPendingGroupMinDelay.Text) && NumberHelper.ValidateNumber(txtPendingGroupMinDelay.Text)) // { // minDelay = Convert.ToInt32(txtPendingGroupMinDelay.Text); // } // if (!string.IsNullOrEmpty(txtPendingGroupMaxDelay.Text) && NumberHelper.ValidateNumber(txtPendingGroupMaxDelay.Text)) // { // maxDelay = Convert.ToInt32(txtPendingGroupMaxDelay.Text); // } // string MessagePosted = obj_GroupStatus.PostRemovePendingGroups(Login.accountUser, Login.accountPass, minDelay, maxDelay); // Thread.Sleep(2000); // } // catch // { // } //} //else //{ #endregion try { foreach (string SelectedGrp in chkPendingGroup.CheckedItems) { foreach (var itemID in LinkdInContacts) { foreach (KeyValuePair <string, string> itemGid in itemID.Value) { if (SelectedGrp.Split(':')[1] == itemID.Key) { if (SelectedGrp.Split(':')[0] == itemGid.Key.Split(':')[0]) { try { lstPendingGroup.Add(itemGid.Key + ":" + itemGid.Value); } catch { } } } } } } if (lstPendingGroup.Count > 0) { try { GroupStatus.lstPendingGroup = lstPendingGroup; } catch { } } int minDelay = 20; int maxDelay = 25; if (!string.IsNullOrEmpty(txtPendingGroupMinDelay.Text) && NumberHelper.ValidateNumber(txtPendingGroupMinDelay.Text)) { minDelay = Convert.ToInt32(txtPendingGroupMinDelay.Text); } if (!string.IsNullOrEmpty(txtPendingGroupMaxDelay.Text) && NumberHelper.ValidateNumber(txtPendingGroupMaxDelay.Text)) { maxDelay = Convert.ToInt32(txtPendingGroupMaxDelay.Text); } string MessagePosted = obj_GroupStatus.PostRemovePendingGroups(Login.accountUser, Login.accountPass, minDelay, maxDelay); Thread.Sleep(2000); } catch { } //} } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Pending Groups --> PostRemovePendingGroups() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Pending Groups --> PostRemovePendingGroups() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPendingGroupErrorLogs); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddGroups() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddGroups() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPendingGroupErrorLogs); } finally { counter_PendGroupRemoved--; if (counter_PendGroupRemoved == 0) { if (btnRemovePendingGroup.InvokeRequired) { btnRemovePendingGroup.Invoke(new MethodInvoker(delegate { AddLoggerPendingGroups("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); AddLoggerPendingGroups("------------------------------------------------------------------------------------------------------------------------------------"); btnRemovePendingGroup.Enabled = true; btnRemovePendingGroup.Cursor = Cursors.Default; })); } } } }
public bool ValidateCPUID(ref string statusMessage, string servr, ref string username, ref string password, ref string txnID, ref string email, string freeTrialKey, string cpuID) { //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("UserName: "******" CPUID:" + cpuID, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); try { #region Drct //string cpuID = FetchMacId(); //string SelectQuery = "Select * from users where cpuid='" + cpuID + "'"; //DataSet ds = DataBaseHandler.SelectQuery(SelectQuery, "users"); //if (ds.Tables[0].Rows.Count == 1) //{ // string status = ds.Tables[0].Rows[0]["status"].ToString(); // if (status.ToLower() == "active") // { // statusMessage = "active"; // return true; // } // else if (status.ToLower() == "nonactive") // { // statusMessage = "nonactive"; // return false; // } // else if (status.ToLower() == "suspended") // { // statusMessage = "suspended"; // return false; // } //} #endregion #region Through php //string cpuID = FetchMacId(); //ChilkatHttpHelpr HttpHelpr = new ChilkatHttpHelpr(); HttpHelpr = new GlobusHttpHelper(); #region Servr 1 { string res = string.Empty; string url = "http://" + servr + "/GetUserData.php?cpid=" + cpuID + ""; res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", ""); res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", ""); if (string.IsNullOrEmpty(res)) { System.Threading.Thread.Sleep(1000); res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", ""); } if (!string.IsNullOrEmpty(res)) { string activationstatus = string.Empty; string dateTime = string.Empty; //string username = string.Empty; //string txnID = string.Empty; string trimmed_response = res.Replace("<pre>", "").Replace("</pre>", "").Trim().ToLower(); //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Responce):" + trimmed_response, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); string[] array_status = System.Text.RegularExpressions.Regex.Split(trimmed_response, "<:>"); try { activationstatus = array_status[0].ToLower(); //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Status):" + activationstatus, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt"); } try { dateTime = array_status[1].ToLower(); //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenseDate):" + dateTime, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt"); } try { username = array_status[2].ToLower(); //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Username):" + username, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt"); } try { password = array_status[3].ToLower(); //GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Username):" + username, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt"); } try { txnID = array_status[4].ToLower(); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt"); } try { email = array_status[5].ToLower(); //GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Username):" + username, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt"); } try { Globals.licType = array_status[6].ToLower(); } catch { } if (trimmed_response.ToLower().Contains(freeTrialKey) && ((activationstatus.ToLower() == "active") || (activationstatus.ToLower() == "nonactive"))) { //Globals.IsFreeVersion = true ; if (CheckActivationUpdateStatus(cpuID, dateTime, activationstatus, servr)) { statusMessage = "active"; //servr = "1"; return(true); } else { statusMessage = "trialexpired"; return(false); } if (activationstatus.ToLower() == "active") { statusMessage = "active"; //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Status):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); //servr = "1"; return(true); } else if (activationstatus.ToLower() == "nonactive") { //Update status as Active string url1 = "http://" + servr + "/UpdateStatus.php?cpid=" + cpuID + "&status=" + "Active"; string updateRes = HttpHelpr.getHtmlfromUrl(new Uri(url1), "", "", ""); if (string.IsNullOrEmpty(updateRes)) { System.Threading.Thread.Sleep(1000); updateRes = HttpHelpr.getHtmlfromUrl(new Uri(url1), "", "", ""); } // BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Your Free Version is Activated):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); // MessageBox.Show("Your Free Version is Activated"); return(true); } } else if (activationstatus.ToLower() == "active") { statusMessage = "active"; //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); return(true); // DisableControls(); } else if (activationstatus.ToLower() == "nonactive") { statusMessage = "nonactive"; //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); // MessageBox.Show("Verification of your txn is under process.\n Please wait for your Transaction to be verified.\n Please Contact To Support Team to activate your license, Skype Id Is :- Facedominatorsupport"); return(false); // DisableControls(); } else if (trimmed_response.Contains("trialexpired")) { statusMessage = "trialexpired"; //need to know the naviagtion site : LinkedinDominator.com // BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); // MessageBox.Show("Your 3 Days Trial Version has Expired. Please visit our site: http://linkeddominator.com/ to purchase your License"); return(false); } else if (trimmed_response.ToLower() == "suspended") { statusMessage = "suspended"; //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); return(false); } else if (trimmed_response.Contains("no record found")) { statusMessage = "norecordfound"; //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); return(false); } else { statusMessage = "Some Error in Licensing Server"; //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); return(false); } } else { statusMessage = "ServerDown"; // BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt"); return(false); } } #endregion #endregion } catch (Exception ex) { Console.WriteLine(ex.StackTrace); statusMessage = "Error in License Validation"; Loger("Error in License Validation"); //MessageBox.Show(ex.StackTrace); } return(false); }
private void SummitCaptchaMulti(string captchaText, ref GlobusHttpHelper HttpHelper, string post_form_id, string lsd, string reg_instance, string firstname, string lastname, string reg_email__, string reg_email_confirmation__, string reg_passwd__, string sex, string birthday_month, string birthday_day, string birthday_year, string captcha_persist_data, string captcha_session, string extra_challenge_params, string recaptcha_public_key, string authp_pisg_nonce_tt, string authp, string psig, string nonce, string tt, string time, string challenge, string CaptchaSummit) { captchaText = captchaText.Replace(" ", "%20"); string strUrl = "https://www.facebook.com/ajax/register.php?__a=5&post_form_id=" + post_form_id + "&lsd=" + lsd + "®_instance=" + reg_instance + "&locale=en_US&terms=on&abtest_registration_group=1&referrer=&md5pass=&validate_mx_records=1&ab_test_data=DDAHLDHSSh%2FhZdZLLSDAdZDLLHDODLHHHHADAAAANR%2FmiZKICC%2FHB%2F&firstname=" + firstname + "&lastname=" + lastname + "®_email__=" + reg_email__ + "®_email_confirmation__=" + reg_email_confirmation__ + "®_passwd__=" + reg_passwd__ + "&sex=" + sex + "&birthday_month=" + birthday_month + "&birthday_day=" + birthday_day + "&birthday_year=" + birthday_year + "&captcha_persist_data=" + captcha_persist_data + "&captcha_session=" + captcha_session + "&extra_challenge_params=" + extra_challenge_params + "&recaptcha_type=password&recaptcha_challenge_field=" + challenge + "&captcha_response=" + captchaText + "&__user=0"; string pageSourceSummitCaptcha = HttpHelper.getHtmlfromUrl(new Uri(strUrl)); /// JS, CSS, Image Requests RequestsJSCSSIMG.RequestJSCSSIMG(pageSourceSummitCaptcha, ref HttpHelper); if (!string.IsNullOrEmpty(pageSourceSummitCaptcha) && pageSourceSummitCaptcha.Contains("registration_succeeded")) { AddToListBox("Registration Succeeded"); string res = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/c.php?email=" + reg_email__)); // JS, CSS, Image Requests //RequestsJSCSSIMG.RequestJSCSSIMG(res, ref HttpHelper); } else if (!string.IsNullOrEmpty(pageSourceSummitCaptcha) && pageSourceSummitCaptcha.Contains("It looks like you already have an account on Facebook")) { strUrl = strUrl.Replace("https://www.facebook.com/ajax/register.php?__a=5&post_form_id=", "https://www.facebook.com/ajax/register.php?__a=6&post_form_id="); pageSourceSummitCaptcha = HttpHelper.getHtmlfromUrl(new Uri(strUrl)); string res = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/c.php?email=" + reg_email__)); // JS, CSS, Image Requests //RequestsJSCSSIMG.RequestJSCSSIMG(res, ref HttpHelper); } else if (!string.IsNullOrEmpty(pageSourceSummitCaptcha) && pageSourceSummitCaptcha.Contains("The text you entered didn't match the security check")) { AddToListBox("The text you entered didn't match the security check. Retrying.."); } else if (!string.IsNullOrEmpty(pageSourceSummitCaptcha) && pageSourceSummitCaptcha.Contains("You took too much time")) { AddToListBox("You took too much time in submitting captcha. Retrying.."); } else if (!string.IsNullOrEmpty(pageSourceSummitCaptcha) && pageSourceSummitCaptcha.Contains("to an existing account")) { AddToListBox("This email is associated to an existing account"); } else { AddToListBox("Couldn't create account with " + reg_email__ + ""); } }
/// <summary> /// Gets Next Page URLs as well as End User IDs from Comment /// </summary> /// <param name="jsonRes"></param> /// <param name="PageURL"></param> private void ParseJson_Comments_Next_Phase1(string jsonRes, string PageURL) { try { lstFanPageScraperThreads.Add(Thread.CurrentThread); lstFanPageScraperThreads.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { string jsonData = jsonRes; JObject likes = null; JObject Data = null; try { Data = JObject.Parse(jsonData); likes = (JObject)Data["likes"]; } catch { }; //Paging JObject paging = null;//(JObject)likes["paging"]; if (likes != null) //Get Next Page Node under Likes Node { paging = (JObject)likes["paging"]; } else //If no Likes Node, Get Next Page Node under Data Node { paging = (JObject)Data["paging"]; } //Next URL string next = (string)((JValue)paging["next"]); int startIndx = next.IndexOf("limit=") + "limit=".Length; int endIndx = next.IndexOf("&", startIndx); string limitValueToReplace = "limit=" + next.Substring(startIndx, endIndx - startIndx); next = next.Replace(limitValueToReplace, "limit=1000"); GlobusHttpHelper httpHelper = new GlobusHttpHelper(); string nextRes = httpHelper.getHtmlfromUrlProxy(new Uri(next), "", 80, "", ""); #region Get Next Page Data and IDs and Insert in tb_FbFirstID with Status=0 & Level=1, means End User ID JObject nextData = JObject.Parse(nextRes); JArray array_data = (JArray)nextData["data"]; foreach (var item in array_data) { try { JObject objData_Node = JObject.Parse(item.ToString()); JValue jVaule_id = (JValue)objData_Node["id"]; string str_id = jVaule_id.ToString().Replace("\"", ""); try { string queryResponse = string.Empty; //qm.AddFirstID(str_id, "0", "1", System.DateTime.Now.ToString(), PageURL, ref queryResponse); DataSet ds = new DataSet(); RaiseEvent(ds, new string[] { "Model : FanPagePostRepository", "Function : InsertChasngeLevel", str_id, "0", "1", System.DateTime.Now.ToString(), PageURL, queryResponse }); if (queryResponse.Contains("locked")) { Thread.Sleep(1000); // QueryManager myQueryManager = new QueryManager(); //myQueryManager.AddFirstID(str_id, "0", "1", System.DateTime.Now.ToString(), PageURL, ref queryResponse); RaiseEvent(ds, new string[] { "Model : FanPagePostRepository", "Function : InsertChasngeLevel", str_id, "0", "1", System.DateTime.Now.ToString(), PageURL, queryResponse }); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } #endregion #region Unused if (nextRes.Contains("\"data\":")) { try { string status = "1"; //QueryManager query = new QueryManager(); try { // query.AddFirstID_Graph(next, "0", "0", DateTime.Now.ToString(), PageURL); DataSet ds = new DataSet(); RaiseEvent(ds, new string[] { "Model : FanPagePostRepository", "Function : Insert", next, "0", "0", System.DateTime.Now.ToString(), PageURL }); GlobusLogHelper.log.Info("FbId Next Page Url : " + next); GlobusLogHelper.log.Debug("FbId Next Page Url : " + next); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } else { string status = "0"; try { //DataBaseHandler.InsertQuery("Insert into Tb_NextPage(id,NextPageUrl,Status,Date,MainPageUrl) values('" + 0 + "','" + next + "','" + "0" + "','" + System.DateTime.Now.ToString() + "','" + PageURL + "','" + PageURL + "')", "Tb_NextPage"); //QueryManager query = new QueryManager(); //query.AddFirstID_Graph(next, status, "0", DateTime.Now.ToString(), PageURL); //DataBaseHandler.InsertQuery("Insert into Tb_NextPage(id,NextPageUrl,Status,Date,MainPageUrl) values('" + 0 + "','" + next + "','" + "0" + "','" + System.DateTime.Now.ToString() + "','" + PageURL + "','" + PageURL + "')", "Tb_NextPage"); DataSet ds = new DataSet(); RaiseEvent(ds, new string[] { "Model : FanPagePostRepository", "Function : Insert", next, status, "0", System.DateTime.Now.ToString(), PageURL }); GlobusLogHelper.log.Info("FbId Next Page Url : " + next); GlobusLogHelper.log.Debug("FbId Next Page Url : " + next); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } #endregion } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
private void ThreadPoolMethod(object parameters) { try { //string email = (string)parameters; Array paramsArray = new object[2]; paramsArray = (Array)parameters; string email = (string)paramsArray.GetValue(0); int count_Names = (int)paramsArray.GetValue(1); GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); string post_form_id = string.Empty; string lsd = string.Empty; string reg_instance = string.Empty; string firstname = string.Empty; string lastname = string.Empty; string reg_email__ = string.Empty; string reg_email_confirmation__ = string.Empty; string reg_passwd__ = string.Empty; string sex = string.Empty; string birthday_month = string.Empty; string birthday_day = string.Empty; string birthday_year = string.Empty; string captcha_persist_data = string.Empty; string captcha_session = string.Empty; string extra_challenge_params = string.Empty; string recaptcha_public_key = string.Empty; string authp_pisg_nonce_tt = null; string authp = string.Empty; string psig = string.Empty; string nonce = string.Empty; string tt = string.Empty; string time = string.Empty; string challenge = string.Empty; string CaptchaSummit = string.Empty; string Email = string.Empty; string Password = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUsername = string.Empty; string proxyPassword = string.Empty; try { Email = email.Split(':')[0]; Password = email.Split(':')[1]; firstname = listFirstName[count_Names]; lastname = listLastName[count_Names]; } catch (Exception ex){ AddToListBox(ex.Message); } AddToListBox("Creating Account with " + Email); string responseMessage = string.Empty; string captchaSrcMulti = string.Empty; #region Commented // captchaSrcMulti = GetCaptchaImageMulti(email, ref HttpHelper, ref post_form_id, ref lsd, //ref reg_instance, //ref firstname, //ref lastname, //ref reg_email__, //ref reg_email_confirmation__, //ref reg_passwd__, //ref sex, //ref birthday_month, //ref birthday_day, //ref birthday_year, //ref captcha_persist_data, //ref captcha_session, //ref extra_challenge_params, //ref recaptcha_public_key, //ref authp_pisg_nonce_tt, //ref authp, //ref psig, //ref nonce, //ref tt, //ref time, //ref challenge, //ref CaptchaSummit); // if (email.Split(':').Length > 5) // { // proxyAddress = email.Split(':')[2]; // proxyPort = email.Split(':')[3]; // proxyUsername = email.Split(':')[4]; // proxyPassword = email.Split(':')[5]; // //AddToListBox("Setting proxy " + proxyAddress + ":" + proxyPort); // } // else if (email.Split(':').Length == 4) // { // //MessageBox.Show("Private proxies not loaded with emails \n Accounts will be created with public proxies"); // proxyAddress = email.Split(':')[2]; // proxyPort = email.Split(':')[3]; // } #endregion GetCaptchaImageMultiModified(email, ref HttpHelper, ref post_form_id, ref lsd, ref reg_instance, ref firstname, ref lastname, ref reg_email__, ref reg_email_confirmation__, ref reg_passwd__, ref sex, ref birthday_month, ref birthday_day, ref birthday_year, ref captcha_persist_data, ref captcha_session, ref extra_challenge_params, ref recaptcha_public_key, ref authp_pisg_nonce_tt, ref authp, ref psig, ref nonce, ref tt, ref time, ref challenge, ref CaptchaSummit); if (email.Split(':').Length > 5) { proxyAddress = email.Split(':')[2]; proxyPort = email.Split(':')[3]; proxyUsername = email.Split(':')[4]; proxyPassword = email.Split(':')[5]; //AddToListBox("Setting proxy " + proxyAddress + ":" + proxyPort); } else if (email.Split(':').Length == 4) { //MessageBox.Show("Private proxies not loaded with emails \n Accounts will be created with public proxies"); proxyAddress = email.Split(':')[2]; proxyPort = email.Split(':')[3]; } //if (!string.IsNullOrEmpty(captchaSrcMulti)) //{ #region Old Captcha Method // if (UseDBC) // { // System.Net.WebClient webClient = new System.Net.WebClient(); // byte[] imageBytes = webClient.DownloadData(captchaSrcMulti); // //Getting Captcha Text // string captchaText = DecodeDBC(new string[] { Globals.DBCUsername, Globals.DBCPassword, "" }, imageBytes); // if (!string.IsNullOrEmpty(captchaText)) // { // SummitCaptchaMulti(captchaText, ref HttpHelper, post_form_id, lsd, //reg_instance, //firstname, //lastname, //reg_email__, //reg_email_confirmation__, //reg_passwd__, //sex, //birthday_month, //birthday_day, //birthday_year, //captcha_persist_data, //captcha_session, //extra_challenge_params, //recaptcha_public_key, //authp_pisg_nonce_tt = null, //authp, //psig, //nonce, //tt, //time, //challenge, //CaptchaSummit); // } // else // { // AddToListBox("Captcha text NULL for : " + Email); // } // } // else if (UseDeCaptcher) // { // DownloadImageViaWebClient(captchaSrcMulti, Email.Split('@')[0]); // System.Threading.Thread.Sleep(15000); // //Getting Captcha Text using Decaptcher // string Captchatext = decaptcha(decaptchaImagePath + "\\decaptcha" + Email.Split('@')[0]); // try // { // File.Delete(decaptchaImagePath + "\\decaptcha" + Email.Split('@')[0]); // } // catch (Exception) { } // if (!string.IsNullOrEmpty(Captchatext)) // { // SummitCaptchaMulti(Captchatext, ref HttpHelper, post_form_id, lsd, //reg_instance, //firstname, //lastname, //reg_email__, //reg_email_confirmation__, //reg_passwd__, //sex, //birthday_month, //birthday_day, //birthday_year, //captcha_persist_data, //captcha_session, //extra_challenge_params, //recaptcha_public_key, //authp_pisg_nonce_tt = null, //authp, //psig, //nonce, //tt, //time, //challenge, //CaptchaSummit); // } // else // { // AddToListBox("Captcha text NULL for : " + Email); // } // } #endregion //string url_Registration = "https://www.facebook.com/ajax/register.php?__a=5&post_form_id=" + post_form_id + "&lsd=" + lsd + "®_instance=" + reg_instance + "&locale=en_US&terms=on&abtest_registration_group=1&referrer=&md5pass=&validate_mx_records=1&asked_to_login=0&ab_test_data=&firstname=" + firstname + "&lastname=" + lastname + "®_email__=" + reg_email__ + "®_email_confirmation__=" + reg_email_confirmation__ + "®_passwd__=" + reg_passwd__ + "&sex=" + sex + "&birthday_month=" + birthday_month + "&birthday_day=" + birthday_day + "&birthday_year=" + birthday_year + "&captcha_persist_data=" + captcha_persist_data + "&captcha_session=" + captcha_session + "&extra_challenge_params=" + extra_challenge_params + "&recaptcha_type=password&recaptcha_challenge_field=" + challenge + "&captcha_response=" + "" + "&ignore=captcha|pc&__user=0"; string url_Registration = "https://www.facebook.com/ajax/register.php?__a=4&post_form_id=" + post_form_id + "&lsd=" + lsd + "®_instance=" + reg_instance + "&locale=en_US&terms=on&abtest_registration_group=1&referrer=&md5pass=&validate_mx_records=1&asked_to_login=0&ab_test_data=AAAAAAAAAAAA%2FA%2FAAAAA%2FAAAAAAAAAAAAAAAAAAAA%2FAA%2FfAAfABAAD&firstname=" + firstname + "&lastname=" + lastname + "®_email__=" + reg_email__ + "®_email_confirmation__=" + reg_email_confirmation__ + "®_passwd__=" + reg_passwd__ + "&sex=" + sex + "&birthday_month=" + birthday_month + "&birthday_day=" + birthday_day + "&birthday_year=" + birthday_year + "&captcha_persist_data=" + captcha_persist_data + "&captcha_session=" + captcha_session + "&extra_challenge_params=" + extra_challenge_params + "&recaptcha_type=password&captcha_response=" + "" + "&ignore=captcha%7Cpc&__user=0"; string res_Registration = HttpHelper.getHtmlfromUrl(new Uri(url_Registration)); //reg_passwd__ = Uri.UnescapeDataString(reg_passwd__); FinishRegistrationMultiThreaded(res_Registration, Email, Password, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref HttpHelper); //} } catch (Exception ex) { AddToListBox(ex.Message); } }
public void UnFollowBack(ref InstagramUser Gram_Obj) { try { lstThreadsunFollowerbackPoster.Add(Thread.CurrentThread); lstThreadsunFollowerbackPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } DataSet ds = null; int days = No_Days_To_Unfollow; try { ds = Qm.SelectFollowUser("Followed", Gram_Obj.username); DataTable firstTable = ds.Tables[0]; if(firstTable.Rows.Count==0) { GlobusLogHelper.log.Info("!! Inputed Days you Enter at that Days you not Follow Any user Thourgh This Bot !!"); return; } foreach (DataRow dRow in firstTable.Rows) { string following_username = dRow["FollowTime"].ToString() + ""; string follow_Username = dRow["FollowingUser"].ToString() + ""; DateTime dt = DateTime.Parse(following_username); TimeSpan tsDays = DateTime.Now.Date.Subtract(dt.Date); if (tsDays.TotalDays <= days) { lst_UnfollowUser.Add(follow_Username); lst_UnfollowUser = lst_UnfollowUser.Distinct().ToList(); } } GlobusHttpHelper obj_globalus = new GlobusHttpHelper(); #region Scrape Follower string gramfeed_user_Url = "http://www.gramfeed.com/" + Gram_Obj.username; List<string> follower_list = new List<string>(); int count = 0; ClGlobul.switchAccount = false; string GramFeed_Userhit = obj_globalus.getHtmlfromUrl(new Uri(gramfeed_user_Url), ""); string client_Id = Utils.getBetween(GramFeed_Userhit, "client_id=", "&"); string Id_Url = "https://api.instagram.com/v1/users/search?q=" + Gram_Obj.username + "&client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; string Gram_Hit_second = obj_globalus.getHtmlfromUrl(new Uri(Id_Url), ""); if (string.IsNullOrEmpty(Gram_Hit_second)) { Gram_Hit_second = obj_ChangeProxy.chnageproxyMethod(Id_Url); } string GramFeed_UserId = Utils.getBetween(Gram_Hit_second, "id\":", "\",").Replace(" ","").Replace("\"",""); string Follower_Url = "https://api.instagram.com/v1/users/" + GramFeed_UserId + "/followed-by?client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; string GramFeed_UserFollower = obj_globalus.getHtmlfromUrl(new Uri(Follower_Url), ""); if(string.IsNullOrEmpty(GramFeed_UserFollower)) { GramFeed_UserFollower = obj_ChangeProxy.chnageproxyMethod(Follower_Url); } string[] follower_regexlist = Regex.Split(GramFeed_UserFollower, "username"); foreach (string item in follower_regexlist) { if (item.Contains("profile_picture")) { string user_name = Utils.getBetween(item, "\":\"", "\""); if (!lst_Follower_unfollowback.Contains(user_name)) { lst_Follower_unfollowback.Add(user_name); lst_Follower_unfollowback = lst_Follower_unfollowback.Distinct().ToList(); } else { break; } } } if (GramFeed_UserFollower.Contains("next_url")) { value = true; while (value) { if (GramFeed_UserFollower.Contains("next_url")) { string hit_data = Utils.getBetween(GramFeed_UserFollower, "next_url\":\"", "\",").Replace("\u0026", "&").Replace("\\", "").Replace("u0026", "&"); GramFeed_UserFollower = obj_globalus.getHtmlfromUrl(new Uri(hit_data), ""); string[] follower_regexlist2 = Regex.Split(GramFeed_UserFollower, "username"); foreach (string item in follower_regexlist2) { if (item.Contains("profile_picture")) { string user_name = Utils.getBetween(item, "\":\"", "\""); if (!lst_Follower_unfollowback.Contains(user_name)) { lst_Follower_unfollowback.Add(user_name); lst_Follower_unfollowback = lst_Follower_unfollowback.Distinct().ToList(); } else { break; } } } //if (minDelayUnFollowerBack != 0) //{ // mindelay = minDelayUnFollowerBack; //} //if (maxDelayUnFollowerBack != 0) //{ // maxdelay = maxDelayUnFollowerBack; //} // delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); //GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds "); //Thread.Sleep(delay * 1000); } else { value = false; } } } #endregion #region UnfollowBack Process try { int Sum = 0; foreach (string item in lst_UnfollowUser) { string resp_test = Gram_Obj.globusHttpHelper.getHtmlfromUrl(new Uri("http://www.Instagram.com/" + item)); if (!lst_Follower_unfollowback.Contains(item)) { if (resp_test.Contains("followed_by_viewer\":false") || resp_test.Contains("requested_by_viewer\":false")) { Sum++; IsunfollowBack = true; unfollowAccount(ref Gram_Obj, item, Sum); Qm.DeleteunfollowUser(item); if (minDelayUnFollowerBack != 0) { mindelay = minDelayUnFollowerBack; } if (maxDelayUnFollowerBack != 0) { maxdelay = maxDelayUnFollowerBack; } Random rn = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = rn.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } else { if(resp_test.Contains("followed_by_viewer\":true") || resp_test.Contains("requested_by_viewer\":true")) { GlobusLogHelper.log.Info(item+ "--> Start Follow -->" +Gram_Obj.username); } } } else { // User Follow Back to You. } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } #endregion } catch(Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } GlobusLogHelper.log.Info(" ---Process Completed--- "); }
private void FinishRegistrationMultiThreaded(string responseRegistration, string email, string password, string proxyAddress, string proxyPort, string proxyUser, string proxyPassword, ref GlobusHttpHelper HttpHelper) { if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("registration_succeeded")) { AddToListBox("Registration Succeeded"); try { string res = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/c.php?email=" + email)); /// JS, CSS, Image Requests RequestsJSCSSIMG.RequestJSCSSIMG(res, ref HttpHelper); } catch { }; VerifiyAccountMultiThreaded(email, password, proxyAddress, proxyPort, proxyUser, proxyPassword, ref HttpHelper); } //else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("It looks like you already have an account on Facebook")) else { AddToListBox("It looks like you already have an account on Facebook"); try { string res = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/c.php?email=" + email)); /// JS, CSS, Image Requests RequestsJSCSSIMG.RequestJSCSSIMG(res, ref HttpHelper); } catch { }; VerifiyAccountMultiThreaded(email, password, proxyAddress, proxyPort, proxyUser, proxyPassword, ref HttpHelper); } #region Old Code //else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("The text you entered didn't match the security check")) //{ // //AddToListBox("The text you entered didn't match the security check. Retrying.."); // //accountCounter--; //Decrement Counter as it'll be incremented in next line => GoToNextAccount() // ////And we don't want to switch the account now // //GoToNextAccount(); //} //else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("You took too much time")) //{ // //AddToListBox("You took too much time in submitting captcha. Retrying.."); // //accountCounter--; //Decrement Counter as it'll be incremented in next line => GoToNextAccount() // ////And we don't want to switch the account now // //GoToNextAccount(); //} //else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("to an existing account")) //{ // //AddToListBox("This email is associated to an existing account"); // //accountCounter--; //Decrement Counter as it'll be incremented in next line => GoToNextAccount() // ////And we don't want to switch the account now // //GoToNextAccount(); //} //else //{ // if (retryCounter <= 2) // { // ////AddToListBox("Error in submitting captcha. Retrying.."); // //accountCounter--; //Decrement Counter as it'll be incremented in next line => GoToNextAccount() // //And we don't want to switch the account now // ////GoToNextAccount(); // } // else // { // //retryCounter = 0; //Reset the retryCounter as we're switching account now // //AddToListBox("Couldn't create account with " + Email + "---Switching to next account"); // //GoToNextAccount(); // } //} #endregion }
public void FollowOperationequal(string Acc, string[] Hash) { string status = string.Empty; string[] arrAcc = Regex.Split(Acc, ":"); InstagramUser objInstagramUser = new InstagramUser(arrAcc[0], arrAcc[1], arrAcc[2], arrAcc[3]); GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); objInstagramUser.globusHttpHelper = objGlobusHttpHelper; AccountManager objAccountManager = new AccountManager(); if (!objInstagramUser.isloggedin) { status = objAccountManager.LoginUsingGlobusHttp(ref objInstagramUser); } if (status == "Success" || (objInstagramUser.isloggedin)) { foreach (string itemHash in Hash) { if (!string.IsNullOrEmpty(itemHash)) { //Operation string[] Data_ID = Regex.Split(itemHash, ","); string daaa = objInstagramUser.username; foreach (string Photo_ID in Data_ID) { if (!string.IsNullOrEmpty(Photo_ID)) { FollowUrls(ref objInstagramUser, Photo_ID); } else { break; } if (minDelayFollowerPoster != 0) { mindelay = minDelayFollowerPoster; } if (maxDelayFollowerPoster != 0) { maxdelay = maxDelayFollowerPoster; } Random obj_rn = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = obj_rn.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } } GlobusLogHelper.log.Info("========================="); GlobusLogHelper.log.Info("Process Completed !!!"); GlobusLogHelper.log.Info("========================="); } } }
/// <summary> /// Makes Http Request to Confirmation URL from Mail, also requests other JS, CSS URLs /// </summary> /// <param name="ConfirmationUrl"></param> /// <param name="gif"></param> /// <param name="logpic"></param> public void EmailVerificationMultithreaded(string ConfirmationUrl, string gif, string logpic, string email, string password, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref GlobusHttpHelper HttpHelper) { int intProxyPort = 80; Regex IdCheck = new Regex("^[0-9]*$"); if (!string.IsNullOrEmpty(proxyPort) && IdCheck.IsMatch(proxyPort)) { intProxyPort = int.Parse(proxyPort); } string pgSrc_ConfirmationUrl = HttpHelper.getHtmlfromUrlProxy(new Uri(ConfirmationUrl), proxyAddress, intProxyPort, proxyUsername, proxyPassword); string valueLSD = "name=" + "\"lsd\""; string pgSrc_Login = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php")); int startIndex = pgSrc_Login.IndexOf(valueLSD) + 18; string value = pgSrc_Login.Substring(startIndex, 5); //Log("Logging in with " + Username); string ResponseLogin = HttpHelper.postFormDataProxy(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + email.Split('@')[0] + "%40" + email.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "", proxyAddress, intProxyPort, proxyUsername, proxyPassword); pgSrc_ConfirmationUrl = HttpHelper.getHtmlfromUrl(new Uri(ConfirmationUrl)); try { string pgSrc_Gif = HttpHelper.getHtmlfromUrl(new Uri(gif)); } catch { } try { string pgSrc_Logpic = HttpHelper.getHtmlfromUrl(new Uri(logpic + "&s=a")); } catch { } try { string pgSrc_Logpic = HttpHelper.getHtmlfromUrl(new Uri(logpic)); } catch { } //** User Id ***************////////////////////////////////// string UsreId = string.Empty; if (string.IsNullOrEmpty(UsreId)) { UsreId = GlobusHttpHelper.ParseJson(ResponseLogin, "user"); } //*** Post Data **************////////////////////////////////// string fb_dtsg = GlobusHttpHelper.GetParamValue(ResponseLogin, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8); if (string.IsNullOrEmpty(fb_dtsg)) { fb_dtsg = GlobusHttpHelper.ParseJson(ResponseLogin, "fb_dtsg"); } string post_form_id = GlobusHttpHelper.GetParamValue(ResponseLogin, "post_form_id");//pageSourceHome.Substring(pageSourceHome.IndexOf("post_form_id"), 200); if (string.IsNullOrEmpty(post_form_id)) { post_form_id = GlobusHttpHelper.ParseJson(ResponseLogin, "post_form_id"); } string pgSrc_email_confirmed = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/?email_confirmed=1")); string pgSrc_contact_importer = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=contact_importer")); #region Skipping Code ///Code for skipping additional optional Page try { string phstamp = "165816812085115" + RandomNumberGenerator.GenerateRandom(10848130, 10999999); string postDataSkipFirstStep = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=friend_requests&next_step_name=contact_importer&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp; string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), postDataSkipFirstStep); Thread.Sleep(1000); } catch { } pgSrc_contact_importer = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=contact_importer")); //** FB Account Check email varified or not ***********************************************************************************// #region FB Account Check email varified or not //string pageSrc1 = string.Empty; string pageSrc2 = string.Empty; string pageSrc3 = string.Empty; string pageSrc4 = string.Empty; string substr1 = string.Empty; //if (pgSrc_contact_importer.Contains("Are your friends already on Facebook?") && pgSrc_contact_importer.Contains("Skip this step")) if (true) { string phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954); string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=contact_importer&next_step_name=classmates_coworkers&previous_step_name=friend_requests&skip=Skip%20this%20step&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + ""; string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData); pgSrc_contact_importer = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers")); Thread.Sleep(1000); //pgSrc_contact_importer = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=classmates_coworkers")); } //if ((pgSrc_contact_importer.Contains("Fill out your Profile Info") || pgSrc_contact_importer.Contains("Fill out your Profile info")) && pgSrc_contact_importer.Contains("Skip")) if (true) { string phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954); string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer¤t_pane=info&hs[school][id][0]=&hs[school][text][0]=&hs[start_year][text][0]=-1&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[start_year][text][0]=-1&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + ""; string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData); ///Post Data Parsing Dictionary<string, string> lstfriend_browser_id = new Dictionary<string, string>(); string[] initFriendArray = Regex.Split(postRes, "FriendStatus.initFriend"); int tempCount = 0; foreach (string item in initFriendArray) { if (tempCount == 0) { tempCount++; continue; } if (tempCount > 0) { int startIndx = item.IndexOf("(\\") + "(\\".Length + 1; int endIndx = item.IndexOf("\\", startIndx); string paramValue = item.Substring(startIndx, endIndx - startIndx); lstfriend_browser_id.Add("friend_browser_id[" + (tempCount - 1) + "]=", paramValue); tempCount++; } } string partPostData = string.Empty; foreach (var item in lstfriend_browser_id) { partPostData = partPostData + item.Key + item.Value + "&"; } phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954); string newPostData1 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer¤t_pane=pymk&hs[school][id][0]=&hs[school][text][0]=&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&" + partPostData + "phstamp=" + phstamp + "";//"post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer¤t_pane=pymk&friend_browser_id[0]=100002869910855&friend_browser_id[1]=100001857152486&friend_browser_id[2]=575678600&friend_browser_id[3]=100003506761599&friend_browser_id[4]=563402235&friend_browser_id[5]=1268675170&friend_browser_id[6]=1701838026&friend_browser_id[7]=623640106&friend_browser_id[8]=648873235&friend_browser_id[9]=100000151781814&friend_browser_id[10]=657007597&friend_browser_id[11]=1483373867&friend_browser_id[12]=778266161&friend_browser_id[13]=1087830021&friend_browser_id[14]=100001333876108&friend_browser_id[15]=100000534308531&friend_browser_id[16]=1213205246&friend_browser_id[17]=45608778&friend_browser_id[18]=100003080150820&friend_browser_id[19]=892195716&friend_browser_id[20]=100001238774509&friend_browser_id[21]=45602360&friend_browser_id[22]=100000054900916&friend_browser_id[23]=100001308090108&friend_browser_id[24]=100000400766182&friend_browser_id[25]=100001159247338&friend_browser_id[26]=1537081666&friend_browser_id[27]=100000743261988&friend_browser_id[28]=1029373920&friend_browser_id[29]=1077680976&friend_browser_id[30]=100000001266475&friend_browser_id[31]=504487658&friend_browser_id[32]=82600225&friend_browser_id[33]=1023509811&friend_browser_id[34]=100000128061486&friend_browser_id[35]=100001853125513&friend_browser_id[36]=576201748&friend_browser_id[37]=22806492&friend_browser_id[38]=100003232772830&friend_browser_id[39]=1447942875&friend_browser_id[40]=100000131241521&friend_browser_id[41]=100002076794734&friend_browser_id[42]=1397169487&friend_browser_id[43]=1457321074&friend_browser_id[44]=1170969536&friend_browser_id[45]=18903839&friend_browser_id[46]=695329369&friend_browser_id[47]=1265734280&friend_browser_id[48]=698096805&friend_browser_id[49]=777678515&friend_browser_id[50]=529685319&hs[school][id][0]=&hs[school][text][0]=&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user=100003556207009&phstamp=1658167541109987992266"; string postRes1 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData1); pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic")); Thread.Sleep(1000); //pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic")); string image_Get = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/images/wizard/nuxwizard_profile_picture.gif")); try { phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954); string newPostData2 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step=upload_profile_pic&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + ""; string postRes2 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData2); } catch { } try { phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954); string newPostData3 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step=upload_profile_pic&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&submit=Save%20%26%20Continue&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + ""; string postRes3 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData3); } catch { } } if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip")) { string phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954); string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + ""; try { string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData); pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=summary")); pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php?ref=wizard")); } catch { } } #endregion if (pageSrc3.Contains("complete the sign-up process")) { } if (pgSrc_contact_importer.Contains("complete the sign-up process")) { } #endregion ////**Post Message For User***********************///////////////////////////////////////////////////// try { string pageSourceHome = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php")); if (pageSourceHome.Contains("complete the sign-up process")) { Console.WriteLine("Account is not verified for : " + email); } else { } } catch { } AddToListBox("Email verification completed for : " + email); //LoggerVerify("Email verification completed for : " + Email); }
public void Start_Action_UserFollower(ref InstagramUser obj_Gram) { try { lstThreadsUserFollower.Add(Thread.CurrentThread); lstThreadsUserFollower.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { string[] lst_UserFollower_listedUser = ClGlobul.lstUserFollower_Username.ToArray(); GlobusHttpHelper obj_globul = new GlobusHttpHelper(); bool value = false; string proxyAddress = string.Empty; string proxyport = "80"; string proxyusername = string.Empty; string proxypasswrd = string.Empty; List<string> lst_workingfinalproxy = new List<string>(); string[] lst_Userfollowerlist = {}; try { DataSet ds = DataBaseHandler.SelectQuery("select * from tlb_WorkingProxy", "tlb_WorkingProxy"); DataTable dt = ds.Tables[0]; foreach (DataRow item in dt.Rows) { lst_workingfinalproxy.Add(item[1] + ":" + item[2] + ":" + item[3] + ":" + item[4]); } } catch (Exception ex) { } try { if (lst_workingfinalproxy.Count > 0) { string res_secondURL = obj_Gram.globusHttpHelper.getHtmlfromUrl_withProxt(new Uri("https://www.instagram.com"), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); string proxy = lst_workingfinalproxy[RandomNumberGenerator.GenerateRandom(0, lst_workingfinalproxy.Count)]; string[] proxydata = Regex.Split(proxy, ":"); if (proxydata.Count() == 2) { proxyAddress = proxydata[0]; proxyport = proxydata[1]; } if (proxydata.Count() == 4) { proxyAddress = proxydata[0]; proxyport = proxydata[1]; proxyusername = proxydata[2]; proxypasswrd = proxydata[3]; } } } catch (Exception ex) { } foreach(string username in lst_UserFollower_listedUser) { string gramfeed_user_Url = "http://www.gramfeed.com/" + username; // Username_ScrapFollower = itemusername; List<string> follower_list = new List<string>(); int count = 0; ClGlobul.switchAccount = false; string GramFeed_Userhit = obj_globul.getHtmlfromUrl_withProxt(new Uri(gramfeed_user_Url), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); string client_Id = Utils.getBetween(GramFeed_Userhit, "client_id=", "&"); string Id_Url = "https://api.instagram.com/v1/users/search?q=" + username + "&client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; string Gram_Hit_second = obj_globul.getHtmlfromUrl_withProxt(new Uri(Id_Url), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); if (string.IsNullOrEmpty(Gram_Hit_second)) { Thread.Sleep(1 * 3000); Gram_Hit_second = obj_ChangeProxy.chnageproxyMethod(Id_Url); } string GramFeed_UserId = Utils.getBetween(Gram_Hit_second, "\"id\":", "\",").Replace("\"", "").Replace(" ", ""); string Follower_Url = "https://api.instagram.com/v1/users/" + GramFeed_UserId + "/followed-by?client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; string GramFeed_UserFollower = obj_globul.getHtmlfromUrl_withProxt(new Uri(Follower_Url), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); if (string.IsNullOrEmpty(GramFeed_UserFollower)) { if (lst_workingfinalproxy.Count > 0) { GramFeed_UserFollower = obj_ChangeProxy.chnageproxyMethod(Follower_Url); } else { Thread.Sleep(1 * 3000); GramFeed_UserFollower = obj_globul.getHtmlfromUrl_withProxt(new Uri(Follower_Url), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); } } string[] follower_regexlist = Regex.Split(GramFeed_UserFollower, "username"); foreach (string item in follower_regexlist) { if (item.Contains("profile_picture")) { string user_name = Utils.getBetween(item, "\":", "\",").Replace("\"", "").Replace(" ", ""); if (follower_list.Count < Number_Follower && !follower_list.Contains(user_name)) { follower_list.Add(user_name); follower_list = follower_list.Distinct().ToList(); ClGlobul.lst_follower_UserFollower.Add(user_name); count++; try { GlobusLogHelper.log.Info(obj_Gram.username +" --> Scraped ===> " + user_name); } catch (Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } } else { break; } } } if (UserFollower_Delaymin != 0) { mindelay = UserFollower_Delaymin; } if (UserFollower_Delaymax != 0) { maxdelay = UserFollower_Delaymax; } int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds "); Thread.Sleep(delay * 1000); if (GramFeed_UserFollower.Contains("next_url")) { value = true; while (value) { if (GramFeed_UserFollower.Contains("next_url") && follower_list.Count < Number_Follower) { string hit_data = Utils.getBetween(GramFeed_UserFollower, "next_url\":", "\",").Replace("\u0026", "&").Replace("\\", "").Replace("u0026", "&").Replace("\"", "").Replace(" ", ""); GramFeed_UserFollower = obj_globul.getHtmlfromUrl_withProxt(new Uri(hit_data), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); if (string.IsNullOrEmpty(GramFeed_UserFollower)) { if (lst_workingfinalproxy.Count > 0) { GramFeed_UserFollower = obj_ChangeProxy.chnageproxyMethod(hit_data); } else { Thread.Sleep(1 * 3000); GramFeed_UserFollower = obj_globul.getHtmlfromUrl_withProxt(new Uri(Follower_Url), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); } } string[] follower_regexlist2 = Regex.Split(GramFeed_UserFollower, "username"); foreach (string item in follower_regexlist2) { if (item.Contains("profile_picture")) { string user_name = Utils.getBetween(item, "\":", "\",").Replace("\"", "").Replace(" ", ""); if (follower_list.Count < Number_Follower && !follower_list.Contains(user_name)) { follower_list.Add(user_name); follower_list = follower_list.Distinct().ToList(); ClGlobul.lst_follower_UserFollower.Add(user_name); try { GlobusLogHelper.log.Info(obj_Gram.username + " --> Scraped ===> " + user_name); } catch (Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } } else { break; } } } if (UserFollower_Delaymin != 0) { mindelay = UserFollower_Delaymin; } if (UserFollower_Delaymax != 0) { maxdelay = UserFollower_Delaymax; } delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds For "); Thread.Sleep(delay * 1000); } else { value = false; } } } // lst_Userfollowerlist = follower_list.ToArray(); ClGlobul.lst_follower_UserFollower = ClGlobul.lst_follower_UserFollower.Distinct().ToList(); lst_Userfollowerlist = ClGlobul.lst_follower_UserFollower.ToArray(); } foreach (string SubFollower in lst_Userfollowerlist) { FollowActivitystart(ref obj_Gram , SubFollower); } } catch(Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } finally { GlobusLogHelper.log.Info("!!! Process Completed !!!"); } }
public void StartMultiThreadsUsingUsername(object parameters) { try { if (!isStopUsingUsername) { try { lstThreadsUsingUsername.Add(Thread.CurrentThread); lstThreadsUsingUsername.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { Array paramsArray = new object[1]; paramsArray = (Array)parameters; InstagramUser objFacebookUser = (InstagramUser)paramsArray.GetValue(0); if (!objFacebookUser.isloggedin) { GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); objFacebookUser.globusHttpHelper = objGlobusHttpHelper; //Login Process Accounts.AccountManager objAccountManager = new AccountManager(); status = objAccountManager.LoginUsingGlobusHttp(ref objFacebookUser); } if (objFacebookUser.isloggedin) { StartActionFollowerModule(ref objFacebookUser); } else { GlobusLogHelper.log.Info("Couldn't Login With Username : "******"Couldn't Login With Username : "******"Error : " + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } finally { try { { lock (lockrThreadControlleUsingUsername) { countThreadControllerUsingUsername--; Monitor.Pulse(lockrThreadControlleUsingUsername); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } }
/// <summary> /// Processes Comment IDs /// Gets Next Page URL as well as End User IDs /// </summary> /// <param name="objCommentID">Comment ID</param> private void StartMission_Comments(object objCommentID) { string CommentID = string.Empty; try { if (!isStopFanPageScraper) { //string CommentID = (string)objCommentID; string[] arrayParameters = (string[])objCommentID; CommentID = (string)arrayParameters.GetValue(0); string PageURL = (string)arrayParameters.GetValue(1);//(string)objCommentID; GlobusHttpHelper httpHelper = new GlobusHttpHelper(); string GraphUrl = FBGlobals.Instance.fbgraphUrl + CommentID; string jsonRes = string.Empty; try { jsonRes = httpHelper.getHtmlfromUrlProxy(new Uri(FBGlobals.Instance.fbgraphUrl + CommentID + ""), "", 80, "", ""); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } ParseJson_Comments_Phase1(jsonRes, PageURL); ParseJson_Comments_Next_Phase1(jsonRes, PageURL); ///After processing Comment ID, Update its Status as 1 => Processed try { //qm.UpdateStatusForLevelOne(CommentID); DataSet ds = new DataSet(); RaiseEvent(ds, new string[] { "Model : FanPagePostRepository", "Function : UpdateStatusUsingFriendId", CommentID }); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } finally { //if (!IsCloseCalled) { countThreadController--; lock (lockrThreadController) { //if (!IsCloseCalled) { Monitor.Pulse(lockrThreadController); } } } } }
public void getTweetUsers(string Url, ref GlobusHttpHelper HttpHelper) { string cursor = "-1"; string FollowingUrl = string.Empty; List <string> lstIds = new List <string>(); string userID; string Screen_name; int counter = 0; try { Url = Url + "@@@"; string numResult = getBetween(Url, "status/", "@@@"); //Regex.Match(Url, @"\d+").Value; FollowingUrl = "https://twitter.com/i/activity/retweeted_popup?id=" + numResult; string Data = HttpHelper.getHtmlfromUrl(new Uri(FollowingUrl), "", ""); if (string.IsNullOrEmpty(Data)) { Data = HttpHelper.getHtmlfromUrl(new Uri(FollowingUrl), "", ""); } if (string.IsNullOrEmpty(Data)) { AddToLog_ScrapMember("Either Url is Invalid or PageSource is getting Null or Empty."); //ReturnStatus = "Error"; return; } String[] DataDivArr = null; if (Data.Contains("js-stream-item stream-item stream-item")) { DataDivArr = Regex.Split(Data, "js-stream-item stream-item stream-item"); } foreach (var DataDivArr_item in DataDivArr) { if (DataDivArr_item.Contains("data-screen-name")) { int endIndex = 0; int startIndex = DataDivArr_item.IndexOf("data-screen-name"); try { endIndex = DataDivArr_item.IndexOf("data-name"); } catch { } if (endIndex == -1) { endIndex = DataDivArr_item.IndexOf("data-feedback-token"); } string GetDataStr = DataDivArr_item.Substring(startIndex, endIndex); //string _SCRNameID = (GetDataStr.Substring(GetDataStr.IndexOf("data-user-id"), GetDataStr.IndexOf("data-feedback-token", GetDataStr.IndexOf("data-user-id")) - GetDataStr.IndexOf("data-user-id")).Replace("data-user-id", string.Empty).Replace("=", string.Empty).Replace("\"", "").Replace("\\\\n", string.Empty).Replace("data-screen-name=", string.Empty).Replace("\\", "").Trim()); string _SCRName = (GetDataStr.Substring(GetDataStr.IndexOf("data-screen-name="), GetDataStr.IndexOf("data-user-id", GetDataStr.IndexOf("data-screen-name=")) - GetDataStr.IndexOf("data-screen-name=")).Replace("data-screen-name=", string.Empty).Replace("=", string.Empty).Replace("\"", "").Replace("\\\\n", string.Empty).Replace("data-screen-name=", string.Empty).Replace("\\", "").Trim()); if (_SCRName.Contains(" ")) { _SCRName = _SCRName.Split(' ')[0]; } //if (noOfRecords > lstIds.Count) { lstIds.Add(_SCRName); lstIds = lstIds.Distinct().ToList(); AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [" + _SCRName + " ]"); if (!File.Exists(Globals.Path_ScrapedMembersList)) { GlobusFileHelper.AppendStringToTextfileNewLine(" UserName , Url", Globals.Path_ScrapedMembersList); } GlobusFileHelper.AppendStringToTextfileNewLine(_SCRName + "," + Url, Globals.Path_ScrapedMembersList); } } } } catch { } }
private void btnStart_Searching_Click(object sender, EventArgs e) { AllOfTheseWords = (txtAllofTheseKeywords.Text).ToString(); ThisExtractPhrase = (txtThisExactPhrase.Text).ToString(); AnyOfTheseWords = (txtAnyOfTheseWords.Text).ToString(); TheseHashTags = (txtTheseHashTags.Text).ToString(); NoneOfTheseWords = (txtNoneofTheseWords.Text).ToString(); FromTheseAccounts = (txtFromTheseAccounts.Text).ToString(); ToTheseAccounts = (txtToTheseAccounts.Text).ToString(); MentionTheseAccounts = (txtMentioningTheseAccounts.Text).ToString(); NearThisPlace = (txtNearThisPlace.Text).ToString(); AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => Process Started"); try { if (string.IsNullOrEmpty(ThisExtractPhrase)) { ThisExtractPhrase = ""; } else { ThisExtractPhrase = "%20%22" + ThisExtractPhrase; } } catch { } try { if (string.IsNullOrEmpty(AnyOfTheseWords)) { AnyOfTheseWords = ""; } else { AnyOfTheseWords = "%22%20" + AnyOfTheseWords; } } catch { } try { if (string.IsNullOrEmpty(TheseHashTags)) { TheseHashTags = ""; } else { TheseHashTags = "%20%23" + TheseHashTags; } } catch { } try { if (string.IsNullOrEmpty(NoneOfTheseWords)) { NoneOfTheseWords = ""; } else { NoneOfTheseWords = "%20-" + NoneOfTheseWords; } } catch { } try { if (string.IsNullOrEmpty(FromTheseAccounts)) { FromTheseAccounts = ""; } else { FromTheseAccounts = "%20from%3A" + FromTheseAccounts; } } catch { } try { if (string.IsNullOrEmpty(ToTheseAccounts)) { ToTheseAccounts = ""; } else { ToTheseAccounts = "%20to%3A" + ToTheseAccounts; } } catch { } try { if (string.IsNullOrEmpty(MentionTheseAccounts)) { MentionTheseAccounts = ""; } else { MentionTheseAccounts = "%20%40" + MentionTheseAccounts; } } catch { } try { if (string.IsNullOrEmpty(NearThisPlace)) { NearThisPlace = ""; } else { NearThisPlace = "%20near%3A%22" + NearThisPlace; } } catch { } try { if (!string.IsNullOrEmpty(txtAllofTheseKeywords.Text)) { #region Commented //try //{ // string Url = "https://twitter.com/search?f=realtime&q=" + AllOfTheseWords + ThisExtractPhrase + AnyOfTheseWords + NoneOfTheseWords + TheseHashTags + _selectedLanguage + FromTheseAccounts + ToTheseAccounts + MentionTheseAccounts + NearThisPlace + "%22%20within%3A15mi&src=typd"; // string response = _GlobusHttpHelper.getHtmlfromUrl(new Uri(Url), "", ""); //} //catch { } public List<StructTweetIDs> NewKeywordStructDataForSearchByKeyword(string keyword) #endregion { try { BaseLib.GlobusRegex regx = new GlobusRegex(); int counter = 0; string res_Get_searchURL = string.Empty; string searchURL = string.Empty; string maxid = string.Empty; string TweetId = string.Empty; string text = string.Empty; 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; int noOfRecords = 0; try { noOfRecords = int.Parse(txtNoOfRecords.Text); } catch { } startAgain: if (counter == 0) { searchURL = "https://twitter.com/i/search/timeline?q=" + AllOfTheseWords + ThisExtractPhrase + AnyOfTheseWords + NoneOfTheseWords + TheseHashTags + _selectedLanguage + FromTheseAccounts + ToTheseAccounts + MentionTheseAccounts + NearThisPlace + "%22%20within%3A15mi&src=typd" + "&f=realtime"; counter++; } else { searchURL = "https://twitter.com/i/search/timeline?q=" + AllOfTheseWords + ThisExtractPhrase + AnyOfTheseWords + NoneOfTheseWords + TheseHashTags + _selectedLanguage + FromTheseAccounts + ToTheseAccounts + MentionTheseAccounts + NearThisPlace + "%22%20within%3A15mi&src=typd" + "&f=realtime&include_available_features=1&include_entities=1&last_note_ts=0&oldest_unread_id=0&scroll_cursor=" + TweetId + ""; } try { res_Get_searchURL = _GlobusHttpHelper.getHtmlfromUrl(new Uri(searchURL), "", ""); AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => Finding results for entered details "); if (string.IsNullOrEmpty(res_Get_searchURL)) { res_Get_searchURL = _GlobusHttpHelper.getHtmlfromUrl(new Uri(searchURL), "", ""); } try { //string sjss = globushttpHelper.getHtmlfromUrl(new Uri(searchURL), "", ""); string[] splitRes = Regex.Split(res_Get_searchURL, "refresh_cursor"); //splitRes = splitRes.Skip(1).ToArray(); foreach (string item in splitRes) { if (item.Contains("refresh_cursor")) { int startIndex = item.IndexOf("TWEET-"); string start = item.Substring(startIndex).Replace("data-user-id=\\\"", ""); int endIndex = start.IndexOf("\""); string end = start.Substring(0, endIndex).Replace("id_str", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("}", "").Replace("]", ""); TweetId = end; } if (item.Contains("scroll_cursor")) { int startIndex = item.IndexOf("TWEET-"); string start = item.Substring(startIndex).Replace("data-user-id=\\\"", ""); int endIndex = start.IndexOf("\""); string end = start.Substring(0, endIndex).Replace("id_str", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("}", "").Replace("]", ""); TweetId = end; } } } catch (Exception) { } } catch (Exception ex) { System.Threading.Thread.Sleep(2000); res_Get_searchURL = _GlobusHttpHelper.getHtmlfromUrl(new Uri(searchURL), "", ""); } // && !res_Get_searchURL.Contains("has_more_items\":false") if (!string.IsNullOrEmpty(res_Get_searchURL)) { //string[] splitRes = Regex.Split(res_Get_searchURL, "data-item-id"); //Regex.Split(res_Get_searchURL, "\"in_reply_to_status_id_str\""); string[] splitRes = Regex.Split(res_Get_searchURL, "data-item-id"); splitRes = splitRes.Skip(1).ToArray(); foreach (string item in splitRes) { if (item.Contains("data-screen-name=") && !item.Contains("js-actionable-user js-profile-popup-actionable")) { //var avc = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(res_Get_searchURL); //string DataHtml = (string)avc["items_html"]; } else { continue; } string modified_Item = "\"from_user\"" + item; string id = ""; try { int startIndex = item.IndexOf("data-user-id="); string start = item.Substring(startIndex).Replace("data-user-id=\\\"", ""); int endIndex = start.IndexOf("\\\""); string end = start.Substring(0, endIndex).Replace("id_str", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("}", "").Replace("]", ""); id = end; //lst_structTweetIDs.Add(id); AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => User Id " + id); } catch (Exception ex) { id = "null"; //Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetPhotoFromUsername() -- id -- " + keyword + " --> " + ex.Message, Globals.Path_TwitterDataScrapper); } string from_user_id = ""; try { int startIndex = item.IndexOf("data-screen-name=\\\""); string start = item.Substring(startIndex).Replace("data-screen-name=\\\"", ""); int endIndex = start.IndexOf("\\\""); string end = start.Substring(0, endIndex).Replace("from_user_id\":", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("_str", "").Replace("user", "").Replace("}", "").Replace("]", ""); from_user_id = end; AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => User ScreenName " + from_user_id); } catch (Exception ex) { from_user_id = "null"; // Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetPhotoFromUsername() -- " + keyword + " -- from_user_id --> " + ex.Message, Globals.Path_TwitterDataScrapper); } string tweetUserid = string.Empty; try { int startIndex = item.IndexOf("=\\\""); string start = item.Substring(startIndex).Replace("=\\\"", ""); int endIndex = start.IndexOf("\\\""); string end = start.Substring(0, endIndex).Replace("from_user_id\":", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("_str", "").Replace("user", "").Replace("}", "").Replace("]", ""); tweetUserid = end; AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => Tweet Id " + tweetUserid); } catch (Exception ex) { from_user_id = "null"; } ///Tweet Text #region Commented //try //{ // int startindex = item.IndexOf("js-tweet-text tweet-text\""); // if (startindex == -1) // { // startindex = 0; // startindex = item.IndexOf("js-tweet-text tweet-text"); // } // string start = item.Substring(startindex).Replace("js-tweet-text tweet-text\"", "").Replace("js-tweet-text tweet-text tweet-text-rtl\"", ""); // int endindex = start.IndexOf("</p>"); // if (endindex == -1) // { // endindex = 0; // endindex = start.IndexOf("stream-item-footer"); // } // string end = start.Substring(0, endindex); // end = regx.StripTagsRegex(end); // text = end.Replace(" ", "").Replace("a href=", "").Replace("/a", "").Replace("<span", "").Replace("</span", "").Replace("class=\\\"js-display-url\\\"", "").Replace("class=\\\"tco-ellipsis\\\"", "").Replace("class=\\\"invisible\\\"", "").Replace("<strong>", "").Replace("target=\\\"_blank\\\"", "").Replace("class=\\\"twitter-timeline-link\\\"", "").Replace("</strong>", "").Replace("rel=\\\"nofollow\\\" dir=\\\"ltr\\\" data-expanded-url=", ""); // text = text.Replace(""", "").Replace("<", "").Replace(">", "").Replace("\"", "").Replace("\\", "").Replace("title=", ""); // string[] array = Regex.Split(text, "http"); // text = string.Empty; // foreach (string itemData in array) // { // if (!itemData.Contains("t.co")) // { // string data = string.Empty; // if (itemData.Contains("//")) // { // data = ("http" + itemData).Replace(" span ", string.Empty); // if (!text.Contains(itemData.Replace(" ", "")))// && !data.Contains("class") && !text.Contains(data)) // { // text += data.Replace("u003c", string.Empty).Replace("u003e", string.Empty); // } // } // else // { // if (!text.Contains(itemData.Replace(" ", ""))) // { // text += itemData.Replace("u003c", string.Empty).Replace("u003e", string.Empty).Replace("js-tweet-text tweet-text", ""); // } // } // } // } //} //catch { }; #endregion twtboardpro.TwitterDataScrapper.StructTweetIDs structTweetIDs = new twtboardpro.TwitterDataScrapper.StructTweetIDs(); if (id != "null") { structTweetIDs.ID_Tweet = tweetUserid; structTweetIDs.ID_Tweet_User = id; structTweetIDs.username__Tweet_User = from_user_id; structTweetIDs.wholeTweetMessage = text; lst_structTweetIDs.Add(structTweetIDs); } //if (!File.Exists(Globals.Path_KeywordScrapedListData + "-" + keyword + ".csv")) //{ // GlobusFileHelper.AppendStringToTextfileNewLine("USERID , USERNAME , PROFILE NAME , BIO , LOCATION , WEBSITE , NO OF TWEETS , FOLLOWERS , FOLLOWINGS", Globals.Path_KeywordScrapedListData + "-" + keyword + ".csv"); //} { ChilkatHttpHelpr objChilkat = new ChilkatHttpHelpr(); GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); string ProfilePageSource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + from_user_id), "", ""); 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, "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"); counterdata++; } else { break; } 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", "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", "class", "ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-nav");//location profile-field"); while ((xNode != null)) { xBeginSearchAfter = xNode; if (counterData == 0) { // NoOfTweets = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "ProfileNav-value"); 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(from_user_id) && tweetUserid != "null") { string Id_user = tweetUserid.Replace("}]", string.Empty).Trim(); Globals.lstScrapedUserIDs.Add(Id_user); // GlobusFileHelper.AppendStringToTextfileNewLine(id + "," + from_user_id + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location.Replace(",", "") + "," + website + "," + NoOfTweets.Replace(",", "").Replace("Tweets", "") + "," + Followers.Replace(",", "").Replace("Following", "") + "," + Followings.Replace(",", "").Replace("Followers", "").Replace("Follower", ""), Globals.Path_KeywordScrapedListData + "-" + keyword + ".csv"); // Log("[ " + DateTime.Now + " ] => [ " + from_user_id + "," + Id_user + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location + "," + website + "," + NoOfTweets + "," + Followers + "," + Followings + " ]"); } } lst_structTweetIDs = lst_structTweetIDs.Distinct().ToList(); if (lst_structTweetIDs.Count >= noOfRecords) { // return lst_structTweetIDs; } } if (lst_structTweetIDs.Count <= noOfRecords) { maxid = lst_structTweetIDs[lst_structTweetIDs.Count - 1].ID_Tweet; if (res_Get_searchURL.Contains("has_moreitems\":false")) { } else { goto startAgain; } } else { if (res_Get_searchURL.Contains("has_more_items\":false")) { } else goto startAgain; } } } catch (Exception ex) { } } } } catch { } }
public string PostFollowCompanyUsingUrl(ref GlobusHttpHelper HttpHelper, Dictionary <string, Dictionary <string, string> > LinkdInContacts, int mindelay, int maxdelay) { string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string sourceAlias = string.Empty; string ReturnString = string.Empty; try { string MessageText = string.Empty; string PostedMessage = string.Empty; string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top")); if (pageSource.Contains("csrfToken")) { csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50); string[] Arr = csrfToken.Split('&'); csrfToken = Arr[0]; csrfToken = csrfToken.Replace(":", "%3A").Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty); csrfToken = csrfToken.Trim(); } if (pageSource.Contains("sourceAlias")) { sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2]; } try { int counter = 0; foreach (KeyValuePair <string, Dictionary <string, string> > UserValue in LinkdInContacts) { counter = counter + 1; foreach (KeyValuePair <string, string> GroupValue in UserValue.Value) { post_url = string.Empty; post_url = (GroupValue.Key + ":" + GroupValue.Value); string Screen_name = UserValue.Key.Split(':')[0]; string pass = UserValue.Key.Split(':')[1]; postUrl = "https://www.linkedin.com/uas/login-submit"; postdata = "session_key=" + Screen_name + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; ResLogin = HttpHelper.postFormData(new Uri(postUrl), postdata); try { string GoBack = "%2Ebzo_*1_*1_*1_*1_*1_*1_*1_" + post_url.Split(':')[1]; Log("[ " + DateTime.Now + " ] => [ ID: " + Screen_name + " has Follow the Company: " + post_url.Split(':')[0] + " ]"); string pageGetreq = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/company/follow/submit?id=" + post_url.Split(':')[1] + "&fl=start&version=2&ft=pageKey%3Dbiz-overview-internal%3Bmodule%3Dbutton&sp=biz-overview&csrfToken=" + csrfToken + "&goback=" + GoBack)); if (pageGetreq.Contains("Following")) { ReturnString = "Your request to Follow the: " + post_url.Split(':')[0] + " company has been Successfully Followed."; Log("[ " + DateTime.Now + " ] => [ " + ReturnString + " ]"); //GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_FollowCompany); } else if (pageGetreq.Contains("Error")) { Log("[ " + DateTime.Now + " ] => [ Error In Follow Company ]"); GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "Error In Follow Company", Globals.path_Not_FollowCompany); } else { Log("[ " + DateTime.Now + " ] => [ Company Could Not Be Followed ]"); GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "Company Could Not Be Followed", Globals.path_Not_FollowCompany); } } catch { } if (counter < LinkdInContacts.Count()) { int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } } } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--1 --> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--1 --> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinFollowCompanyErrorLogs); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--2--> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--2--> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinFollowCompanyErrorLogs); ReturnString = "Error"; } return(ReturnString); }
public List<string> GetUserFollowing_newComment(string UserName, int NoOfPage, int FollowingCount) { List<string> TotalFollowerComment = new List<string>(); try { List<string> FollowerComment = new List<string>(); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Starting Extraction Of Following For " + UserName + " ]"); GlobusHttpHelper objglobusHttpHelper = new GlobusHttpHelper(); for (int i = 1; i <= 1000; i++) { try { string FollowerPageSource = string.Empty; if (i == 1) { FollowUrl = "http://pinterest.com/" + UserName + "/following/"; FollowerPageSource = objglobusHttpHelper.getHtmlfromUrl(new Uri(FollowUrl), referer, string.Empty, ""); referer = FollowUrl; } else { FollowUrl = "https://www.pinterest.com/resource/UserFollowingResource/get/?source_url=%2F" + UserName + "%2Ffollowing%2F&data=%7B%22options%22%3A%7B%22username%22%3A%22" + UserName + "%22%2C%22bookmarks%22%3A%5B%22" + bookmark + "%3D%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App(module%3D%5Bobject+Object%5D)&_=144204352215" + (i - 1); try { FollowerPageSource = objglobusHttpHelper.getHtmlfromUrlProxy(new Uri(FollowUrl), referer, "", 80, string.Empty, "", ""); } catch { FollowerPageSource = objglobusHttpHelper.getHtmlfromUrlProxy(new Uri(FollowUrl), "", Convert.ToInt32(""), "", ""); } if (FollowerPageSource.Contains("Whoops! We couldn't find that page.")) { break; } } ///Get App Version if (FollowerPageSource.Contains("app_version") && string.IsNullOrEmpty(AppVersion)) { string[] ArrAppVersion = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "app_version"); if (ArrAppVersion.Count() > 0) { string DataString = ArrAppVersion[ArrAppVersion.Count() - 1]; int startindex = DataString.IndexOf("\": \""); int endindex = DataString.IndexOf("\", \""); AppVersion = DataString.Substring(startindex, endindex - startindex).Replace("\": \"", ""); } } ///get bookmarks value from page /// if (FollowerPageSource.Contains("bookmarks")) { string[] bookmarksDataArr = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "bookmarks"); string Datavalue = string.Empty; if (bookmarksDataArr.Count() > 2) Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 2]; else Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 1]; bookmark = Datavalue.Substring(Datavalue.IndexOf(": [\"") + 4, Datavalue.IndexOf("]") - Datavalue.IndexOf(": [\"") - 5); } try { if (!FollowerPageSource.Contains("No one has followed")) { List<string> lst = objGlobusRegex.GetHrefUrlTags(FollowerPageSource); if (lst.Count == 0) { lst = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "href").ToList(); if (lst.Count() == 1) { lst = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "\"username\":").ToList(); } } foreach (string item in lst) { if (item.Contains("class=\"userWrapper") || item.Contains("class=\\\"userWrapper")) { try { if (item.Contains("\\")) { int FirstPinPoint = item.IndexOf("=\\\"/"); int SecondPinPoint = item.IndexOf("/\\\""); User = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("=", string.Empty).Replace("/", string.Empty).Trim(); } else { int FirstPinPoint = item.IndexOf("href="); int SecondPinPoint = item.IndexOf("class="); User = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\"", string.Empty).Replace("href=", string.Empty).Replace("/", string.Empty).Trim(); } FollowerComment.Add(User); //GlobusLogHelper.log.Info(" => [ " + User + " ]"); if (FollowerComment.Count == FollowingCount) { break; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } } if (i > 1) { if (item.Contains("\"request_identifier\":")) { continue; } else { try { User = Utils.Utils.getBetween(item, "\"", "\""); if (User == UserName) { break; } FollowerComment.Add(User); //GlobusLogHelper.log.Info(" => [ " + User + " ]"); if (FollowerComment.Count == FollowingCount) { break; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } } } } FollowerComment = FollowerComment.Distinct().ToList(); foreach (string lstdata in FollowerComment) { TotalFollowerComment.Add(lstdata); } TotalFollowerComment = TotalFollowerComment.Distinct().ToList(); //if (TotalFollowerComment.Count == MaxComment) //{ // break; //} Thread.Sleep(1000); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ No following ]"); break; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); break; } } //GlobusLogHelper.log.Info(" => [ Finished Extracting following For " + UserName + " ]"); //GlobusLogHelper.log.Info(" => [ Process Completed Please. Now you can export file ]"); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total Followings : " + TotalFollowerComment.Count + " ]"); return TotalFollowerComment; }
public static string GetUserIDFromUsername_New(string username, out string Status, ref GlobusHttpHelper HttpHelper) { string GetStatus = string.Empty; clsDBQueryManager DB = new clsDBQueryManager(); DataSet ds = DB.GetUserId(username); string user_id = string.Empty; try { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dataRow in ds.Tables["tb_UsernameDetails"].Rows) { user_id = dataRow.ItemArray[0].ToString(); Status = "No Error"; return user_id; } } } catch { }; try { string id = string.Empty; string pagesource = string.Empty; pagesource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + username), "", ""); if (!pagesource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour.") && !pagesource.Contains("Sorry, that page does not exist") && !pagesource.Contains("User has been suspended")) { // pagesource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + username), "", ""); try { int startindex = pagesource.IndexOf("profile_id"); string start = pagesource.Substring(startindex).Replace("profile_id", ""); int endindex = start.IndexOf(","); string end = start.Substring(0, endindex).Replace(""", "").Replace("\"", "").Replace(":", "").Trim(); user_id = end.Trim(); } catch { } if (string.IsNullOrEmpty(user_id)) { try { int startindex = pagesource.IndexOf("ProfileTweet-authorDetails\">"); string start = pagesource.Substring(startindex).Replace("ProfileTweet-authorDetails\">", ""); int endindex = start.IndexOf("\">"); string end = start.Substring(start.IndexOf("data-user-id="), endindex - start.IndexOf("data-user-id=")).Replace("data-user-id=", "").Replace("\"", ""); user_id = end.Trim(); } catch { } } if (string.IsNullOrEmpty(user_id)) { try { int startindex = pagesource.IndexOf("stats js-mini-profile-stats \" data-user-id=\""); if (startindex == -1) { startindex = pagesource.IndexOf("user-actions btn-group not-following not-muting \" data-user-id=\""); } if (startindex == -1) { startindex = pagesource.IndexOf("user-actions btn-group not-following not-muting protected\" data-user-id=\""); } string start = pagesource.Substring(startindex).Replace("stats js-mini-profile-stats \" data-user-id=\"", "").Replace("user-actions btn-group not-following not-muting \" data-user-id=\"", "").Replace("user-actions btn-group not-following not-muting protected\" data-user-id=\"", "").Trim(); //int endindex = start.IndexOf("\">"); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); user_id = end.Replace("\"", ""); } catch { } } } else if (pagesource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour.")) { GetStatus = "Rate limit exceeded"; } else if (pagesource.Contains("Sorry, that page does not exist")) { GetStatus = "Sorry, that page does not exist"; } else if (pagesource.Contains("User has been suspended")) { GetStatus = "User has been suspended"; } } catch (Exception ex) { Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetUserIDFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwitterDataScrapper); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetUserIDFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwtErrorLogs); GetStatus = "Error"; } Status = "No Error"; return user_id; }
private void SendFriendRequestMultiThreads(object parameters) { try { // if (!isStopWallPoster) { try { lstThreadsWallPoster.Add(Thread.CurrentThread); lstThreadsWallPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } try { Array paramsArray = new object[1]; paramsArray = (Array)parameters; FacebookUser objFacebookUser = (FacebookUser)paramsArray.GetValue(0); if (!objFacebookUser.isloggedin) { GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); objFacebookUser.globusHttpHelper = objGlobusHttpHelper; //Login Process Accounts.AccountManager objAccountManager = new AccountManager(); objAccountManager.LoginUsingGlobusHttp(ref objFacebookUser); } if (objFacebookUser.isloggedin) { AddToLogger_FriendsManager("Successful login With : "+objFacebookUser.username); if (StartFriendsProcessUsing=="Add Friends via fanpage url") { FriendRequestViaFanPageUrl(objFacebookUser); AddToLogger_FriendsManager("Process Completed With : "+objFacebookUser.username); } else if (StartFriendsProcessUsing==" Add friends from keyword") { StartActionFriendsManager(ref objFacebookUser); AddToLogger_FriendsManager("Process Completed With : "+objFacebookUser.username); } else if(StartFriendsProcessUsing=="Send Text message on Friends wall") { AddToLogger_FriendsManager("Please wait Send Text message process started ...."); WallPostingWithTestMessage(ref objFacebookUser); AddToLogger_FriendsManager("Send text message on friends wall Process completed ."); } else if(StartFriendsProcessUsing=="Send Url message on Friends wall") { WallPostingNew(ref objFacebookUser); } else if(StartFriendsProcessUsing=="Send Picture on Friends wall") { StartActionPostPicOnWall(ref objFacebookUser); } // Call SendFriendRequests //SendFriendRequests(ref objFacebookUser); } else { AddToLogger_FriendsManager("Couldn't Login With Username : "******"Error : " + ex.StackTrace); } //GlobusLogHelper.log.Debug("Process completed !!"); //AddToLogger_FriendsManager("Process completed !!"); } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } finally { try { if (!isRequestFriendsStop) { lock (requestFriendsThreadControllerlockr) { requestFriendsThreadControllerCount--; Monitor.Pulse(requestFriendsThreadControllerlockr); } } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } } }
public void StartMultiThreadedPendingGroupAdd(object parameter) { try { Array paramsArray = new object[1]; paramsArray = (Array)parameter; KeyValuePair <string, LinkedInMaster> item = (KeyValuePair <string, LinkedInMaster>)paramsArray.GetValue(0); LinkedinLogin Login = new LinkedinLogin(); Login.accountUser = item.Key; Login.accountPass = item.Value._Password; Login.proxyAddress = item.Value._ProxyAddress; Login.proxyPort = item.Value._ProxyPort; Login.proxyUserName = item.Value._ProxyUsername; Login.proxyPassword = item.Value._ProxyPassword; GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); Login.logger.addToLogger += new EventHandler(GroupStatus_addToLogger); if (!Login.IsLoggedIn) { Login.LoginHttpHelper(ref HttpHelper); } if (Login.IsLoggedIn) { GroupStatus dataScrape = new GroupStatus(); //string MemIdwithuser = dataScrape.GetSelectedID(ref HttpHelper, Login.accountUser); //Dictionary<string, string> Groups = dataScrape.PostAddPendingGroupNames(ref HttpHelper, MemIdwithuser); AddLoggerPendingGroups("[ " + DateTime.Now + " ] => [ Groups Adding of Acount + " + Login.accountUser + " please wait for sometime ]"); Dictionary <string, string> Groups = dataScrape.GetSelectedIDForPendingGroups(ref HttpHelper, Login.accountUser); LinkdInContacts.Add(Login.accountUser, Groups); try { if (Groups.Count > 0) { AddLoggerPendingGroups("[ " + DateTime.Now + " ] => [ Pending Group List..Added Successfully..in " + Login.accountUser + " ]"); } else { AddLoggerPendingGroups("[ " + DateTime.Now + " ] => [ Pending Group List..Not Available..in " + Login.accountUser + " ]"); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Pending Groups --> StartMultiThreadedPendingGroupAdd() >> 1 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Pending Groups --> StartMultiThreadedPendingGroupAdd() >> 2 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPendingGroupErrorLogs); } if (cmbUserPendingGroup.InvokeRequired) { new Thread(() => { cmbUserPendingGroup.Invoke(new MethodInvoker(delegate { cmbUserPendingGroup.Items.Add(Login.accountUser); })); }).Start(); } } else { AddLoggerPendingGroups("[ " + DateTime.Now + " ] => [ LinkedIn Account : " + Login.accountUser + " has been temporarily restricted ]"); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Pending Groups --> StartMultiThreadedPendingGroupAdd() >> 2 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Pending Groups --> StartMultiThreadedPendingGroupAdd() >> 2>>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPendingGroupErrorLogs); } finally { counter_GroupPendingSearch--; if (counter_GroupPendingSearch == 0) { if (btnAddPendingGroups.InvokeRequired) { btnAddPendingGroups.Invoke(new MethodInvoker(delegate { btnAddPendingGroups.Enabled = true; AddLoggerPendingGroups("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); AddLoggerPendingGroups("------------------------------------------------------------------------------------------------------------------------------------"); btnAddPendingGroups.Cursor = Cursors.Default; })); } } } }
public List<string> GetFollowings_NewForMobileVersion(string userID, out string ReturnStatus) { GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); //Log("[ " + DateTime.Now + " ] => [ Searching For Followers For " + userID + " ]"); string cursor = "0"; int counter = 0; string FollowingUrl = string.Empty; List<string> lstIds = new List<string>(); string Data = string.Empty; string FindCursor = string.Empty; try { StartAgain: //Thread.Sleep(1000); string[] splitRes = new string[] { }; if (counter == 0) { string aa = "https://mobile.twitter.com/" + userID + "/following"; Data = HttpHelper.getHtmlfromUrl(new Uri(aa), "", ""); if (Data.Contains("class=\"w-button-more\"")) { int startindex = Data.IndexOf("cursor="); string start = Data.Substring(startindex).Replace("cursor=", ""); int lastindex = start.IndexOf(">"); if (lastindex < 0) { lastindex = start.IndexOf(">"); } string end = start.Substring(0, lastindex).Replace("\"", ""); cursor = end; } else { //splitRes = Regex.Split(Data, "<div class=\"GridTimeline-items"); } counter++; //Data = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + userID + "/followers"), "", ""); } else { Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", ""); if (string.IsNullOrEmpty(Data)) { for (int i = 1; i <= 3; i++) { Thread.Sleep(3000); Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", ""); if (!string.IsNullOrEmpty(Data)) { break; } } //if (string.IsNullOrEmpty(Data)) //{ // Log(" pagesource not found "); //} } if (Data == "Too Many Requestes") { //Log("[ " + DateTime.Now + " ] => [ Wait for 15 minutes For furthur Scraping because Twitter banned for scraping. its already too many requestes. ]"); Thread.Sleep(15 * 60 * 1000); Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", ""); if (string.IsNullOrEmpty(Data) || Data == "Too Many Requestes") { //Log("[ " + DateTime.Now + " ] => [ Wait for 5 minutes more For furthur Scraping. ]"); Thread.Sleep(5 * 60 * 1000); for (int i = 1; i <= 3; i++) { Thread.Sleep(3000); Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", ""); if (!string.IsNullOrEmpty(Data)) { break; } } //if (string.IsNullOrEmpty(Data)) //{ // Log(" pagesource not found "); //} } } //var avc = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(Data); //cursor = string.Empty; //string DataHtml = (string)avc["items_html"]; //cursor = (string)avc["cursor"]; } if (cursor == "0") { Thread.Sleep(2000); Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", ""); } if (Data.Contains("401 Unauthorized")) { ReturnStatus = "Account is Suspended. "; return lstIds; } else if (!Data.Contains("Rate limit exceeded") && !Data.Contains("{\"errors\":[{\"message\":\"Sorry, that page does not exist\",\"code\":34}]}") && !string.IsNullOrEmpty(Data)) { string[] arraydata = null; string startWith = string.Empty; if (Data.Contains("<strong class=\"fullname\">")) { arraydata = Regex.Split(Data, "<strong class=\"fullname\">"); //startWith = ""; } else { //arraydata = Regex.Split(Data, "js-stream-item"); //startWith = "\\\" role=\\\"listitem\\\""; } arraydata = arraydata.Skip(1).ToArray(); foreach (string id in arraydata) { string userid = string.Empty; string username = string.Empty; if (cursor == "0") { try { int startindex = id.IndexOf("id="); string start = id.Substring(startindex).Replace("id=", string.Empty); int endindex = start.IndexOf("&"); string end = start.Substring(0, endindex); userid = end; } catch { } } else { try { int startindex = id.IndexOf("id="); string start = id.Substring(startindex).Replace("id=", string.Empty); int endindex = start.IndexOf("&"); string end = start.Substring(0, endindex); userid = end; } catch (Exception ex) { Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetFollowers_New() -- " + userid + " --> " + ex.Message, Globals.Path_TwitterDataScrapper); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetFollowers_New() -- " + userid + " --> " + ex.Message, Globals.Path_TwtErrorLogs); } } if (cursor == "0") { try { int startindex = id.IndexOf("@</span>"); string start = id.Substring(startindex).Replace("@</span>", string.Empty); int endindex = start.IndexOf("</span></a>"); string end = start.Substring(0, endindex); username = end; } catch { } } else { try { int startindex = id.IndexOf("@</span>"); string start = id.Substring(startindex).Replace("@</span>", string.Empty); int endindex = start.IndexOf("</span></a>"); string end = start.Substring(0, endindex); username = end; } catch (Exception ex) { Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetFollowers_New() -- " + username + " --> " + ex.Message, Globals.Path_TwitterDataScrapper); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetFollowers_New() -- " + username + " --> " + ex.Message, Globals.Path_TwtErrorLogs); } } if (CounterDataNo > 0) { if (lstIds.Count == CounterDataNo) { ReturnStatus = "No Error"; lstIds = lstIds.Distinct().ToList(); return lstIds; } else { Globals.lstScrapedUserIDs.Add(userid); lstIds.Add(userid + ":" + username); lstIds = lstIds.Distinct().ToList(); if (username.Contains("/span") || userid.Contains("/span")) { } //Log("[ " + DateTime.Now + " ] => [ " + userid + ":" + username + " ]"); //write to csv GlobusFileHelper.AppendStringToTextfileNewLine(userID + "," + userid + "," + username, Globals.Path_ScrapedFollowingsList + "_" + userID + ".csv"); } } try { } catch (Exception ex) { Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetFollowers_New() -- " + username + " --> database --> " + ex.Message, Globals.Path_TwitterDataScrapper); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetFollowers_New() -- " + username + " --> database --> " + ex.Message, Globals.Path_TwtErrorLogs); } } if (Data.Contains("Show more people")) { int startindex = Data.IndexOf("cursor="); string start = Data.Substring(startindex).Replace("cursor=", ""); int lastindex = start.IndexOf(">"); if (lastindex < 0) { lastindex = start.IndexOf(">"); } string end = start.Substring(0, lastindex).Replace("\"", ""); cursor = end; if (cursor != "0") { goto StartAgain; } } ReturnStatus = "No Error"; lstIds = lstIds.Distinct().ToList(); return lstIds; } else if (!Data.Contains("Show more people")) { ReturnStatus = "Sorry, that page does not exist :" + userID; lstIds = lstIds.Distinct().ToList(); return lstIds; } else if (Data.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour.")) { ReturnStatus = "Rate limit exceeded. Clients may not make more than 150 requests per hour.:-" + userID; lstIds = lstIds.Distinct().ToList(); return lstIds; } else { ReturnStatus = "Error"; lstIds = lstIds.Distinct().ToList(); return lstIds; } } catch (Exception ex) { Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetFollowers_New() -- " + userID + " --> " + ex.Message, Globals.Path_TwitterDataScrapper); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetFollowers_New() -- " + userID + " --> " + ex.Message, Globals.Path_TwtErrorLogs); ReturnStatus = "Error"; lstIds = lstIds.Distinct().ToList(); return lstIds; } }
//public bool LoginPinterestAccount1(ref PinInterestUser objPinUser, string Username, string Password, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string ss) //{ // try // { // lock (this) // { // GlobusHttpHelper globusHttpHelper=new GlobusHttpHelper(); // string Name = string.Empty; // string ProxyAddress = proxyAddress; // string ProxyPort = proxyPort; // string ProxyUsername = proxyUsername; // string ProxyPassword = proxyPassword; // string AfterLoginPageSource = string.Empty; // try // { // string PinPage = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com/"), ProxyAddress, 80, proxyUsername, proxyPassword); // string _MainSourcePage = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com/resource/NoopResource/get/?source_url=%2Flogin%2F%3Fnext%3Dhttps%253A%252F%252Fwww.pinterest.com%252F%26prev%3Dhttps%253A%252F%252Fwww.pinterest.com%252F&data=%7B%22options%22%3A%7B%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3EHomePage()%3EUnauthHomePage(signup_email%3Dnull%2C+tab%3Dfollowing%2C+cmp%3Dnull%2C+resource%3DInspiredWallResource())&_=1424169081757"), proxyAddress, 80, proxyUsername, proxyPassword); // Get App Version // if (PinPage.Contains("app_version")) // { // try // { // string[] ArrAppVersion = System.Text.RegularExpressions.Regex.Split(PinPage, "app_version"); // if (ArrAppVersion.Count() > 0) // { // string DataString = ArrAppVersion[ArrAppVersion.Count() - 1]; // int startindex = DataString.IndexOf("\""); // string start = DataString.Substring(startindex).Replace("\": \"", "").Replace("}", string.Empty).Replace("\"", string.Empty); // int endindex = start.IndexOf(","); // App_version = start.Substring(0, endindex); // if (!string.IsNullOrEmpty(App_version)) // { // objPinUser.App_version = App_version; // } // } // } // catch { }; // } // else // { // App version is not available in page source // } // string referer = "https://www.pinterest.com/"; // string login = string.Empty; // try // { // string PostData1 = "source_url=%2Flogin%2F%3Fnext%3Dhttps%253A%252F%252Fwww.pinterest.com%252F%26prev%3Dhttps%253A%252F%252Fwww.pinterest.com%252F&data=%7B%22options%22%3A%7B%22username_or_email%22%3A%22" + Uri.EscapeDataString(Username) + "%22%2C%22password%22%3A%22" + Uri.EscapeDataString(Password) + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3ELoginPage()%3ELogin()%3EButton(text%3DLog+In%2C+size%3Dlarge%2C+class_name%3Dprimary%2C+type%3Dsubmit)"; // login = globusHttpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/UserSessionResource/create/"), PostData1, referer, proxyAddress, 80, proxyUsername, proxyPassword); // } // catch { }; // try // { // AfterLoginPageSource = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com"), proxyAddress, 80, proxyUsername, proxyPassword); // } // catch (Exception ex) // { // } // if (AfterLoginPageSource.Contains("Logout") || AfterLoginPageSource.Contains("pinHolder") || AfterLoginPageSource.Contains("header1\": \"What are you interested in?") || AfterLoginPageSource.Contains("\"error\": null") || login.Contains("\"error\": null")) // { // objPinUser.globusHttpHelper = globusHttpHelper; // GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Successfully Login for " + Username + " ]"); // this.LoggedIn = true; // } // else // { // GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]"); // this.LoggedIn = false; // return false; // } // } // catch (Exception ex) // { // GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]"); // this.LoggedIn = false; // return false; // } // try // { // List<string> listFollowersFromDatabse = new List<string>(); // try // { // string screen_Name = Getscreen_Name(ref objPinUser); // DataSet ds = QME.getFollower(screen_Name); // foreach (System.Data.DataRow dRow in ds.Tables[0].Rows) // { // try // { // listFollowersFromDatabse.Add(dRow["FollwerName"].ToString()); // } // catch (Exception ex) // { } // } // } // catch { } // try // { // string screen_Name = Getscreen_Name(ref objPinUser); // objPinUser.ScreenName = screen_Name; // Get current followers list from website // List<string> FollowersName = GetRefrshFollowerName(screen_Name, ref objPinUser); // FollowersName.RemoveAt(0); // if (FollowersName != null) // { // FollowersName = FollowersName.Distinct().ToList(); // } // if (FollowersName.Contains(screen_Name)) // { // FollowersName.Remove(screen_Name); // } // listFollowersFromDatabse.Add("gunde"); // List<string> listUnfollowers = listFollowersFromDatabse.Except(FollowersName).ToList(); // GlobusLogHelper.log.Info(listUnfollowers.Count + " users Unfollowed Account : " + screen_Name); // string UnfollowersList = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\PInterestUnfollowersList.csv"; // write unfollowers list to csv // if (!System.IO.File.Exists(UnfollowersList)) //* CSV Header *// // { // try // { // string dataFormat = "Account_ScreenName" + "," + "UnfollowerUsername"; // GlobusFileHelper.AppendStringToTextfileNewLine(dataFormat, UnfollowersList); //dataFormat // } // catch (Exception ex) { }; // } // foreach (string unfollower in listUnfollowers) // { // try // { // string dataFormat = screen_Name + "," + unfollower; // GlobusFileHelper.AppendStringToTextfileNewLine(dataFormat, UnfollowersList); //dataFormat // GlobusLogHelper.log.Info("Unfollower : " + unfollower + " for Account : " + screen_Name + " written to file " + UnfollowersList); // } // catch (Exception ex) // { }; // try // { // QueryExecuter.deleteFollower(screen_Name, unfollower); // GlobusLogHelper.log.Info("Unfollower : " + unfollower + " for Account : " + screen_Name + " deleted from Databse"); // } // catch (Exception ex) // { } // } // List<string> listNewFollowers = FollowersName.Except(listFollowersFromDatabse).ToList(); // GlobusLogHelper.log.Info(listNewFollowers.Count + " NEW Followers for Account : " + screen_Name + ""); // foreach (string follName_item in listNewFollowers) // { // try // { // QueryExecuter.insertFollowerName(screen_Name, follName_item); // GlobusLogHelper.log.Info("New follower : " + follName_item + " for Account : " + screen_Name + " added to Databse"); // } // catch { } // } // string follower = GetFollowercount(screen_Name, ref objPinUser); // string following = GetFollowingCount(screen_Name, ref objPinUser); // string BOARDS = GetBoard(screen_Name, ref objPinUser); // string followingCount = getBetween(following, "value'>", "</span>"); // string BoardsName = string.Empty; // List<string> BOARDSNAMES = new List<string>(); // if (inviteStart) // { // BOARDSNAMES = GetAllBoardNames_new1(screen_Name, ref objPinUser); // foreach (var itemBoardNames in BOARDSNAMES) // { // try // { // lstBoardNames.Add(itemBoardNames.ToLower().Replace(" ", "-")); // } // catch(Exception ex) // { }; // } // } // inviteStart = true; // try // { // foreach (string item_BoardNames in BOARDSNAMES) // { // BoardsName += item_BoardNames + (":").ToString(); // } // } // catch(Exception ex) // { }; // try // { // // QueryExecuter.updatetb_emails(follower, followingCount, BOARDS, BoardsName, screen_Name, Username); // objUploadAccount.AccounLoad(); // objDelegateAccountLoad(); // } // catch(Exception ex) // { }; // } // catch(Exception ex) // { }; // string[] ArrData = System.Text.RegularExpressions.Regex.Split(AfterLoginPageSource, "username"); // foreach (var item in ArrData) // { // try // { // if (item.Contains("{\"page_info")) // { // continue; // } // if (!item.StartsWith("\": null,") && !item.StartsWith("{\"request_identifier\"")) // { // int startindex = item.IndexOf(":"); // int endindex = item.IndexOf("\", \""); // this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); // break; // } // if (item.Contains("locale"))// && item.Contains("P.currentUser.set")) // { // int startindex = item.IndexOf(":"); // int endindex = item.IndexOf("\", \""); // this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); // break; // } // else if (item.Contains("name\": \"AuthHomePage")) // { // int startindex = item.IndexOf(":"); // int endindex = item.IndexOf("\", \""); // this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("\"", string.Empty).Trim(); // } // } // catch (Exception ex) // { } // } // if (ArrData.Count() == 2 && string.IsNullOrEmpty(Name)) // { // try // { // int startindex = ArrData[1].IndexOf(":"); // int endindex = ArrData[1].IndexOf("\", \""); // this.Name = ArrData[1].Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); // } // catch { }; // } // } // catch (Exception ex) // { // this.Name = string.Empty; // } // } // if (this.LoggedIn) // { // return true; // } // } // catch (Exception ex) // { // } // return false; //} public bool LoginPinterestAccount1forlee(ref PinInterestUser objPinUser, string Username, string Password, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string ss) { try { if (!checkFirstTimeLicense) { bool checkValideLicense = checkLoginTimeLicenseStatus(); if (!checkValideLicense) { GlobusLogHelper.log.Debug("-----------------------------------------------------"); GlobusLogHelper.log.Info(" Please Re-Start The Software !"); return false; } } lock (this) { GlobusHttpHelper globusHttpHelper = new GlobusHttpHelper(); string Name = string.Empty; string ProxyAddress = proxyAddress; string ProxyPort = proxyPort; string ProxyUsername = proxyUsername; string ProxyPassword = proxyPassword; string LoginStatus = string.Empty; string AfterLoginPageSource = string.Empty; try { string PinPage = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com/"), ProxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword); /// string _MainSourcePage = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com/resource/NoopResource/get/?source_url=%2Flogin%2F%3Fnext%3Dhttps%253A%252F%252Fwww.pinterest.com%252F%26prev%3Dhttps%253A%252F%252Fwww.pinterest.com%252F&data=%7B%22options%22%3A%7B%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3EHomePage()%3EUnauthHomePage(signup_email%3Dnull%2C+tab%3Dfollowing%2C+cmp%3Dnull%2C+resource%3DInspiredWallResource())&_=1424169081757"), proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); ///Get App Version if (PinPage.Contains("app_version")) { try { string[] ArrAppVersion = System.Text.RegularExpressions.Regex.Split(PinPage, "app_version"); if (ArrAppVersion.Count() > 0) { string DataString = ArrAppVersion[ArrAppVersion.Count() - 1]; int startindex = DataString.IndexOf("\""); string start = DataString.Substring(startindex).Replace("\": \"", "").Replace("}", string.Empty).Replace("\"", string.Empty); int endindex = start.IndexOf(","); App_version = start.Substring(0, endindex); if (!string.IsNullOrEmpty(App_version)) { objPinUser.App_version = App_version; } } } catch { }; } else { ///App version is not available in page source } string referer = "https://www.pinterest.com/"; string login = string.Empty; try { string PostData1 = "source_url=%2F&data=%7B%22options%22%3A%7B%22username_or_email%22%3A%22" + Uri.EscapeDataString(Username) + "%22%2C%22password%22%3A%22" + Uri.EscapeDataString(Password) + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EModalManager%3EModal%3EPlainSignupModal%3ESignupForm%3EUserRegister(next%3D%2F%2C+wall_class%3DgrayWall%2C+container%3Dplain_signup_modal%2C+unified_auth%3Dundefined%2C+is_login_form%3Dtrue%2C+show_personalize_field%3Dundefined%2C+auto_follow%3Dundefined%2C+register%3Dtrue)"; login = globusHttpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/UserSessionResource/create/"), PostData1, referer, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); } catch (Exception ex) { } try { AfterLoginPageSource = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com"), proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); } catch (Exception ex) { } if (AfterLoginPageSource.Contains("Logout") || AfterLoginPageSource.Contains("pinHolder") || AfterLoginPageSource.Contains("header1\": \"What are you interested in?") || AfterLoginPageSource.Contains("\"error\": null") || login.Contains("\"error\": null")) { // GlobusLogHelper.log.Info(" => [ Successfully Login for " + Username + " ]"); objPinUser.globusHttpHelper = globusHttpHelper; this.LoggedIn = true; objPinUser.isloggedin = true; objPinUser.LoginStatus = "Success"; } else { //GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]"); this.LoggedIn = false; objPinUser.LoginStatus = "Fail"; try { try { QueryExecuter.updatetb_emails("", "", "", "", objPinUser.ScreenName, Username, objPinUser.LoginStatus); } catch { } //objUploadAccount.AccounLoad(); objDelegateAccountLoad(); } catch { } return false; } } catch (Exception ex) { //GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]"); this.LoggedIn = false; objPinUser.LoginStatus = "Fail"; try { try { QueryExecuter.updatetb_emails("", "", "", "", objPinUser.ScreenName, Username, objPinUser.LoginStatus); } catch { } //objUploadAccount.AccounLoad(); objDelegateAccountLoad(); } catch { } return false; } try { List<string> listFollowersFromDatabse = new List<string>(); try { string screen_Name = Getscreen_Name(ref objPinUser); objPinUser.ScreenName = screen_Name; DataSet ds = QME.getFollower(screen_Name); foreach (System.Data.DataRow dRow in ds.Tables[0].Rows) { try { listFollowersFromDatabse.Add(dRow["FollwerName"].ToString()); } catch { } } } catch { } try { #region old Commented Code ///string screen_Name = Getscreen_Name(ref objPinUser); ///Screen_Name = screen_Name; //Get current followers list from website // List<string> FollowersName = GetRefrshFollowerName(objPinUser.ScreenName, ref objPinUser); // //FollowersName.RemoveAt(0); // if (FollowersName != null) // { // FollowersName = FollowersName.Distinct().ToList(); // } // if (FollowersName.Contains(objPinUser.ScreenName)) // { // FollowersName.Remove(objPinUser.ScreenName); // } // //listFollowersFromDatabse.Add("gunde"); // List<string> listUnfollowers = listFollowersFromDatabse.Except(FollowersName).ToList(); //// GlobusLogHelper.log.Info(listUnfollowers.Count + " users Unfollowed Account : " + screen_Name); // string UnfollowersList = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\PInterestUnfollowersList.csv"; // //write unfollowers list to csv // if (!System.IO.File.Exists(UnfollowersList)) //* CSV Header *// // { // try // { // string dataFormat = "Account_ScreenName" + "," + "UnfollowerUsername"; // GlobusFileHelper.AppendStringToTextfileNewLine(dataFormat, UnfollowersList); //dataFormat // } // catch (Exception ex) { }; // } // foreach (string unfollower in listUnfollowers) // { // try // { // string dataFormat = objPinUser.ScreenName + "," + unfollower; // GlobusFileHelper.AppendStringToTextfileNewLine(dataFormat, UnfollowersList); //dataFormat // //GlobusLogHelper.log.Info("Unfollower : " + unfollower + " for Account : " + screen_Name + " written to file " + UnfollowersList); // } // catch (Exception ex) { }; // try // { // QueryExecuter.deleteFollower(objPinUser.ScreenName, unfollower); // //GlobusLogHelper.log.Info("Unfollower : " + unfollower + " for Account : " + screen_Name + " deleted from Databse"); // } // catch { } // } // List<string> listNewFollowers = FollowersName.Except(listFollowersFromDatabse).ToList(); //// GlobusLogHelper.log.Info(listNewFollowers.Count + " NEW Followers for Account : " + screen_Name + ""); // foreach (string follName_item in listNewFollowers) // { // try // { // QueryExecuter.insertFollowerName(objPinUser.ScreenName, follName_item); // //GlobusLogHelper.log.Info("New follower : " + follName_item + " for Account : " + screen_Name + " added to Databse"); // } // catch { } // } #endregion string follower = GetFollowercount(objPinUser.ScreenName, ref objPinUser); string following = GetFollowingCount(objPinUser.ScreenName, ref objPinUser); //string BOARDS = GetBoard(objPinUser.ScreenName, ref objPinUser); //Globals.followingCountLogin = int.Parse(PinterestAccountManager.getBetween(following, "value'>", "</span>")); string followingCount = following; string BOARDS = string.Empty; string BoardsName = string.Empty; List<string> BOARDSNAMES = new List<string>(); List<string> lstBoardNamesNew = new List<string>(); if (inviteStart) { BOARDSNAMES = GetAllBoardNames_new1(objPinUser.ScreenName, ref objPinUser); foreach (var itemBoardNames in BOARDSNAMES) { lstBoardNamesNew.Add(itemBoardNames.ToLower().Replace(" ", "-")); } objPinUser.Boards = lstBoardNamesNew; } inviteStart = true; try { foreach (string item_BoardNames in BOARDSNAMES) { BoardsName += item_BoardNames + (":").ToString(); } } catch { } try { try { QueryExecuter.updatetb_emails(follower, followingCount, BOARDS, BoardsName, objPinUser.ScreenName, Username, objPinUser.LoginStatus); } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } //objUploadAccount.AccounLoad(); objDelegateAccountLoad(); } catch { } } catch { } string[] ArrData = System.Text.RegularExpressions.Regex.Split(AfterLoginPageSource, "username"); foreach (var item in ArrData) { try { if (item.Contains("{\"page_info")) { continue; } if (!item.StartsWith("\": null,") && !item.StartsWith("{\"request_identifier\"")) { int startindex = item.IndexOf(":"); int endindex = item.IndexOf("\", \""); this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); break; } if (item.Contains("locale"))// && item.Contains("P.currentUser.set")) { int startindex = item.IndexOf(":"); int endindex = item.IndexOf("\", \""); this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); break; } else if (item.Contains("name\": \"AuthHomePage")) { int startindex = item.IndexOf(":"); int endindex = item.IndexOf("\", \""); this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("\"", string.Empty).Trim(); } } catch (Exception ex) { } } try { if (ArrData.Count() == 2 && string.IsNullOrEmpty(Name)) { int startindex = ArrData[1].IndexOf(":"); int endindex = ArrData[1].IndexOf("\", \""); this.Name = ArrData[1].Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); } } catch (Exception ex) { } } catch (Exception ex) { this.Name = string.Empty; } } if (this.LoggedIn) { return true; } } catch (Exception ex) { } return false; }
public bool RepinwithMessage(string PinId, string myMessage, string Board, string NumberOfPage, ref PinInterestUser objPinUser) { try { string getPinPageSource = string.Empty; string pinUrl = string.Empty; string url = "https://www.pinterest.com/pin/" + PinId; string CheckPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(url), "", string.Empty, ""); if (!CheckPinPageSource.Contains("<div>Something went wrong!</div>") && !CheckPinPageSource.Contains("<div>Sorry. We've let our engineers know.</div>") && !CheckPinPageSource.Contains("<div>Whoops! We couldn't find that page.</div>") && !CheckPinPageSource.Contains("<div class=\"suggestionText\">How about these instead?</div>")) { pinUrl = "https://www.pinterest.com/pin/" + PinId + "/"; } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Pin " + PinId + " Is InCorrect ]"); } try { if (!string.IsNullOrEmpty(Globals.ItemSelect)) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + "In" + Globals.ItemSelect + " ]"); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " ]"); } } catch { }; try { GlobusHttpHelper objhttp = new GlobusHttpHelper(); getPinPageSource = objhttp.getHtmlfromUrl(new Uri(pinUrl), "", "", ""); } catch { }; string description = string.Empty; string link = string.Empty; string boardId = string.Empty; string RepinPagesource = string.Empty; string appVersion = string.Empty; try { if (getPinPageSource.Contains("description_html")) { description = Utils.Utils.getBetween(getPinPageSource, "description_html\":", ", \"title\":").Replace("\"", "").Replace("&", "%26").Trim(); description = description.Replace(" ", "+").Replace(",", "%2C").Replace("amp;", ""); } if (getPinPageSource.Contains("serving_link")) { link = Utils.Utils.getBetween(getPinPageSource, "serving_link\":", ", \"is_promoted").Replace("\"", "").Trim(); link = link.Replace(":", "%3A").Replace("/", "%2F").Replace("?", "%3F").Replace("=", "%3D").Replace("&", "%26"); } if (getPinPageSource.Contains("board_id")) { try { if (string.IsNullOrEmpty(Board)) { Random rnd = new Random(); int BoardNum = rnd.Next(0, objPinUser.Boards.Count - 1); boardId = objPinUser.Boards[BoardNum]; } else { boardId = Board; } if (string.IsNullOrEmpty(boardId.ToString())) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [Board is not present in your account , can't repin]"); return false; } } catch (Exception) { } } else if (getPinPageSource.Contains("board")) { boardId = Board; } lock (Lock_RepinonBoard) { string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); if (Checking.Contains("profileName")) { if (Checking.Contains("profileName")) { appVersion = Utils.Utils.getBetween(Checking, "\"app_version\": \"", "\", \""); } } else { ObjAccountManager.LoginPinterestAccount(ref objPinUser); } string RedirectUrl = GlobusHttpHelper.valueURl.Split('.')[0]; string newHomePage = RedirectUrl + ".pinterest.com"; string linkurl = string.Empty; string RepinpostData = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22pin_id%22%3A%22" + PinId + "%22%2C%22description%22%3A%22" + myMessage + "%22%2C%22link%22%3A%22" + link + "%22%2C%22is_video%22%3Afalse%2C%22board_id%22%3A%22" + Board + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=Modal()%3EPinCreate3(resource%3DPinResource(id%3D" + PinId + "))%3EBoardPicker(resource%3DBoardPickerBoardsResource(filter%3Dall))%3ESelectList(view_type%3DpinCreate3%2C+selected_section_index%3Dundefined%2C+selected_item_index%3Dundefined%2C+highlight_matched_text%3Dtrue%2C+suppress_hover_events%3Dundefined%2C+item_module%3D%5Bobject+Object%5D)"; string PostPageUrl = RedirectUrl + ".pinterest.com/resource/RepinResource/create/"; try { RepinPagesource = objPinUser.globusHttpHelper.postFormDataProxyREPin(new Uri(PostPageUrl), RepinpostData, newHomePage, objPinUser.App_version); } catch (Exception ex) { } if (string.IsNullOrEmpty(RepinPagesource)) { try { if (getPinPageSource.Contains("class=\"sourceFlagWrapper")) { try { BaseLib.GlobusRegex rgx = new GlobusRegex(); string urldata = System.Text.RegularExpressions.Regex.Split(System.Text.RegularExpressions.Regex.Split(getPinPageSource, "sourceFlagWrapper")[1], "</a>")[0]; linkurl = rgx.GetHrefUrlTag(urldata).Replace("href=\"", string.Empty); } catch (Exception ex) { } } else if (string.IsNullOrEmpty(linkurl)) { try { string urldata = System.Text.RegularExpressions.Regex.Split(System.Text.RegularExpressions.Regex.Split(getPinPageSource, "sourceFlagWrapper")[1], "</a>")[0]; string Datavalue = urldata.Substring(urldata.IndexOf("href=\\\"")); int startindex = Datavalue.IndexOf("href=\\\""); string start = Datavalue.Substring(startindex).Replace("href=\\\"", ""); int endindex = start.IndexOf("\\\""); string end = start.Substring(0, endindex); linkurl = end;// Datavalue.Substring(0, Datavalue.IndexOf("\\\">")).Replace("\\", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("href=\"", string.Empty); } catch { }; } try { string postdata1 = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + Board + "%22%2C%22description%22%3A%22" + myMessage + "%22%2C%22link%22%3A%22" + Uri.EscapeDataString(linkurl) + "%22%2C%22is_video%22%3Afalse%2C%22pin_id%22%3A%22" + PinId + "%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22" + objPinUser.App_version + "%22%2C%22https_exp%22%3Afalse%7D%7D&module_path=App()%3ECloseup(resource%3DPinResource(id%3D" + PinId + "))%3EPinActionBar(resource%3DPinResource(id%3D" + PinId + "))%3EShowModalButton(module%3DPinCreate)%23Modal(module%3DPinCreate(resource%3DPinResource(id%3D" + PinId + ")))"; string afterposting = objPinUser.globusHttpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/RepinResource/create/"), postdata1, "http://www.pinterest.com/pin/" + PinId + "/", "", 0, "", ""); if (!afterposting.Contains("<div>Uh oh! Something went wrong.")) { return true; } return false; } catch (Exception ex) { }; } catch (Exception ex) { } } if (!string.IsNullOrEmpty(RepinPagesource)) { try { if (!string.IsNullOrEmpty(Globals.ItemSelect)) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " In " + Globals.ItemSelect + " is Done. ]"); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " is Done. ]"); } } catch { }; return true; } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " is Failed. ]"); return false; } } } catch { }; return false; } catch (Exception Ex) { return false; } }