public string LoginNewScraperFollower(ref InstagramAccountManager _GlobusHttpHelper) { if (string.IsNullOrEmpty(proxyPort)) { proxyPort = "0"; } //proxyAddress = "60.169.78.218"; //proxyPort = "808"; Log("[ " + DateTime.Now + " ] => [ Logging in with Account : " + Username + " ]"); string Status = "Failed"; try { string secondURL = "https://instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes"; //string res_secondURL = _GlobusHttpHelper.getHtmlfromUrlProxy(new Uri(secondURL), proxyAddress, 80, proxyUsername, proxyPassword); string res_secondURL = string.Empty; string res_nextUrl = _GlobusHttpHelper.httpHelper.getHtmlfromUrlProxy(new Uri("http://websta.me/login"), proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); //Get Token Number of Id int FirstPointToken_nextUrl = res_nextUrl.IndexOf("csrfmiddlewaretoken"); string FirstTokenSubString_nextUrl = res_nextUrl.Substring(FirstPointToken_nextUrl); int SecondPointToken_nextUrl = FirstTokenSubString_nextUrl.IndexOf("/>"); this.Token = FirstTokenSubString_nextUrl.Substring(0, SecondPointToken_nextUrl).Replace("csrfmiddlewaretoken", string.Empty).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("'", string.Empty).Trim(); string login = "******"; string postdata_Login = "******" + this.Token + "&username="******"&password="******""; //string res_postdata_Login = _GlobusHttpHelper.postFormData(new Uri(login), postdata_Login, login, ""); string res_postdata_Login = _GlobusHttpHelper.httpHelper.postFormDataRefererProxy(new Uri(login), postdata_Login, login, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); if (res_postdata_Login.Contains("Please enter a correct username and password")) { Status = "Failed"; this.LoggedIn = false; } else if (res_postdata_Login.Contains("requesting access to your Instagram account") || postdata_Login.Contains("is requesting to do the following")) { Status = "AccessIssue"; } else if (res_postdata_Login.Contains("logout") || postdata_Login.Contains("LOG OUT")) { Status = "Success"; Log("[ " + DateTime.Now + " ] => [ Logged in with Account :" + Username + " ]"); this.LoggedIn = true; } //nameval.Clear(); return(Status); } catch (Exception ex) { return(ex.Message); } }
public string Allow(ref InstagramAccountManager accountManager) { NameValueCollection nameval = new NameValueCollection(); string UserName = accountManager.Username; if (!UserName.Contains("http://web.stagram.com/")) { UserName = "******" + UserName + "/"; } //string UserPageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(UserName), "", ""); //int FirstPointToken = UserPageContent.IndexOf("follow_button\"><span"); //string FirstTokenSubString = UserPageContent.Substring(FirstPointToken); //int SecondPointToken = FirstTokenSubString.IndexOf(">Follow"); //string PK = FirstTokenSubString.Substring(0, SecondPointToken).Replace("csrfmiddlewaretoken", string.Empty).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("'", string.Empty).Replace("follow_button>", string.Empty).Replace("<span", string.Empty).Replace("class=", string.Empty).Trim(); string OauthUrl = "https://instagram.com/oauth/authorize/?client_id=" + accountManager.ClientId + "&redirect_uri=http://web.stagram.com/&response_type=code&scope=likes+comments+relationships"; string PostData = "csrfmiddlewaretoken=" + accountManager.Token + "&allow=Authorize"; //nameval.Add("Origin", "https://instagram.com"); string AllowedPageSource = accountManager.httpHelper.postFormData(new Uri(OauthUrl), PostData, OauthUrl, nameval); string UserPageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(UserName), "", "", accountManager.proxyAddress); if (UserPageContent.Contains("LOGOUT")) { return("Allowed"); } else { return("NotAllowed"); } }
private void unfollowListMultiThreaded(object parameters) { try { UnfollowListListThread.Add(Thread.CurrentThread); UnfollowListListThread.Distinct(); Thread.CurrentThread.IsBackground = true; } catch { } try { Array paramArray = new object[1]; paramArray = (Array)parameters; string AccountName = string.Empty; try { AccountName = paramArray.GetValue(0).ToString(); } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => unfollowListMultiThreaded :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); } string AccountPass = string.Empty; try { AccountPass = paramArray.GetValue(1).ToString(); } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => unfollowListMultiThreaded :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); } string account = AccountName + ":" + AccountPass; InstagramManager.Classes.InstagramAccountManager InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(AccountName, AccountPass, "", "", "", ""); string statuse = InstagramAccountManager.MyLoginandComment(ref InstagramAccountManager.httpHelper, "", "", ""); AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Logged In success with " + InstagramAccountManager.Username + " ]"); AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Starting UnFollow With : " + InstagramAccountManager.Username + " ]"); if (InstagramAccountManager.LoggedIn == true) { foreach (string item in ClGlobul.lstUnfollowerList) { try { unfollowAccount(ref InstagramAccountManager, item); if (!string.IsNullOrEmpty(textmindelay.Text) && NumberHelper.ValidateNumber(textmindelay.Text)) { mindelay = Convert.ToInt32(textmindelay.Text); } if (!string.IsNullOrEmpty(textmaxdelay.Text) && NumberHelper.ValidateNumber(textmaxdelay.Text)) { maxdelay = Convert.ToInt32(textmaxdelay.Text); } lock (_lockObject) { Random rn = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = rn.Next(mindelay,maxdelay); AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => unfollowListMultiThreaded :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); } } AddToUnfollowLogger("[ " + DateTime.Now + " ] => [Process Completed from " + InstagramAccountManager.Username + " ]"); } else if (statuse.Contains("Failed")) { AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " Failed To Login ]"); } else if (statuse.Contains("AccessIssue")) { AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " Access Issue In Login ]"); } else if (statuse.Contains("Stream was not readable.")) { AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " Error in Post Data ]"); } else if (statuse.Contains("The request was aborted: The operation has timed out.")) { AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " Operation timed Out To Slow Request ]"); } else if (statuse.Contains("503")) { AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " Failed To Login ]"); } else if (statuse.Contains("403")) { AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " Failed To Login ]"); } else if (statuse.Contains("Please enter a correct username and password.")) { AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " : Incorect Username Or Password ]"); } else if (statuse.Contains("Please enter a correct username and password.")) { AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " : Incorect Username Or Password ]"); } else { AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Could Not Login With :" + InstagramAccountManager.Username + " ]"); } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => unfollowListMultiThreaded :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); } }
public string Comment(string commentId, string CommentMsg, ref InstagramAccountManager accountManager) { NameValueCollection namevalue = new NameValueCollection(); string FollowedPageSource = string.Empty; try { string CommentIdlink = string.Empty; string commentIdLoggedInLink = string.Empty; if (commentId.Contains("http://websta.me/p/")) { commentId = commentId.Replace("http://websta.me/p/", string.Empty); } if (!commentId.Contains("http://web.stagram.com/")) { try { CommentIdlink = "http://web.stagram.com/p/" + commentId + "/"; commentIdLoggedInLink = "http://websta.me/p/" + commentId; } catch(Exception ex) { return ex.Message; } } #region Change //GlobusHttpHelper _GlobusHttpHelper = new GlobusHttpHelper(); //ChilkatHttpHelpr _ChilkatHttpHelpr = new ChilkatHttpHelpr(); //InstagramAccountManager _InstagramAccountManager = new InstagramAccountManager(accountManager.Username, accountManager.Password, accountManager.proxyAddress, accountManager.proxyPassword, accountManager.proxyUsername, accountManager.proxyPassword); string url = "http://websta.me/api/comments/" + commentId; bool checkunicode = ContainsUnicodeCharacter(CommentMsg); string CmntMSG = string.Empty; if (checkunicode == false) { try { CmntMSG = CommentMsg.Replace(" ", "+"); } catch(Exception ex) { return ex.Message; }; } else { try { CmntMSG = Uri.EscapeDataString(CommentMsg); } catch(Exception ex) { return ex.Message; }; } // string commentPostData = "comment=+" + CmntMSG + "&media_id=" + commentId; try { string commentPostData = "comment=+++" + CmntMSG + "&media_id=" + commentId; FollowedPageSource = accountManager.httpHelper.postFormData(new Uri(url), commentPostData, CommentIdlink, ""); } catch(Exception ex) { return ex.Message; } if (FollowedPageSource.Contains("status\":\"OK\"") || FollowedPageSource.Contains("created_time")) { try { FollowedPageSource = "Success"; } catch(Exception ex) { return ex.Message; }; } else { try { FollowedPageSource = "Fail"; } catch(Exception ex) { return ex.Message; }; } #endregion #region commented //string firstUrl = "https://api.instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes"; //string secondURL = "https://instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes"; //string res_secondURL =_InstagramAccountManager.httpHelper.getHtmlfromUrlProxy(new Uri(secondURL), proxyAddress, 80, proxyUsername, proxyPassword); //string nextUrl = "https://instagram.com/accounts/login/?force_classic_login=&next=/oauth/authorize/%3Fclient_id%3D9d836570317f4c18bca0db6d2ac38e29%26redirect_uri%3Dhttp%3A//websta.me/%26response_type%3Dcode%26scope%3Dcomments%2Brelationships%2Blikes"; //string res_nextUrl = _InstagramAccountManager.httpHelper.getHtmlfromUrlProxy(new Uri(nextUrl), proxyAddress, 80, proxyUsername, proxyPassword); //int FirstPointToken_nextUrl = res_nextUrl.IndexOf("csrfmiddlewaretoken"); //string FirstTokenSubString_nextUrl = res_nextUrl.Substring(FirstPointToken_nextUrl); //int SecondPointToken_nextUrl = FirstTokenSubString_nextUrl.IndexOf("/>"); //string Token = FirstTokenSubString_nextUrl.Substring(0, SecondPointToken_nextUrl).Replace("csrfmiddlewaretoken", string.Empty).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("'", string.Empty).Trim(); //string Token = string.Empty; //try //{ // Token = getBetween(res_nextUrl, "accessToken', '", "')"); //} //catch { } //string login = "******"; //string postdata_Login = "******" + Token + "&username="******"&password="******""; //string res_postdata_Login = _InstagramAccountManager.httpHelper.postFormData(new Uri(login), postdata_Login, login, ""); //string PageContent = string.Empty; //PageContent = _GlobusHttpHelper.getHtmlfromUrl(new Uri(commentIdLoggedInLink), "", "", _InstagramAccountManager.proxyPassword); ////if (res_postdata_Login.Contains("logout") || postdata_Login.Contains("LOG OUT")) ////{ //// PageContent = _InstagramAccountManager.httpHelper.getHtmlfromUrl(new Uri(CommentIdlink), "", "", accountManager.proxyPassword); ////PageContent = _InstagramAccountManager.httpHelper.getHtmlfromUrl(new Uri(commentIdLoggedInLink)); //PageContent = _GlobusHttpHelper.getHtmlfromUrl(new Uri(CommentIdlink), "", "", accountManager.proxyPassword); //PageContent = _GlobusHttpHelper.getHtmlfromUrl(new Uri(commentIdLoggedInLink)); ////} //string PageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(CommentIdlink), "", "", accountManager.proxyAddress); //string PageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(CommentIdlink), "", "", accountManager.proxyPassword); // if (PageContent.Contains("id=\"textarea")) // if (PageContent.Contains("<div class=\"comments")) //{ //check unicode character //if (success.Equals("Success")) //{ // bool checkunicode = ContainsUnicodeCharacter(CommentMsg); // string CmntMSG = string.Empty; // if (checkunicode == false) // { // CmntMSG = CommentMsg.Replace(" ", "+"); // } // else // { // CmntMSG = Uri.EscapeDataString(CommentMsg); // } // string commentPostData = "comment=+" + CmntMSG + "&media_id=" + commentId; // FollowedPageSource=_GlobusHttpHelper.postFormData(new Uri("http://websta.me/api/comments/" + commentId),commentPostData,commentIdLoggedInLink,""); // //string commentPostData = ("message=" + CmntMSG + "&messageid=" + commentId + "&t=" + RandomNumber() + "").Trim(); // //string commentPostData = "comment=+" + CmntMSG + "&media_id="+commentId; // // string commentPostData = ("comment=+" + CmntMSG + "&media_id=" + commentId + "".Trim()); // // // comment=+heloo&media_id=815573304185069562_3373974 // // //comment=+hi&media_id=815582504685487428_17999944 // // //namevalue.Add("Accept-Language", "en-us,en;q=0.5"); // // namevalue.Add("Accept-Language", "en-US,en;q=0.8"); // // namevalue.Add("Accept-Encoding", "gzip,deflate"); // // namevalue.Add("X-Requested-With", "XMLHttpRequest"); // // //namevalue.Add("Origin", "http://web.stagram.com"); // // namevalue.Add("Origin", "http://websta.me"); // // namevalue.Add("X-Requested-With", "XMLHttpRequest"); // //// FollowedPageSource = accountManager.httpHelper.postFormDataForFollowUser(new Uri("http://web.stagram.com/post_comment/"), commentPostData, CommentIdlink, namevalue); // // //FollowedPageSource = accountManager.httpHelper.postFormDataForFollowUser(new Uri("http://websta.me/api/comments/"), commentPostData, CommentIdlink, namevalue); // // //FollowedPageSource = _GlobusHttpHelper.postFormDataForFollowUser(new Uri("http://websta.me/api/comments/"), commentPostData, CommentIdlink, namevalue); // // //FollowedPageSource = _InstagramAccountManager.httpHelper.postFormDataForFollowUser(new Uri("http://websta.me/api/comments/" + commentId), commentPostData, CommentIdlink, namevalue); // // //FollowedPageSource = _GlobusHttpHelper.postFormDataForFollowUserNew(new Uri("http://websta.me/api/comments/" + commentId), commentPostData, commentIdLoggedInLink, namevalue); //} #endregion #endregion try { if(DemoStagramPro.ClGlobul.checkHashTagComment == true) { try { DataBaseHandler.InsertQuery("insert into comment_hash_tag (account_holder, photo_id, comment_date, comment_status) values ('" + accountManager.Username + "','" + commentId + "','" + Convert.ToString(DateTime.Now) + "','" + FollowedPageSource + "')", "comment_hash_tag"); } catch(Exception ex) {} } } catch {} } catch { FollowedPageSource = string.Empty; } return FollowedPageSource; }
public string Comment(string commentId, string CommentMsg, ref InstagramAccountManager accountManager) { NameValueCollection namevalue = new NameValueCollection(); string FollowedPageSource = string.Empty; try { string CommentIdlink = string.Empty; string commentIdLoggedInLink = string.Empty; if (commentId.Contains("http://websta.me/p/")) { commentId = commentId.Replace("http://websta.me/p/", string.Empty); } if (!commentId.Contains("http://web.stagram.com/")) { try { CommentIdlink = "http://web.stagram.com/p/" + commentId + "/"; commentIdLoggedInLink = "http://websta.me/p/" + commentId; } catch (Exception ex) { return(ex.Message); } } #region Change //GlobusHttpHelper _GlobusHttpHelper = new GlobusHttpHelper(); //ChilkatHttpHelpr _ChilkatHttpHelpr = new ChilkatHttpHelpr(); //InstagramAccountManager _InstagramAccountManager = new InstagramAccountManager(accountManager.Username, accountManager.Password, accountManager.proxyAddress, accountManager.proxyPassword, accountManager.proxyUsername, accountManager.proxyPassword); string url = "http://websta.me/api/comments/" + commentId; bool checkunicode = ContainsUnicodeCharacter(CommentMsg); string CmntMSG = string.Empty; if (checkunicode == false) { try { CmntMSG = CommentMsg.Replace(" ", "+"); } catch (Exception ex) { return(ex.Message); }; } else { try { CmntMSG = Uri.EscapeDataString(CommentMsg); } catch (Exception ex) { return(ex.Message); }; } // string commentPostData = "comment=+" + CmntMSG + "&media_id=" + commentId; try { string commentPostData = "comment=+++" + CmntMSG + "&media_id=" + commentId; FollowedPageSource = accountManager.httpHelper.postFormData(new Uri(url), commentPostData, CommentIdlink, ""); } catch (Exception ex) { return(ex.Message); } if (FollowedPageSource.Contains("status\":\"OK\"") || FollowedPageSource.Contains("created_time")) { try { FollowedPageSource = "Success"; } catch (Exception ex) { return(ex.Message); }; } else { try { FollowedPageSource = "Fail"; } catch (Exception ex) { return(ex.Message); }; } #endregion #region commented //string firstUrl = "https://api.instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes"; //string secondURL = "https://instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes"; //string res_secondURL =_InstagramAccountManager.httpHelper.getHtmlfromUrlProxy(new Uri(secondURL), proxyAddress, 80, proxyUsername, proxyPassword); //string nextUrl = "https://instagram.com/accounts/login/?force_classic_login=&next=/oauth/authorize/%3Fclient_id%3D9d836570317f4c18bca0db6d2ac38e29%26redirect_uri%3Dhttp%3A//websta.me/%26response_type%3Dcode%26scope%3Dcomments%2Brelationships%2Blikes"; //string res_nextUrl = _InstagramAccountManager.httpHelper.getHtmlfromUrlProxy(new Uri(nextUrl), proxyAddress, 80, proxyUsername, proxyPassword); //int FirstPointToken_nextUrl = res_nextUrl.IndexOf("csrfmiddlewaretoken"); //string FirstTokenSubString_nextUrl = res_nextUrl.Substring(FirstPointToken_nextUrl); //int SecondPointToken_nextUrl = FirstTokenSubString_nextUrl.IndexOf("/>"); //string Token = FirstTokenSubString_nextUrl.Substring(0, SecondPointToken_nextUrl).Replace("csrfmiddlewaretoken", string.Empty).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("'", string.Empty).Trim(); //string Token = string.Empty; //try //{ // Token = getBetween(res_nextUrl, "accessToken', '", "')"); //} //catch { } //string login = "******"; //string postdata_Login = "******" + Token + "&username="******"&password="******""; //string res_postdata_Login = _InstagramAccountManager.httpHelper.postFormData(new Uri(login), postdata_Login, login, ""); //string PageContent = string.Empty; //PageContent = _GlobusHttpHelper.getHtmlfromUrl(new Uri(commentIdLoggedInLink), "", "", _InstagramAccountManager.proxyPassword); ////if (res_postdata_Login.Contains("logout") || postdata_Login.Contains("LOG OUT")) ////{ //// PageContent = _InstagramAccountManager.httpHelper.getHtmlfromUrl(new Uri(CommentIdlink), "", "", accountManager.proxyPassword); ////PageContent = _InstagramAccountManager.httpHelper.getHtmlfromUrl(new Uri(commentIdLoggedInLink)); //PageContent = _GlobusHttpHelper.getHtmlfromUrl(new Uri(CommentIdlink), "", "", accountManager.proxyPassword); //PageContent = _GlobusHttpHelper.getHtmlfromUrl(new Uri(commentIdLoggedInLink)); ////} //string PageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(CommentIdlink), "", "", accountManager.proxyAddress); //string PageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(CommentIdlink), "", "", accountManager.proxyPassword); // if (PageContent.Contains("id=\"textarea")) // if (PageContent.Contains("<div class=\"comments")) //{ //check unicode character //if (success.Equals("Success")) //{ // bool checkunicode = ContainsUnicodeCharacter(CommentMsg); // string CmntMSG = string.Empty; // if (checkunicode == false) // { // CmntMSG = CommentMsg.Replace(" ", "+"); // } // else // { // CmntMSG = Uri.EscapeDataString(CommentMsg); // } // string commentPostData = "comment=+" + CmntMSG + "&media_id=" + commentId; // FollowedPageSource=_GlobusHttpHelper.postFormData(new Uri("http://websta.me/api/comments/" + commentId),commentPostData,commentIdLoggedInLink,""); // //string commentPostData = ("message=" + CmntMSG + "&messageid=" + commentId + "&t=" + RandomNumber() + "").Trim(); // //string commentPostData = "comment=+" + CmntMSG + "&media_id="+commentId; // // string commentPostData = ("comment=+" + CmntMSG + "&media_id=" + commentId + "".Trim()); // // // comment=+heloo&media_id=815573304185069562_3373974 // // //comment=+hi&media_id=815582504685487428_17999944 // // //namevalue.Add("Accept-Language", "en-us,en;q=0.5"); // // namevalue.Add("Accept-Language", "en-US,en;q=0.8"); // // namevalue.Add("Accept-Encoding", "gzip,deflate"); // // namevalue.Add("X-Requested-With", "XMLHttpRequest"); // // //namevalue.Add("Origin", "http://web.stagram.com"); // // namevalue.Add("Origin", "http://websta.me"); // // namevalue.Add("X-Requested-With", "XMLHttpRequest"); // //// FollowedPageSource = accountManager.httpHelper.postFormDataForFollowUser(new Uri("http://web.stagram.com/post_comment/"), commentPostData, CommentIdlink, namevalue); // // //FollowedPageSource = accountManager.httpHelper.postFormDataForFollowUser(new Uri("http://websta.me/api/comments/"), commentPostData, CommentIdlink, namevalue); // // //FollowedPageSource = _GlobusHttpHelper.postFormDataForFollowUser(new Uri("http://websta.me/api/comments/"), commentPostData, CommentIdlink, namevalue); // // //FollowedPageSource = _InstagramAccountManager.httpHelper.postFormDataForFollowUser(new Uri("http://websta.me/api/comments/" + commentId), commentPostData, CommentIdlink, namevalue); // // //FollowedPageSource = _GlobusHttpHelper.postFormDataForFollowUserNew(new Uri("http://websta.me/api/comments/" + commentId), commentPostData, commentIdLoggedInLink, namevalue); //} #endregion #endregion try { if (DemoStagramPro.ClGlobul.checkHashTagComment == true) { try { DataBaseHandler.InsertQuery("insert into comment_hash_tag (account_holder, photo_id, comment_date, comment_status) values ('" + accountManager.Username + "','" + commentId + "','" + Convert.ToString(DateTime.Now) + "','" + FollowedPageSource + "')", "comment_hash_tag"); } catch (Exception ex) {} } } catch {} } catch { FollowedPageSource = string.Empty; } return(FollowedPageSource); }
public void LikeSnapsVideos(ref InstagramAccountManager accountManager, string url) { string user = accountManager.Username; string likeStatus = string.Empty; ClGlobul.checkHashTagLiker = true; InstagramPhotoLike objInstagramPhotoLike = new InstagramPhotoLike(); try { DataSet DS = DataBaseHandler.SelectQuery("select like_status from liker_hash_tag where account_holder ='" + user + "' and photo_id ='" + url.Replace("http://websta.me/p/", string.Empty) + "'", "liker_hash_tag"); if (DS.Tables[0].Rows.Count != 0) { likeStatus = DS.Tables[0].Rows[0].ItemArray[0].ToString(); } } catch(Exception ex) { } try { if (!(likeStatus == "LIKED")) { if (!(counterLike == ClGlobul.NumberofSnapsVideosToLike)) { string response = objInstagramPhotoLike.photolike(url, ref accountManager); Thread.Sleep(ClGlobul.hashTagDelay * 1000); counterLike++; if (response == "LIKED") { Log("[ " + DateTime.Now + "] " + "[ Snap/Video liked with url : " + url + " ]"); } else { Log("[ " + DateTime.Now + "] " + "[ Snap/Video not liked with url : " + url + " ]"); } } else { ClGlobul.isLikeLimitReached = true; Log("[ " + DateTime.Now + "] " + " [ " + ClGlobul.NumberofSnapsVideosToLike + " snaps/videos liked ]"); return; } } } catch(Exception ex) { } }
public void HashTagFollow(ref InstagramAccountManager accountManager, List<string> Usercount) { try { GloBoardPro.HasTagListListThread.Add(Thread.CurrentThread); GloBoardPro.HasTagListListThread.Distinct(); Thread.CurrentThread.IsBackground = true; } catch { } #region variables //List<string> Usercount = new List<string>(); #endregion variables #region commented #endregion try { frm_stagram objfrm_stagram = (frm_stagram)Application.OpenForms["frm_stagram"]; foreach (string urlToFollow in Usercount) { FollowUrls(ref accountManager, urlToFollow); Thread.Sleep(ClGlobul.hashTagDelay * 1000); if (!string.IsNullOrEmpty(objfrm_stagram.txtHashTagDelay.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtHashTagDelay.Text)) { mindelay = Convert.ToInt32(objfrm_stagram.txtHashTagDelay.Text); } if (!string.IsNullOrEmpty(objfrm_stagram.txtHashmaxTagDelay.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtHashmaxTagDelay.Text)) { maxdelay = Convert.ToInt32(objfrm_stagram.txtHashmaxTagDelay.Text); } Random obj_rn = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = obj_rn.Next(mindelay, maxdelay); Log("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); //Log("[ " + DateTime.Now + "] " + "[Delay is " + ClGlobul.hashTagDelay + " sec. ]"); } } catch (Exception ex) { } finally { //process completed. ClGlobul.countNoOFAccountHashFollower--; if (ClGlobul.countNoOFAccountHashFollower == 0) { Log("[ " + DateTime.Now + "] " + "[Process completed for Follow Using HashTag. ]"); } } }
public string Follow(string UserName, ref InstagramAccountManager accountManager) { NameValueCollection nameval = new NameValueCollection(); //ChilkatHttpHelpr chilaktHttpHelper = new ChilkatHttpHelpr(); if (!UserName.Contains("http://websta.me/n/")) { UserName = "******" + UserName + "/"; } string UserPageContent = string.Empty; if (!string.IsNullOrEmpty(accountManager.proxyAddress) && !string.IsNullOrEmpty(accountManager.proxyPort)) { try { UserPageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(UserName), accountManager.proxyAddress, Convert.ToInt32(accountManager.proxyPort), accountManager.proxyUsername, accountManager.proxyPassword); } catch (Exception ex) { } if (string.IsNullOrEmpty(UserPageContent)) { Thread.Sleep(1000); try { UserPageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(UserName), accountManager.proxyAddress, Convert.ToInt32(accountManager.proxyPort), accountManager.proxyUsername, accountManager.proxyPassword); } catch (Exception ex) { } } } else { try { UserPageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(UserName), "", 80, "", ""); } catch { }; if (string.IsNullOrEmpty(UserPageContent)) { Thread.Sleep(1000); try { UserPageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(UserName), "", 80, "", ""); } catch { }; } } try { //if (UserPageContent.Contains("This user is private.")) //{ // return "private"; //} string PK = string.Empty; if (UserPageContent.Contains("")) { PK = getBetween(UserPageContent, "id=\"follow_btn_wrapper\"", ">").Replace("data-target=", "").Replace("\"", "").Trim(); } if (string.IsNullOrEmpty(PK)) { PK = getBetween(UserPageContent, "id=\"message_user_id", ">").Replace(">", "").Replace("value=", string.Empty).Replace("\"", string.Empty).Trim();//.Replace("\"", "").Trim(); } string PostData = "action=follow";//"&pk=" + PK + "&t=9208"; string FollowedPageSource = string.Empty; if (!string.IsNullOrEmpty(PK)) { try { FollowedPageSource = accountManager.httpHelper.postFormData(new Uri("http://websta.me/api/relationships/" + PK), PostData, UserName, "http://websta.me"); } catch { } } if (string.IsNullOrEmpty(FollowedPageSource)) { } nameval.Add("Origin", "http://web.stagram.com"); nameval.Add("X-Requested-With", "XMLHttpRequest"); if (FollowedPageSource.Contains("OK")) { //return "Followed"; string status = string.Empty; try { status = QueryExecuter.getFollowStatus(accountManager.Username, UserName); } catch { } switch (status) { case "Followed": status = "Already Followed"; break; case "Unfollowed": status = "Unfollowed"; QueryExecuter.updateFollowStatus(accountManager.Username, UserName, "Followed"); break; default: status = "Followed"; try { QueryExecuter.insertFollowInfo(accountManager.Username, UserName, "Followed"); } catch { } break; } return(status); } else { return("UnFollowed"); } } catch (Exception) { return("Follow option is not available In page...!!"); } }
public void AccountChecker1(object Accounts) { try { if (!ThreadIs) { try { lst_Thread.Add(Thread.CurrentThread); lst_Thread.Distinct(); Thread.CurrentThread.IsBackground = true; } catch { } Array accountinfo = (Array)Accounts; string account = (string)accountinfo.GetValue(0); string pass = (string)accountinfo.GetValue(1); string ProxyValue = (string)accountinfo.GetValue(2); string[] proxyarray = ProxyValue.Split(':'); try { string proxyadd = string.Empty; string proxyport = string.Empty; string proxyUser = string.Empty; string proxyPass = string.Empty; if (proxyarray.Count() == 4) { proxyadd = proxyarray[0]; proxyport = proxyarray[1]; proxyUser = proxyarray[2]; proxyPass = proxyarray[3]; } else if (proxyarray.Count() == 2) { proxyadd = proxyarray[0]; proxyport = proxyarray[1]; } InstagramManager.Classes.InstagramAccountManager InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(account, pass, proxyadd, proxyport, proxyUser, proxyPass); // AddToLogger1("[ " + DateTime.Now + " ] => [ Logging In From Account : " + account + " ]"); // string statuse = InstagramAccountManager.MyLoginandComment(ref InstagramAccountManager.httpHelper, "", "", ""); string statuse = InstagramAccountManager.Login(); if (statuse == "Failed") { AddToLogger1("[ " + DateTime.Now + " ] => [ Login failed For : " + account + " ]"); GramBoardProFileHelper.AppendStringToTextfileNewLine(account + ":" + pass + ":" + proxyadd + ":" + proxyport + ":" + proxyUser + ":" + proxyPass, GramBoardProFileHelper.FailedAccounts); } else if (statuse == "AccessIssue") { AddToLogger1("[ " + DateTime.Now + " ] => [ Access Issue For : " + account + " ]"); GramBoardProFileHelper.AppendStringToTextfileNewLine(account + ":" + pass + ":" + proxyadd + ":" + proxyport + ":" + proxyUser + ":" + proxyPass, GramBoardProFileHelper.AccessIssuesAccounts); } else if (statuse == "Success") { //AddToLogger1("[ " + DateTime.Now + " ] => [ Login Successfull : " + account + " ]"); GramBoardProFileHelper.AppendStringToTextfileNewLine(account + ":" + pass + ":" + proxyadd + ":" + proxyport + ":" + proxyUser + ":" + proxyPass, GramBoardProFileHelper.successfullyLoggedaccounts); } else if (statuse == "Stream was not readable.") { AddToLogger1("[ " + DateTime.Now + " ] => [ Could Not Login With " + account + " ]"); GramBoardProFileHelper.AppendStringToTextfileNewLine(account + ":" + pass + ":" + proxyadd + ":" + proxyport + ":" + proxyUser + ":" + proxyPass, GramBoardProFileHelper.PostRequesterror); } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetLogin (1) :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePath); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath); } } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetLogin (2) :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePath); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath); } finally { count_ThreadControllerForFollow1--; lock (lockr_ThreadControllerForFollow1) { if (!ThreadIs) { Monitor.Pulse(lockr_ThreadControllerForFollow1); } } acc_checker_counter1--; if (acc_checker_counter1 == 0) { AddToLogger1("-----------------------------------------------------------------------------------------------"); AddToLogger1("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); AddToLogger1("-----------------------------------------------------------------------------------------------"); } } }
public string GetPictureCountAndLatestSnapUrlfollowing(ref InstagramAccountManager accountManager, string followingPageSource) { string retCountAndUrl = string.Empty; try { if (!ClGlobul.isStopScrapeFollowers) { Thread.CurrentThread.IsBackground = true; ClGlobul.lstThreadsScrapeFollowers.Add(Thread.CurrentThread); ClGlobul.lstThreadsScrapeFollowers = ClGlobul.lstThreadsScrapeFollowers.Distinct().ToList(); } else { retCountAndUrl = "stop"; return retCountAndUrl; } bool enterOnce = false; string rawLatestPostUrl = string.Empty; string latestPostUrl = string.Empty; int pictureCount = 0; string[] Picture_Split = Regex.Split(followingPageSource, "<div class=\"mainimg_wrapper\">"); foreach (string picture in Picture_Split) { if (!picture.Contains("<!DOCTYPE html>")) { if (!picture.Contains("fancy-video")) { if (!enterOnce) { rawLatestPostUrl = getBetween(picture, "<a href=\"", "\""); latestPostUrl = "http://websta.me" + rawLatestPostUrl; enterOnce = true; } pictureCount++; } } } string snapCount = pictureCount.ToString(); retCountAndUrl = latestPostUrl + "splitHere" + snapCount; } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetPictureCountAndLatestSnapUrl :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); } return retCountAndUrl; }
public void getloginForPhotoLike(object Accounts) { try { if (!PhotoLikeIstrueOrFals) { try { GloBoardPro.lstThread.Add(Thread.CurrentThread); Thread.CurrentThread.IsBackground = true; GloBoardPro.lstThread = GloBoardPro.lstThread.Distinct().ToList(); } catch { }; Array accountinfo = (Array)Accounts; string account = (string)accountinfo.GetValue(0); string pass = (string)accountinfo.GetValue(1); string ProxyValue = (string)accountinfo.GetValue(2); string proxyadd = string.Empty; string proxyport = string.Empty; string proxyUser = string.Empty; string proxyPass = string.Empty; if (!string.IsNullOrEmpty(ProxyValue)) { string[] proxyarray = ProxyValue.Split(':'); if (proxyarray.Count() == 4) { proxyadd = proxyarray[0]; proxyport = proxyarray[1]; proxyUser = proxyarray[2]; proxyPass = proxyarray[3]; } else if (proxyarray.Count() == 2) { proxyadd = proxyarray[0]; proxyport = proxyarray[1]; } else { AddToLogger("[ " + DateTime.Now + " ] => [ No Proxy for Account : " + account + " ]"); } } try { InstagramManager.Classes.InstagramAccountManager InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(account, pass, proxyadd, proxyport, proxyUser, proxyPass); string status = InstagramAccountManager.MyLoginandComment(ref InstagramAccountManager.httpHelper, "", "", ""); if (status.Contains("Stream was not readable.")) { status = InstagramAccountManager.MyLoginandComment(ref InstagramAccountManager.httpHelper, "", "", ""); } if (InstagramAccountManager.LoggedIn == true) { // AddTophotoLogger("[ " + DateTime.Now + " ] => [ Logged In From : " + InstagramAccountManager.Username + " ]"); // AddTophotoLogger("[ " + DateTime.Now + " ] => [ Starting Photo Like From : " + InstagramAccountManager.Username + " ]"); getPhotoLike(ref InstagramAccountManager); } else if (status.Contains("Failed")) { //AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); } else if (status.Contains("AccessIssue")) { // AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); } else if (status.Contains("Stream was not readable.")) { //AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); try { string removeingProxy = ClGlobul.finalProxyList.Where(e => e.Contains(ProxyValue)).ToArray()[0]; ClGlobul.finalProxyList.Remove(removeingProxy); } catch { }; } else if (status.Contains("The request was aborted: The operation has timed out.")) { // AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); } else if (status.Contains("503")) { // AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); } else if (status.Contains("403")) { // AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); } else { // AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetLoginForPhotoLikes (1):=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike); } } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetLoginForPhotoLikes (2) :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike); GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike); } finally { count_ThreadControllerForPhotoLike--; lock (lockr_ThreadControllerForPhotoLike) { if (!PhotoLikeIstrueOrFals) { Monitor.Pulse(lockr_ThreadControllerForPhotoLike); } } } }
public void getloginforFollow(object Accounts) { try { if (!ThreadIs) { try { lst_Thread.Add(Thread.CurrentThread); lst_Thread.Distinct(); Thread.CurrentThread.IsBackground = true; } catch { } Array accountinfo = (Array)Accounts; string account = (string)accountinfo.GetValue(0); string pass = (string)accountinfo.GetValue(1); string ProxyValue = (string)accountinfo.GetValue(2); List<string> TargetedUser = (List<string>)accountinfo.GetValue(3); string proxyadd = string.Empty; string proxyport = string.Empty; string proxyUser = string.Empty; string proxyPass = string.Empty; if (!string.IsNullOrEmpty(ProxyValue)) { string[] proxyarray = ProxyValue.Split(':'); if (proxyarray.Count() == 4) { proxyadd = proxyarray[0]; proxyport = proxyarray[1]; proxyUser = proxyarray[2]; proxyPass = proxyarray[3]; } else if (proxyarray.Count() == 2) { proxyadd = proxyarray[0]; proxyport = proxyarray[1]; } else { AddToLogger("[ " + DateTime.Now + " ] => [ No Proxy for Account : " + account + " ]"); } } try { InstagramManager.Classes.InstagramAccountManager InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(account, pass, proxyadd, proxyport, "", ""); // AddToLogger("[ " + DateTime.Now + " ] => [ Logging In With :" + InstagramAccountManager.Username + " ]"); string status = InstagramAccountManager.MyLoginandComment(ref InstagramAccountManager.httpHelper, "", "", ""); if (status.Contains("Stream was not readable")) { status = InstagramAccountManager.MyLoginandComment(ref InstagramAccountManager.httpHelper, "", "", ""); } if (InstagramAccountManager.LoggedIn == true) { //AddToLogger("[ " + DateTime.Now + " ] => [ Logged In success with " + InstagramAccountManager.Username + " ]"); //AddToLogger("[ " + DateTime.Now + " ] => [ Starting Follow With : " + InstagramAccountManager.Username + " ]"); getFollow(ref InstagramAccountManager, TargetedUser); } else if (status.Contains("Failed")) { // AddToLogger("[ " + DateTime.Now + " ] => [ " + account + " Failed To Login ]"); } else if (status.Contains("AccessIssue")) { // AddToLogger("[ " + DateTime.Now + " ] => [ " + account + " Access Issue In Login ]"); } else if (status.Contains("The request was aborted: The operation has timed out.")) { //AddToLogger("[ " + DateTime.Now + " ] => [ " + account + " Operation timed Out To Slow Request ]"); } else if (status.Contains("503")) { //AddToLogger("[ " + DateTime.Now + " ] => [ " + account + " Failed To Login ]"); } else if (status.Contains("403")) { // AddToLogger("[ " + DateTime.Now + " ] => [ " + account + " Failed To Login ]"); } else if (status.Contains("Please enter a correct username and password.")) { // AddToLogger("[ " + DateTime.Now + " ] => [ " + account + " : Incorect Username Or Password ]"); } else if (status.Contains("Please enter a correct username and password.")) { //AddToLogger("[ " + DateTime.Now + " ] => [ " + account + " : Incorect Username Or Password ]"); } else { //AddToLogger("[ " + DateTime.Now + " ] => [ Could Not Login With :" + InstagramAccountManager.Username + " ]"); } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetLogin (1) :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePath); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath); } } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetLogin (2) :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePath); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath); } finally { { count_ThreadControllerForFollow--; lock (lockr_ThreadControllerForFollow) { if (!ThreadIs) { Monitor.Pulse(lockr_ThreadControllerForFollow); } } } } }
public void getloginForComment(object Accounts) { string proxyadd = string.Empty; string proxyport = string.Empty; string proxyUser = string.Empty; string proxyPass = string.Empty; string account = string.Empty; string pass = string.Empty; InstagramManager.Classes.InstagramAccountManager InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(account, pass, proxyadd, proxyport, proxyUser, proxyPass); try { if (!CommentIstrueOrFals) { try { Lst_Commentthread.Add(Thread.CurrentThread); Lst_Commentthread = Lst_Commentthread.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getloginForComment :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); } Array accountinfo = (Array)Accounts; account = (string)accountinfo.GetValue(0); pass = (string)accountinfo.GetValue(1); string ProxyValue = (string)accountinfo.GetValue(2); string[] proxyarray = null; if (!string.IsNullOrEmpty(ProxyValue)) { proxyarray = ProxyValue.Split(':'); if (proxyarray.Count() > 2) { proxyadd = proxyarray[0]; proxyport = proxyarray[1]; proxyUser = proxyarray[2]; proxyPass = proxyarray[3]; } else { proxyadd = proxyarray[0]; proxyport = proxyarray[1]; } } try { //string proxyadd = string.Empty; //string proxyport = string.Empty; //string proxyUser = string.Empty; //string proxyPass = string.Empty; InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(account, pass, proxyadd, proxyport, proxyUser, proxyPass); #region My Code GlobDramProHttpHelper _GlobusHttpHelper = new GlobDramProHttpHelper(); #endregion InstagramAccountManager.logEvents.addToLogger += new EventHandler(logEvents_addToLogger); ///Get login from account.... //string statuse = InstagramAccountManager.Login(); //string statuse = InstagramAccountManager.MyLogin(ref _GlobusHttpHelper); string statuse = InstagramAccountManager.MyLoginandComment(ref InstagramAccountManager.httpHelper, "", "", ""); if (InstagramAccountManager.LoggedIn == true) { //get comment from Login account .... AddToCommentLogger("[ " + DateTime.Now + " ] => [ Logged in With " + account + " ]"); AddToCommentLogger("[ " + DateTime.Now + " ] => [ Starting Comment with " + account + " ]"); foreach (var CommentIdsForMSG_item in ClGlobul.CommentIdsForMSG) { getComment(ref InstagramAccountManager, CommentIdsForMSG_item); } } else if (statuse.Contains("Failed")) { AddToCommentLogger("[ " + DateTime.Now + " ] => [ Login Failed For " + account + " ]"); } else if (statuse.Contains("AccessIssue")) { AddToCommentLogger("[ " + DateTime.Now + " ] => [ Login Failed For " + account + " ]"); } else if (statuse.Contains("Stream was not readable.")) { //proxy is currect but have some login issues AddToCommentLogger("[ " + DateTime.Now + " ] => [ Stream was not readable. ]"); try { string removeingProxy = ClGlobul.finalProxyList.Where(e => e.Contains(proxyarray[0])).ToArray()[0]; ClGlobul.finalProxyList.Remove(removeingProxy); } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getloginForComment :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); }; } else if (statuse.Contains("The request was aborted: The operation has timed out.")) { //proxy is currect but request time out //AddToCommentLogger("The request was aborted: The operation has timed out."); AddToCommentLogger("[ " + DateTime.Now + " ] => [ Login Failed For " + account + " ]"); } else if (statuse.Contains("503")) { //some request problem AddToCommentLogger("[ " + DateTime.Now + " ] => [ Login Failed For " + account + " ]"); //AddToCommentLogger("503 some request problem /Server unavailable."); } else if (statuse.Contains("403")) { AddToCommentLogger("[ " + DateTime.Now + " ] => [ Login Failed For " + account + " ]"); //AddToCommentLogger("403"); } else { AddToCommentLogger("[ " + DateTime.Now + " ] => [ Login Failed For " + account + " ]"); } } catch (Exception ex) { //AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + account + " is not login Error : GetLoginForComment (1) => MSG :" + ex.Message + " ]"); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetLoginForComment (1):=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); } finally { InstagramAccountManager.logEvents.addToLogger -= new EventHandler(logEvents_addToLogger); } } } catch (Exception ex) { //AddTophotoLogger(DateTime.Now + ":=> Methode Name => GetLoginForComment (2) :=> " + ex.Message); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetLoginForComment (2) :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment); } finally { count_ThreadControllerForComment--; lock (lockr_ThreadControllerForComment) { if (!CommentIstrueOrFals) { Monitor.Pulse(lockr_ThreadControllerForComment); } } counter_comment--; if (counter_comment == 0) { AddToCommentLogger("----------------------------------------------------------------------------------------------------------------------------------"); AddToCommentLogger("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); AddToCommentLogger("----------------------------------------------------------------------------------------------------------------------------------"); } } }
public string photolike(string PhotoId, ref InstagramAccountManager accountManager) { NameValueCollection namevalue = new NameValueCollection(); string Photolink = string.Empty; string FollowedPageSource = string.Empty; string like = string.Empty; try { if (PhotoId.Contains("http://websta.me/p/")) { PhotoId = PhotoId.Replace("http://websta.me/p/", string.Empty); } if (!PhotoId.Contains("http://web.stagram.com/")) { Photolink = "http://websta.me/api/like/" + PhotoId + "/".Replace("http://websta.me/p/", ""); } else { Photolink = PhotoId; } //string PageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(Photolink), "", "", accountManager.proxyAddress); string PageContent = string.Empty; if (string.IsNullOrEmpty(accountManager.proxyPort)) { accountManager.proxyPort = "80"; } try { if (DemoStagramPro.ClGlobul.checkHashTagLiker == true) { PageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(Photolink)); } else { PageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(Photolink), accountManager.proxyAddress, Convert.ToInt32(accountManager.proxyPort), accountManager.proxyUsername, accountManager.proxyPassword); } } catch { } if (string.IsNullOrEmpty(PageContent)) { if (DemoStagramPro.ClGlobul.checkHashTagLiker == true) { PageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(Photolink)); } else { PageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(Photolink), "", 80, "", ""); } } if (PageContent.Contains("message\":\"LIKED\"")) { #region commented code //bool isContain = accountManager.httpHelper.CheckAttributeexsist(PageContent, "span", "dislike_button"); //if (PageContent.Contains("img/liked.png")) //{ // FollowedPageSource = "All ready LIKED"; //} //if (lstLikes.Count > 0) //{ // try // { // like = lstLikes[0]; // } // catch // { // } //} //if (like == "1") //{ // FollowedPageSource = "All ready LIKED"; //} //if (isContain) //{ // FollowedPageSource = "All ready LIKED"; //} //else //{ //string PostData = "&pk=" + PhotoId + "&t=653"; #endregion #region commented //string PostData = "&pk=" + PhotoId + "&t=" + RandomNumber() + ""; //namevalue.Add("Accept-Language", "en-us,en;q=0.5"); //namevalue.Add("X-Requested-With", "XMLHttpRequest"); //namevalue.Add("Origin", "http://web.stagram.com"); //namevalue.Add("X-Requested-With", "XMLHttpRequest"); //FollowedPageSource = accountManager.httpHelper.postFormDataForFollowUser(new Uri("http://web.stagram.com/do_like/"), PostData.Trim(), Photolink, namevalue); //if (FollowedPageSource.Contains("\"message\":null}")) //{ // FollowedPageSource = "All ready LIKED"; //} #endregion FollowedPageSource = "LIKED"; try { if (DemoStagramPro.ClGlobul.checkHashTagLiker == true) { try { DataBaseHandler.InsertQuery("insert into liker_hash_tag (account_holder, photo_id, like_date, like_status) values ('" + accountManager.Username + "','" + PhotoId + "','" + Convert.ToString(DateTime.Now) + "','" + FollowedPageSource + "')", "liker_hash_tag"); } catch { } } } catch (Exception ex) { } } else if (string.IsNullOrEmpty(FollowedPageSource)) { FollowedPageSource = "Already LIKED"; } } catch { } return(FollowedPageSource); }
private void unfollwMultiThreaded(object account) { try { try { Thread.CurrentThread.IsBackground = true; lst_Thread.Add(Thread.CurrentThread); lst_Thread = lst_Thread.Distinct().ToList(); } catch (Exception ex) { AddToUnfollowLogger("[" + DateTime.Now + "]=>[unfollwMultiThreaded 1"); } string accountDetails = string.Empty; try { accountDetails = (string)account; } catch { AddToUnfollowLogger("[" + DateTime.Now + "]=>[unfollwMultiThreaded 2"); } if (!string.IsNullOrEmpty(accountDetails)) { string[] arrAccounts; try { arrAccounts = Regex.Split(accountDetails, ":"); string userName = string.Empty; string password = string.Empty; string proxyAddress = string.Empty; string ProxyPort = string.Empty; try { if (arrAccounts.Count() == 6) { userName = arrAccounts[0]; password = arrAccounts[1]; proxyAddress = arrAccounts[2]; ProxyPort = arrAccounts[3]; } else if (arrAccounts.Count() == 4) { userName = arrAccounts[0]; password = arrAccounts[1]; proxyAddress = arrAccounts[2]; ProxyPort = arrAccounts[3]; } else { userName = arrAccounts[0]; password = arrAccounts[1]; } } catch { AddToUnfollowLogger("[" + DateTime.Now + "]=>[unfollwMultiThreaded 3"); } InstagramManager.Classes.InstagramAccountManager InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(userName, password, proxyAddress, ProxyPort, "", ""); if (_boolStopUnfollow) return; //AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Logging In With :" + InstagramAccountManager.Username + " ]"); //string statuse = InstagramAccountManager.Login(); string statuse = InstagramAccountManager.MyLoginForUnfollow(ref InstagramAccountManager.httpHelper, "", "", ""); if (InstagramAccountManager.LoggedIn == true) { try { if (_boolStopUnfollow) return; AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Logged In success with " + InstagramAccountManager.Username + " ]"); AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Starting UnFollow With : " + InstagramAccountManager.Username + " ]"); unFollow(ref InstagramAccountManager, statuse, proxyAddress, ProxyPort); } catch (Exception ex) { AddToUnfollowLogger("[" + DateTime.Now + "]=>[you already sent request to user & it seems to be private user"); } } else { if (_boolStopUnfollow) return; AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Not Logged In with " + InstagramAccountManager.Username + " ]"); AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Proxy is not working " + InstagramAccountManager.Username + " ]"); } } catch (Exception ex) { AddToUnfollowLogger("[" + DateTime.Now + "]=>[you already sent request to user & it seems to be private user"); } }//End of if (!string.IsNullOrEmpty(accountDetails)) else { // Account Details Empty; } } catch { AddToUnfollowLogger("[" + DateTime.Now + "]=>[you already sent request to user & it seems to be private user"); } }
private void unlike(object parameters) { try { try { GloBoardPro.lstThread.Add(Thread.CurrentThread); Thread.CurrentThread.IsBackground = true; GloBoardPro.lstThread = GloBoardPro.lstThread.Distinct().ToList(); } catch { }; unlikeCompletionCount++; Array accountinfo = (Array)parameters; string account = (string)accountinfo.GetValue(0); string UserName = string.Empty; string Password = string.Empty; UserName = Regex.Split(account, ":")[0]; Password = Regex.Split(account, ":")[1]; InstagramManager.Classes.InstagramAccountManager InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(UserName, Password, "", "", "", ""); string statuse = InstagramAccountManager.MyLoginandComment(ref InstagramAccountManager.httpHelper, "", "", ""); if (_boolUnlike) return; if (InstagramAccountManager.LoggedIn == true) { if (_boolUnlike) return; AddTophotoLogger("[ " + DateTime.Now + " ] => [ Logged In From : " + InstagramAccountManager.Username + " ]"); if (_boolUnlike) return; AddTophotoLogger("[ " + DateTime.Now + " ] => [ Starting Photo Unlike From : " + InstagramAccountManager.Username + " ]"); if (_boolUnlike) return; getPhotoUnlike(ref InstagramAccountManager); //break; } #region If-Else Conditions else if (statuse.Contains("Failed")) { if (_boolUnlike) return; AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); //break; } else if (statuse.Contains("AccessIssue")) { if (_boolUnlike) return; AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); //AddTophotoLogger("AccessIssue"); //break; } else if (statuse.Contains("Stream was not readable.")) { if (_boolUnlike) return; //proxy is currect but have some login issues //AddTophotoLogger(" Stream was not readable."); AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); //try //{ // string removeingProxy = ClGlobul.finalProxyList.Where(e => e.Contains(ProxyValue)).ToArray()[0]; // ClGlobul.finalProxyList.Remove(removeingProxy); //} //catch { }; //break; } else if (statuse.Contains("The request was aborted: The operation has timed out.")) { if (_boolUnlike) return; //proxy is currect but request time out AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); //AddTophotoLogger("The request was aborted: The operation has timed out."); //break; } else if (statuse.Contains("503")) { if (_boolUnlike) return; //some request problem //AddTophotoLogger("503 some request problem /Server unavailable."); AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); //break; } else if (statuse.Contains("403")) { if (_boolUnlike) return; AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); //AddTophotoLogger("403"); //break; } else { if (_boolUnlike) return; AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Login From : " + InstagramAccountManager.Username + " ]"); //AddTophotoLogger(account + " username and password is wrong."); // break; } #endregion } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => unlike :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike); GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike); } finally { unlikeCompletionCount--; lock (_lockObject) { if (unlikeCompletionCount == 0) { AddTophotoLogger("[ " + DateTime.Now + " ] => [ Process Completed ]"); } } } }
public void ScrapeFollowerDetails(ref InstagramAccountManager accountManager, string followerUrl, string usernameFollowerUrl) { try { if (!ClGlobul.isStopScrapeFollowers) { Thread.CurrentThread.IsBackground = true; ClGlobul.lstThreadsScrapeFollowers.Add(Thread.CurrentThread); ClGlobul.lstThreadsScrapeFollowers = ClGlobul.lstThreadsScrapeFollowers.Distinct().ToList(); } else { return; } Thread.Sleep(1000); string followerPageSource = accountManager.httpHelper.getHtmlfromUrl1(new Uri(followerUrl), usernameFollowerUrl); if (string.IsNullOrEmpty(followerPageSource)) { Thread.Sleep(10000); AddToScrapeFollowersLogger("[ " + DateTime.Now + "] => " + "[ Pagesource is empty. Delaying for 10 seconds. ]"); followerPageSource = accountManager.httpHelper.getHtmlfromUrl1(new Uri(followerUrl), usernameFollowerUrl); if (string.IsNullOrEmpty(followerPageSource)) { AddToScrapeFollowersLogger("[ " + DateTime.Now + "] => " + "[ Pagesource is still empty. Please restart the software. The process will resume. ]"); } } string followerUsername = getBetween(followerUrl + "@", ".me/n/", "@"); if (followerPageSource.Contains("This user is private.")) { AddToScrapeFollowersLogger("[ " + DateTime.Now + "] => " + "[ Data can not be scraped of the private user with user name : " + followerUsername + ". ]"); return; } string rawFollowerInfo = string.Empty; AddToScrapeFollowersLogger("[ " + DateTime.Now + "] => " + "[ Scraping detail from profile with username-" + followerUsername + " ]"); try { rawFollowerInfo = getBetween(followerPageSource, "<div class=\"userinfo\">", "</div>"); } catch { } string[] infoSplit = Regex.Split(rawFollowerInfo, "<li>"); string subFollowerCount = getBetween(infoSplit[2], "<span class=\"counts_followed_by\">", "</span>"); string subFollowingCount = getBetween(infoSplit[3], "<span class=\"following\">", "</span>"); string countAndLatestPostUrl = GetPictureCountAndLatestSnapUrlfollower(ref accountManager, followerPageSource); if (countAndLatestPostUrl == "stop") { return; } string[] count_SPlit_Url = Regex.Split(countAndLatestPostUrl, "splitHere"); string latestPostUrl = count_SPlit_Url[0].Trim(); string pictureCount = getBetween(followerPageSource, "\"counts_media\">", "</span>"); string latestPostPageResponse = accountManager.httpHelper.getHtmlfromUrl(new Uri(latestPostUrl), followerUrl); double uTimestamp = Convert.ToDouble(getBetween(latestPostPageResponse, "data-utime=\"", "\">")); DateTime rawDate = UnixTimeStampToDateTime(uTimestamp); string date = rawDate.ToString("dd-MM-yyyy"); string[] date_split = Regex.Split(date, "-"); string day = date_split[0].ToString(); string month = date_split[1].ToString(); string year = date_split[2].ToString(); DataBaseHandler.InsertQuery("insert into tb_scrape_follower(username, name, follower_count, following_count, picture_count, day, month, year) values('" + ClGlobul.scrapeFollowerAndFollowingUsername + "','" + followerUsername + "','" + subFollowerCount + "','" + subFollowingCount + "','" + pictureCount + "','" + day + "','" + month + "','" + year + "')", "tb_scrape_follower"); AddToScrapeFollowersLogger("[ " + DateTime.Now + "] => " + "[ Scraped detail saved of username-" + followerUsername + " ]"); if (!string.IsNullOrEmpty(followerUsername)) { #region CSV Write try { string CSVData = ClGlobul.scrapeFollowerAndFollowingUsername.Replace(",", string.Empty) + "," + followerUsername.Replace(",", string.Empty) + "," + subFollowerCount.Replace(",", string.Empty) + "," + subFollowingCount.Replace(",", string.Empty) + "," + pictureCount.Replace(",", string.Empty) + "," + day.Replace(",", string.Empty) + "," + month.Replace(",", string.Empty) + "," + year.Replace(",", string.Empty); GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSVData, CSVPath + ClGlobul.scrapeFollowerAndFollowingUsername +".csv"); } catch { } try { AddToScrapeFollowersLogger("[" + followerUsername + "," + "followerUsername:"******"," + subFollowingCount + "," + "subFollowingCount:" + "," + pictureCount + "," + "pictureCount" + "," + day + "," + "day" + "," + month + "," + "month" + "," + year + "," + "year]"); } catch { }; #endregion if (!string.IsNullOrEmpty(txtminScrapuser.Text) && NumberHelper.ValidateNumber(txtminScrapuser.Text)) { mindelay = Convert.ToInt32(txtminScrapuser.Text); } if (!string.IsNullOrEmpty(txtmaxscrapuser.Text) && NumberHelper.ValidateNumber(txtmaxscrapuser.Text)) { maxdelay = Convert.ToInt32(txtmaxscrapuser.Text); } lock (_lockObject) { int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => ScrapeFollowerDetails :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); } }
public void FollowUrls(ref InstagramAccountManager accountManager, string url) { //Thread.Sleep(2000); string followStatus = string.Empty; try { string user = accountManager.Username; InstagramFollow objInstagramFollow = new InstagramFollow(); try { DataSet DS = DataBaseHandler.SelectQuery("Select FollowStatus from FollowInfo where AccountHolder='" + user + "' and FollowingUser='******'", "FollowInfo"); if (DS.Tables[0].Rows.Count != 0) { followStatus = DS.Tables[0].Rows[0].ItemArray[0].ToString(); } } catch(Exception ex) { } if (!(followStatus == "Followed")) { //if (!(counterFollow == ClGlobul.NumberOfProfilesToFollow)) { string status = objInstagramFollow.Follow(url, ref accountManager); // Thread.Sleep(ClGlobul.hashTagDelay * 1000); counterFollow++; if (status == "Followed") { Log("[ " + DateTime.Now + "] " + "[ Profile followed with url : " + url + " with User = "******" ]"); } else { Log("[ " + DateTime.Now + "] " + "[ Profile not followed with url : " + url + " with User = "******" ]"); //Log("[ " + DateTime.Now + "] " + " [ " + ClGlobul.NumberOfProfilesToFollow + " profiles Unfollowed ]"); } } //else { //ClGlobul.isFollowLimitReached = true; //Log("[ " + DateTime.Now + "] " + " [ " + ClGlobul.NumberOfProfilesToFollow + " profiles followed ]"); // return; } } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnMsgFrom_Click() --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, GramBoardProFileHelper.ErrorLogFilePath); } }
public void ScrapeFollowingDetails(ref InstagramAccountManager accountManager, string followingUrl) { try { if (!ClGlobul.isStopScrapeFollowers) { Thread.CurrentThread.IsBackground = true; ClGlobul.lstThreadsScrapeFollowers.Add(Thread.CurrentThread); ClGlobul.lstThreadsScrapeFollowers = ClGlobul.lstThreadsScrapeFollowers.Distinct().ToList(); } else { return; } Thread.Sleep(1000); string followingPageSource = accountManager.httpHelper.getHtmlfromUrl(new Uri(followingUrl),""); string followingUsername = getBetween(followingUrl + "@", ".me/n/", "@"); AddToScrapeFollowersLogger("[ " + DateTime.Now + "] " + "[ Scraping detail from profile with username-" + followingUsername + " ]"); string rawFollowingInfo = getBetween(followingPageSource, "<div class=\"userinfo\">", "</div>"); string[] infoSplit = Regex.Split(rawFollowingInfo, "<li>"); string subFollowerCount = getBetween(infoSplit[2], "<span class=\"counts_followed_by\">", "</span>"); string subFollowingCount = getBetween(infoSplit[3], "<span class=\"following\">", "</span>"); string countAndLatestPostUrl = GetPictureCountAndLatestSnapUrlfollowing(ref accountManager, followingPageSource); if (countAndLatestPostUrl == "stop") { return; } string[] count_SPlit_Url = Regex.Split(countAndLatestPostUrl, "splitHere"); string latestPostUrl = count_SPlit_Url[0].Trim(); //string pictureCount = count_SPlit_Url[1].Trim(); string pictureCount = getBetween(followingPageSource, "\"counts_media\">", "</span>"); string latestPostPageResponse = accountManager.httpHelper.getHtmlfromUrl(new Uri(latestPostUrl),""); double uTimestamp = Convert.ToDouble(getBetween(latestPostPageResponse, "data-utime=\"", "\">")); DateTime rawDate = UnixTimeStampToDateTime(uTimestamp); string date = rawDate.ToString("dd-MM-yyyy"); string[] date_split = Regex.Split(date, "-"); string day = date_split[0].ToString(); string month = date_split[1].ToString(); string year = date_split[2].ToString(); DataBaseHandler.InsertQuery("insert into tb_scrape_following(username, name, follower_count, following_count, picture_count, day, month, year) values('" + ClGlobul.scrapeFollowerAndFollowingUsername + "','" + followingUsername + "','" + subFollowerCount + "','" + subFollowingCount + "','" + pictureCount + "','" + day + "','" + month + "','" + year + "')", "tb_scrape_following"); AddToScrapeFollowersLogger("[ " + DateTime.Now + "] " + "[ Scraped detail saved of username-" + followingUsername + " ]"); } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => ScrapeFollowingDetails :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); } }
//string hashTag public void HashTagLike(ref InstagramAccountManager accountManager, List<string> hashTag) { try { frm_stagram objfrm_stagram = (frm_stagram)Application.OpenForms["frm_stagram"]; foreach (string urlToLike in hashTag)//hashTag //snapsVideoUrl { LikeSnapsVideos(ref accountManager, urlToLike); Thread.Sleep(ClGlobul.hashTagFolloweDelay * 1000); if (!string.IsNullOrEmpty(objfrm_stagram.txtHashTagDelay.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtHashTagDelay.Text)) { mindelay = Convert.ToInt32(objfrm_stagram.txtHashTagDelay.Text); } if (!string.IsNullOrEmpty(objfrm_stagram.txtHashmaxTagDelay.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtHashmaxTagDelay.Text)) { maxdelay = Convert.ToInt32(objfrm_stagram.txtHashmaxTagDelay.Text); } Random obj_rn = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = obj_rn.Next(mindelay, maxdelay); Log("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); // Log("[ " + DateTime.Now + "] " + "[Delay is " + ClGlobul.hashTagDelay + " sec. ]"); } } catch(Exception ex) { } finally { //process completed. ClGlobul.countNOOfFollowersandImageDownload--; if (ClGlobul.countNOOfFollowersandImageDownload == 0) { Log("[ " + DateTime.Now + "] " + "[Process completed for Like Using HashTag. ]"); } } }
public void ScrapeFollowingUrl(ref InstagramAccountManager accountManager, string usernameFollowingUrl, string username) { List<string> listFollowing = new List<string>(); if (!ClGlobul.isStopScrapeFollowers) { Thread.CurrentThread.IsBackground = true; ClGlobul.lstThreadsScrapeFollowers.Add(Thread.CurrentThread); ClGlobul.lstThreadsScrapeFollowers = ClGlobul.lstThreadsScrapeFollowers.Distinct().ToList(); } else { return; } try { string followingListPgSource = string.Empty; DataSet DS = DataBaseHandler.SelectQuery("select url from tb_following_url where username='******' and used='no'", "tb_following_url"); if (DS.Tables[0].Rows.Count == 0) { followingListPgSource = accountManager.httpHelper.getHtmlfromUrl(new Uri(usernameFollowingUrl),""); } else { usernameFollowingUrl = DS.Tables[0].Rows[0]["url"].ToString(); followingListPgSource = accountManager.httpHelper.getHtmlfromUrl(new Uri(usernameFollowingUrl),""); DataBaseHandler.UpdateQuery("update tb_following_url set used='yes' where used='no'", "tb_following_url"); } followingListPgSource = accountManager.httpHelper.getHtmlfromUrl(new Uri(usernameFollowingUrl),""); string rawFollowingList = getBetween(followingListPgSource, "<ul class=\"userlist\">", "</ul>"); string[] followingListSplit = Regex.Split(rawFollowingList, "<li"); foreach (string item in followingListSplit) { if (item.Contains("<strong><a href")) { string followingName = getBetween(item, "<strong><a href=\"/n/", "\">"); listFollowing.Add(followingName); AddToScrapeFollowersLogger("[ " + DateTime.Now + "] => " + "[ Following Url added to scrape-" + followingName + " ]"); } } if (followingListPgSource.Contains("Next Page")) { string rawPagination = string.Empty; if (followingListPgSource.Contains("<ul class=\"pager\">")) { rawPagination = getBetween(followingListPgSource, "<ul class=\"pager\">", "Next Page"); } else { rawPagination = getBetween(followingListPgSource, "<ul class=\"pager nm\">", "Next Page"); } string[] paginationUrlSplit = Regex.Split(rawPagination, "<li>"); string rawPaginationUrl = getBetween(paginationUrlSplit[2], "<a href=\"", "\">"); string paginationUrl = "http://websta.me" + rawPaginationUrl; DataBaseHandler.InsertQuery("insert into tb_following_url (url, username, used) values ('" + paginationUrl + "','" + username + "','" + "no" + "')", "tb_following_url"); } else { ClGlobul.userOverFollowing = true; } listFollowing = listFollowing.Distinct().ToList(); foreach (string followingName in listFollowing) { string followingUrl = "http://websta.me/n/" + followingName; ScrapeFollowingDetails(ref accountManager, followingUrl); } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => ScrapeFollowingUrl :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); } }
public void CommentOnSnapsVideos(ref InstagramAccountManager accountManager, string url) { Comments objComments = new Comments(); InstagramPhotoLike objInstagramPhotoLike = new InstagramPhotoLike(); string message = string.Empty; ClGlobul.checkHashTagComment = true; string user = accountManager.Username; string commentStatus = string.Empty; string likeStatus = string.Empty; try { try { if (ClGlobul.HashCommentMessage.Count == ClGlobul.NumberofSnapsVideosToComment) { message = ClGlobul.HashCommentMessage[i]; i++; } else { message = ClGlobul.HashCommentMessage[RandomNumberGenerator.GenerateRandom(0, ClGlobul.HashCommentMessage.Count)]; } } catch (Exception ex) { } try { try { DataSet commentDS = DataBaseHandler.SelectQuery("select comment_status from comment_hash_tag where account_holder ='" + user + "' and photo_id = '" + url.Replace("http://websta.me/p/", string.Empty) + "'", "comment_hash_tag"); if (commentDS.Tables[0].Rows.Count != 0) { commentStatus = commentDS.Tables[0].Rows[0].ItemArray[0].ToString(); } } catch(Exception ex) { } try { DataSet likeDS = DataBaseHandler.SelectQuery("select like_status from liker_hash_tag where account_holder ='" + user + "' and photo_id ='" + url.Replace("http://websta.me/p/", string.Empty) + "'", "liker_hash_tag"); if (likeDS.Tables[0].Rows.Count != 0) { likeStatus = likeDS.Tables[0].Rows[0].ItemArray[0].ToString(); } } catch (Exception ex) { } } catch(Exception ex) {} if (!(commentStatus == "Success")) { if (!(counterComment == ClGlobul.NumberofSnapsVideosToComment)) { string status = objComments.Comment(url, message, ref accountManager); Thread.Sleep(ClGlobul.hashTagDelay * 1000); if (status == "Success") { Log("[ " + DateTime.Now + "] " + "[ Commented on snap/video with url : " + url + " with this message : " + message + " ]"); } else { Log("[ " + DateTime.Now + "] " + "[ Could not comment on snap/video with url : " + url + " ]"); } if (ClGlobul.isCommentAndLikeChecked == true) { if (!(likeStatus == "LIKED")) { ClGlobul.checkHashTagLiker = true; string photoStatus = objInstagramPhotoLike.photolike(url, ref accountManager); Thread.Sleep(ClGlobul.hashTagDelay * 1000); if (photoStatus == "LIKED") { Log("[ " + DateTime.Now + "] " + "[ Snap/Video liked with url : " + url + " ]"); } else { Log("[ " + DateTime.Now + "] " + "[ Snap/Video not liked with url : " + url + " ]"); } } else { Log("[ " + DateTime.Now + "] " + "[ Snap/video with url : " + url + " is already liked. ]"); } } counterComment++; } else { ClGlobul.isCommentLimitReached = true; Log("[ " + DateTime.Now + "] " + "[ Commented on " + ClGlobul.NumberofSnapsVideosToLike + " snaps/videos. "); return; } } } catch (Exception ex) { } }
public void StartScrapingFollowers(ref InstagramAccountManager accountManager, string username) { try { ClGlobul.switchAccount = false; if (!ClGlobul.isStopScrapeFollowers) { Thread.CurrentThread.IsBackground = true; ClGlobul.lstThreadsScrapeFollowers.Add(Thread.CurrentThread); ClGlobul.lstThreadsScrapeFollowers = ClGlobul.lstThreadsScrapeFollowers.Distinct().ToList(); } else { return; } string usernameUrl = "http://websta.me/n/" + username; string usernamePgSource = accountManager.httpHelper.getHtmlfromUrl(new Uri(usernameUrl), ""); string rawUsernameID = getBetween(usernamePgSource, "<div class=\"userinfo\">", "</div>"); string[] userInfoSplit = Regex.Split(rawUsernameID, "<li>"); string rawFollowerUrl = getBetween(userInfoSplit[2], "<a href=\"", "\">"); string rawFollowingUrl = getBetween(userInfoSplit[3], "<a href=\"", "\">"); string usernameFollowerUrl = "http://websta.me" + rawFollowerUrl; string usernameFollowingUrl = "http://websta.me" + rawFollowingUrl; string usernameFollowerCount = getBetween(userInfoSplit[2], "class=\"counts_followed_by\">", "</span>"); string usernameFollowingCount = getBetween(userInfoSplit[3], "class=\"following\">", "</span>"); AddToScrapeFollowersLogger("[ " + DateTime.Now + "] " + "[ Scraping Followers ]"); ScrapeFollowerUrl(ref accountManager, usernameFollowerUrl, username); //AddToScrapeFollowersLogger("[ " + DateTime.Now + "] " + "[ Scraping Following ]"); //ScrapeFollowingUrl(ref accountManager, usernameFollowingUrl, username); #region ExportData //if (!ClGlobul.isStopScrapeFollowers) //{ // string filePath = GramBoardProFileHelper.path_AppDataFolder + "\\" + username; // ExportData(filePath, username, "Follower"); // //MessageBox.Show("Follower Data Exported to CSV file with username : "******"."); // AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ Follower Data Exported to CSV file with username : "******" ]"); //} #endregion #region LoadCombobox DataSet DS = DataBaseHandler.SelectQuery("select distinct username from tb_scrape_follower", "tb_scrape_follower"); if (DS.Tables[0].Rows.Count != 0) { foreach (DataRow DR in DS.Tables[0].Rows) { cmbScrapeFollowersUsername.Invoke(new MethodInvoker(delegate { if (!cmbScrapeFollowersUsername.Items.Contains(DR[0].ToString())) { cmbScrapeFollowersUsername.Items.Add(DR[0].ToString()); } })); } } else { MessageBox.Show("No data present. Scrape first to choose from usernames."); } cmbScrapeFollowersSelection.Invoke(new MethodInvoker(delegate { if (!cmbScrapeFollowersSelection.Items.Contains("Follower")) { cmbScrapeFollowersSelection.Items.Add("Follower"); } if (!cmbScrapeFollowersSelection.Items.Contains("Following")) { cmbScrapeFollowersSelection.Items.Add("Following"); } })); cmbScrapeFollowersUsername.Invoke(new MethodInvoker(delegate { cmbScrapeFollowersUsername.SelectedIndex = 0; })); cmbScrapeFollowersSelection.Invoke(new MethodInvoker(delegate { cmbScrapeFollowersSelection.SelectedIndex = 0; })); #endregion } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => StartScrapingFollowers :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); } finally { if (!ClGlobul.isStopScrapeFollowers) { DataBaseHandler.UpdateQuery("update manage_time set process_status='yes' where process_status='no'", "manage_time"); AddToScrapeFollowersLogger("[ " + DateTime.Now + "] " + "[ Switching onto next account. ]"); ClGlobul.switchAccount = true; } if (ClGlobul.userOverFollower) { AddToScrapeFollowersLogger("[ " + DateTime.Now + "] => " + "[ Scraped all users who follows " + username + " ]"); } if (ClGlobul.userOverFollowing) { AddToScrapeFollowersLogger("[ " + DateTime.Now + "] => " + "[ Scraped all users who is followed by " + username + " ]"); } ClGlobul.oneHourProcessCompleted = true; } }
public string LoginNewScraperFollower(ref InstagramAccountManager _GlobusHttpHelper) { if (string.IsNullOrEmpty(proxyPort)) { proxyPort = "0"; } //proxyAddress = "60.169.78.218"; //proxyPort = "808"; Log("[ " + DateTime.Now + " ] => [ Logging in with Account : " + Username + " ]"); string Status = "Failed"; try { string secondURL = "https://instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes"; //string res_secondURL = _GlobusHttpHelper.getHtmlfromUrlProxy(new Uri(secondURL), proxyAddress, 80, proxyUsername, proxyPassword); string res_secondURL = string.Empty; string res_nextUrl = _GlobusHttpHelper.httpHelper.getHtmlfromUrlProxy(new Uri("http://websta.me/login"), proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); //Get Token Number of Id int FirstPointToken_nextUrl = res_nextUrl.IndexOf("csrfmiddlewaretoken"); string FirstTokenSubString_nextUrl = res_nextUrl.Substring(FirstPointToken_nextUrl); int SecondPointToken_nextUrl = FirstTokenSubString_nextUrl.IndexOf("/>"); this.Token = FirstTokenSubString_nextUrl.Substring(0, SecondPointToken_nextUrl).Replace("csrfmiddlewaretoken", string.Empty).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("'", string.Empty).Trim(); string login = "******"; string postdata_Login = "******" + this.Token + "&username="******"&password="******""; //string res_postdata_Login = _GlobusHttpHelper.postFormData(new Uri(login), postdata_Login, login, ""); string res_postdata_Login = _GlobusHttpHelper.httpHelper.postFormDataRefererProxy(new Uri(login), postdata_Login, login, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); if (res_postdata_Login.Contains("Please enter a correct username and password")) { Status = "Failed"; this.LoggedIn = false; } else if (res_postdata_Login.Contains("requesting access to your Instagram account") || postdata_Login.Contains("is requesting to do the following")) { Status = "AccessIssue"; } else if (res_postdata_Login.Contains("logout") || postdata_Login.Contains("LOG OUT")) { Status = "Success"; Log("[ " + DateTime.Now + " ] => [ Logged in with Account :" + Username + " ]"); this.LoggedIn = true; } //nameval.Clear(); return Status; } catch (Exception ex) { return ex.Message; } }
private void StartProcessScrapeFollower() { try { AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [Pleasewait ]"); List<List<string>> list_Accounts = new List<List<string>>(); acc_checker_counter = DemoStagramPro.ClGlobul.accountList.Count(); list_Accounts = ListUtilities.Split(DemoStagramPro.ClGlobul.accountList, Maxthread); ThreadPool.SetMaxThreads(5, 5); ClGlobul.listUsernameScrapeFollowers.Add(txtUsernameScrapeFollowers.Text); //GlobusHttpHelper httphelper = new GlobusHttpHelper(); if (!string.IsNullOrEmpty(txtUsernameScrapeFollowers.Text)) { if (ClGlobul.listUsernameScrapeFollowers.Count != 0) { if (!ClGlobul.isStopScrapeFollowers) { LoopBackAccount: string proxyadd = string.Empty; string proxyport = string.Empty; string proxyUser = string.Empty; string proxyPass = string.Empty; List<string> list_account = list_Accounts[ClGlobul.accountIndexForLoopingBack]; foreach (string val in list_account) { cmbScraperAccounts.Invoke(new MethodInvoker(delegate { cmbScraperAccounts.SelectedIndex = accountIndex; })); string[] StrArrar = Regex.Split(val, ":"); string account = StrArrar[0]; string pass = StrArrar[1]; if (StrArrar.Count() == 4) { proxyadd = StrArrar[2]; proxyport = StrArrar[3]; } if (StrArrar.Count() == 6) { proxyUser = StrArrar[4]; proxyPass = StrArrar[5]; } InstagramManager.Classes.InstagramAccountManager InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(account, pass, proxyadd, proxyport, proxyUser, proxyPass); string status = InstagramAccountManager.LoginNew(ref InstagramAccountManager.httpHelper); if (!status.Contains("Success")) { status = InstagramAccountManager.LoginNew(ref InstagramAccountManager.httpHelper); } if (status == "Success") { AddToScrapeFollowersLogger("[ " + DateTime.Now + "] " + "[ Logged in with account : " + InstagramAccountManager.Username + " ]"); foreach (string username in ClGlobul.listUsernameScrapeFollowers) { ClGlobul.scrapeFollowerAndFollowingUsername = username; //new Thread(() => StartScrapingFollowers(ref InstagramAccountManager, username)).Start(); Thread StartThread = new Thread(() => StartScrapingFollowers(ref InstagramAccountManager, username)); StartThread.Start(); StartThread.Join(); } } else { AddToScrapeFollowersLogger("[ " + DateTime.Now + "] " + "[ Not logged in with account : " + InstagramAccountManager.Username + " ]"); return; } accountIndex++; } if (!ClGlobul.isStopScrapeFollowers) { if (!ClGlobul.userOverFollower) { if (accountIndex >= list_Accounts.Count()) { Thread.Sleep(5000); AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ All accounts used. Looping Back to the first account.]"); AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ Delay of 5 seconds. ]"); ClGlobul.accountIndexForLoopingBack = 0; accountIndex = 0; goto LoopBackAccount; } else { if (ClGlobul.switchAccount) { Thread.Sleep(5000); AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ Delay of 5 seconds. ]"); ClGlobul.accountIndexForLoopingBack++; goto LoopBackAccount; } } } } } else { return; } } else { MessageBox.Show("Please write username."); AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ Please write username. ]"); return; } } else { MessageBox.Show("Please write username."); AddToScrapeFollowersLogger("[ " + DateTime.Now + " ] => [ Please write username. ]"); return; } } catch (Exception ex) { GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Method Name => btnStartScrapeFollowers_Click :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathScrapeFollowers); } }
public string photolike(string PhotoId, ref InstagramAccountManager accountManager) { NameValueCollection namevalue = new NameValueCollection(); string Photolink = string.Empty; string FollowedPageSource = string.Empty; string like = string.Empty; try { if (PhotoId.Contains("http://websta.me/p/")) { PhotoId = PhotoId.Replace("http://websta.me/p/", string.Empty); } if (!PhotoId.Contains("http://web.stagram.com/")) { Photolink = "http://websta.me/api/like/" + PhotoId + "/".Replace("http://websta.me/p/", ""); } else { Photolink = PhotoId; } //string PageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(Photolink), "", "", accountManager.proxyAddress); string PageContent = string.Empty; if (string.IsNullOrEmpty(accountManager.proxyPort)) { accountManager.proxyPort = "80"; } try { if (DemoStagramPro.ClGlobul.checkHashTagLiker == true) { PageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(Photolink)); } else { PageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(Photolink), accountManager.proxyAddress, Convert.ToInt32(accountManager.proxyPort), accountManager.proxyUsername, accountManager.proxyPassword); } } catch { } if (string.IsNullOrEmpty(PageContent)) { if (DemoStagramPro.ClGlobul.checkHashTagLiker == true) { PageContent = accountManager.httpHelper.getHtmlfromUrl(new Uri(Photolink)); } else { PageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(Photolink), "", 80, "", ""); } } if (PageContent.Contains("message\":\"LIKED\"")) { #region commented code //bool isContain = accountManager.httpHelper.CheckAttributeexsist(PageContent, "span", "dislike_button"); //if (PageContent.Contains("img/liked.png")) //{ // FollowedPageSource = "All ready LIKED"; //} //if (lstLikes.Count > 0) //{ // try // { // like = lstLikes[0]; // } // catch // { // } //} //if (like == "1") //{ // FollowedPageSource = "All ready LIKED"; //} //if (isContain) //{ // FollowedPageSource = "All ready LIKED"; //} //else //{ //string PostData = "&pk=" + PhotoId + "&t=653"; #endregion #region commented //string PostData = "&pk=" + PhotoId + "&t=" + RandomNumber() + ""; //namevalue.Add("Accept-Language", "en-us,en;q=0.5"); //namevalue.Add("X-Requested-With", "XMLHttpRequest"); //namevalue.Add("Origin", "http://web.stagram.com"); //namevalue.Add("X-Requested-With", "XMLHttpRequest"); //FollowedPageSource = accountManager.httpHelper.postFormDataForFollowUser(new Uri("http://web.stagram.com/do_like/"), PostData.Trim(), Photolink, namevalue); //if (FollowedPageSource.Contains("\"message\":null}")) //{ // FollowedPageSource = "All ready LIKED"; //} #endregion FollowedPageSource = "LIKED"; try { if (DemoStagramPro.ClGlobul.checkHashTagLiker == true) { try { DataBaseHandler.InsertQuery("insert into liker_hash_tag (account_holder, photo_id, like_date, like_status) values ('" + accountManager.Username + "','" + PhotoId + "','" + Convert.ToString(DateTime.Now) + "','" + FollowedPageSource + "')", "liker_hash_tag"); } catch { } } } catch(Exception ex) { } } else if (string.IsNullOrEmpty(FollowedPageSource)) { FollowedPageSource = "Already LIKED"; } } catch { } return FollowedPageSource; }
private void startProcessUsingHashTag() { try { GloBoardPro.HasTagListListThread.Add(Thread.CurrentThread); GloBoardPro.HasTagListListThread.Distinct(); Thread.CurrentThread.IsBackground = true; } catch { } int parsedValue; bool ProcessStartORnot = false; AddToHashLoggerDAta("[ " + DateTime.Now + " ] => [Pleasewait ]"); List<List<string>> list_Accounts = new List<List<string>>(); acc_checker_counter = DemoStagramPro.ClGlobul.accountList.Count(); list_Accounts = ListUtilities.Split(DemoStagramPro.ClGlobul.accountList, Maxthread); ThreadPool.SetMaxThreads(Noofthreads, 5); GlobDramProHttpHelper httphelper = new GlobDramProHttpHelper(); HashTag objHashTag = new HashTag(); List<string> Usercount = new List<string>(); try { if (!(string.IsNullOrEmpty(txtHashTagDelay.Text))) { ClGlobul.hashTagDelay = Convert.ToInt32(txtHashTagDelay.Text); } else { ClGlobul.hashTagDelay = 10; } } catch { } if (chkDivideDataFollow1.Checked && rdbDivideGivenByUser1.Checked) { if (!int.TryParse(txtDiveideByUser1.Text, out parsedValue)) { AddToLogger("[ " + DateTime.Now + " ] => [ This is a number only field.Please enter proper value in divide given by user field. ]"); return; } } try { if (ClGlobul.HashFollower.Count != 0) { if (!string.IsNullOrEmpty(txtNumberProfilesFollow.Text)) { ClGlobul.NumberOfProfilesToFollow = Convert.ToInt32(txtNumberProfilesFollow.Text); //ClGlobul.SnapVideosCounterfollow = Convert.ToInt32(txtNumberProfilesFollow.Text) * ClGlobul.HashFollower.Count; } else { MessageBox.Show("Please enter the numbers of profiles to follow and continue."); AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Please enter the numbers of profiles to follow and continue. ]"); return; } } if (ClGlobul.HashLiker.Count != 0) { if (!string.IsNullOrEmpty(txtNumberPicsVideosLike.Text)) { ClGlobul.NumberofSnapsVideosToLike = Convert.ToInt32(txtNumberPicsVideosLike.Text); //ClGlobul.SnapVideosCounter = Convert.ToInt32(txtNumberPicsVideosLike.Text) * ClGlobul.HashLiker.Count; } else { MessageBox.Show("Please enter the numbers of snaps or videos to like and continue."); AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Please enter the numbers of snaps or videos to like and continue. ]"); return; } } if (ClGlobul.HashComment.Count != 0) { if (!string.IsNullOrEmpty(txtNumberSnapsVideosComment.Text)) { ClGlobul.NumberofSnapsVideosToComment = Convert.ToInt32(txtNumberSnapsVideosComment.Text); // ClGlobul.SnapVideosCounterComment = Convert.ToInt32(txtNumberSnapsVideosComment.Text) * ClGlobul.HashComment.Count; } else { MessageBox.Show("Please enter the numbers of snaps or videos to like and continue."); AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Please enter the numbers of snaps or videos to like and continue. ]"); return; } } } catch (Exception ex) { } #region scrapHashTagFollowr List<string> lstHashTagUserIdTemp = new List<string>(); List<string> lstHashTagUserId = new List<string>(); if (!string.IsNullOrEmpty(txtHashFollower.Text.Trim())) { foreach (string hashKeyword in ClGlobul.HashFollower) { AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraping Users with HashTag " + hashKeyword + "]"); lstHashTagUserIdTemp = GetUser(hashKeyword); lstHashTagUserId.AddRange(lstHashTagUserIdTemp); AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraped Users with HashTag " + hashKeyword + "]"); } } #endregion #region ScraperhashLiker List<string> lstHashTagUserIdLikeTemp = new List<string>(); List<string> lstHashLikeTagUserLikeId = new List<string>(); if (!string.IsNullOrEmpty(txtHashLike.Text.Trim())) { foreach (string hashLikerKeyword in ClGlobul.HashLiker) { AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraping PhotoId with HashTag " + hashLikerKeyword + "]"); lstHashTagUserIdLikeTemp = GetPhotoId(hashLikerKeyword); lstHashLikeTagUserLikeId.AddRange(lstHashTagUserIdLikeTemp); AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraped Users with HashTag " + hashLikerKeyword + "]"); } } #endregion #region hashtagcomment List<string> lstHashTagUserIdCommentTemp = new List<string>(); List<string> lstHashTagCommentUserId = new List<string>(); if (!string.IsNullOrEmpty(txtHashComment.Text.Trim())) { foreach (string hashCommentKeyword in ClGlobul.HashComment) { AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraping Users PhotoId HashTag " + hashCommentKeyword + "]"); lstHashTagUserIdCommentTemp = GetPhotoId1(hashCommentKeyword); lstHashTagCommentUserId.AddRange(lstHashTagUserIdCommentTemp); AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Scraped Users PhotoId HashTag " + hashCommentKeyword + "]"); } } #endregion List<List<string>> list_lstTargetUsers = new List<List<string>>(); counter_follow = DemoStagramPro.ClGlobul.accountList.Count(); list_Accounts = ListUtilities.Split(DemoStagramPro.ClGlobul.accountList, Maxthread); List<List<string>> list_lstTargetHashTag = new List<List<string>>(); List<List<string>> list_lstTargetHashTagLike = new List<List<string>>(); List<List<string>> list_lstTargetHashTagComment = new List<List<string>>(); //for divide by data logic here if (chkDivideDataFollow1.Checked) { if (rdbDivideGivenByUser1.Checked || rdbDivideEqually1.Checked) { int splitNo = 0; if (rdbDivideEqually1.Checked) { splitNo = lstHashTagUserId.Count / ClGlobul.accountList.Count; } else if (rdbDivideGivenByUser1.Checked) { if (Convert.ToInt32(txtDiveideByUser1.Text.Trim()) != 0) { int res = Convert.ToInt32(Convert.ToInt32(txtDiveideByUser1.Text.Trim())); splitNo = res; } } if (splitNo == 0) { splitNo = RandomNumberGenerator.GenerateRandom(0, lstHashTagUserId.Count - 1); } list_lstTargetHashTag = Split(lstHashTagUserId, splitNo); } } if (chkDivideDataFollow1.Checked) { if (rdbDivideGivenByUser1.Checked || rdbDivideEqually1.Checked) { int splitNo = 0; if (rdbDivideEqually1.Checked) { splitNo = lstHashLikeTagUserLikeId.Count / ClGlobul.accountList.Count; } else if (rdbDivideGivenByUser1.Checked) { if (Convert.ToInt32(txtDiveideByUser1.Text.Trim()) != 0) { int res = Convert.ToInt32(Convert.ToInt32(txtDiveideByUser1.Text.Trim())); splitNo = res; } } if (splitNo == 0) { splitNo = RandomNumberGenerator.GenerateRandom(0, lstHashLikeTagUserLikeId.Count - 1); } list_lstTargetHashTagLike = Split(lstHashLikeTagUserLikeId, splitNo); } } if (chkDivideDataFollow1.Checked) { if (rdbDivideGivenByUser1.Checked || rdbDivideEqually1.Checked) { int splitNo = 0; if (rdbDivideEqually1.Checked) { splitNo = lstHashTagCommentUserId.Count / ClGlobul.accountList.Count; } else if (rdbDivideGivenByUser1.Checked) { if (Convert.ToInt32(txtDiveideByUser1.Text.Trim()) != 0) { int res = Convert.ToInt32(Convert.ToInt32(txtDiveideByUser1.Text.Trim())); splitNo = res; } } if (splitNo == 0) { splitNo = RandomNumberGenerator.GenerateRandom(0, lstHashTagCommentUserId.Count - 1); } list_lstTargetHashTagComment = Split(lstHashTagCommentUserId, splitNo); } } int LstCounter = 0; // unlikeCompletionCount = ClGlobul.accountList.Count; unlikeCompletionLikeCount = ClGlobul.accountList.Count; try { if (list_Accounts.Count == 0) { AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Please upload account. ]"); return; } else { ClGlobul.countNoOFAccountHashFollower = ClGlobul.accountList.Count; ClGlobul.countNoOFAccountHashComment = ClGlobul.accountList.Count; ClGlobul.countNOOfFollowersandImageDownload = ClGlobul.accountList.Count; //try //{ // ClGlobul.SnapVideosCounterfollow = ClGlobul.SnapVideosCounterfollow * list_Accounts.Count; //} //catch { }; //try //{ // ClGlobul.SnapVideosCounter = ClGlobul.SnapVideosCounter * list_Accounts.Count; //} //catch { }; //try //{ // ClGlobul.SnapVideosCounterComment = ClGlobul.SnapVideosCounterComment * list_Accounts.Count; //} //catch { }; foreach (List<string> listAccounts in list_Accounts) { foreach (string val in listAccounts) { //soniaghezzo94:mdag123456:93.118.68.148:3128 string[] StrArrar = Regex.Split(val, ":"); string account = string.Empty; string pass = string.Empty; string proxyadd = string.Empty; string proxyport = string.Empty; string proxyUser = string.Empty; string proxyPass = string.Empty; try { account = StrArrar[0]; } catch { account = StrArrar[0]; } try { pass = StrArrar[1]; } catch { pass = StrArrar[1]; } try { proxyadd = StrArrar[2]; } catch { proxyadd = StrArrar[2]; } try { proxyport = StrArrar[3]; } catch { proxyport = StrArrar[3]; } try { proxyUser = StrArrar[4]; } catch { proxyUser = StrArrar[4]; } try { proxyPass = StrArrar[5]; } catch { proxyPass = StrArrar[5]; } string txtUrl = txtHashFollower.Text; string txtLikeComment = txtHashLike.Text; if (LstCounter == list_lstTargetHashTag.Count && (chkDivideDataFollow1.Checked)) { //AddToLogger("[ " + DateTime.Now + " ] => [ Account is grater than List of users. ]"); // break; } List<string> list_lstTargetHashTag_item = new List<string>(); try { if (chkDivideDataFollow1.Checked) { list_lstTargetHashTag_item = list_lstTargetHashTag[LstCounter]; } else { list_lstTargetHashTag_item = lstHashTagUserId; } } catch { } List<string> list_lstTargetHashTagLike_item = new List<string>(); try { if (chkDivideDataFollow1.Checked) { list_lstTargetHashTagLike_item = list_lstTargetHashTagLike[LstCounter]; } else { list_lstTargetHashTagLike_item = lstHashLikeTagUserLikeId; } } catch { } List<string> list_lstTargetHashTagComment_item = new List<string>(); try { if (chkDivideDataFollow1.Checked) { list_lstTargetHashTagComment_item = list_lstTargetHashTagComment[LstCounter]; } else { list_lstTargetHashTagComment_item = lstHashTagCommentUserId; } } catch { } InstagramManager.Classes.InstagramAccountManager InstagramAccountManager = new InstagramManager.Classes.InstagramAccountManager(account, pass, proxyadd, proxyport, proxyUser, proxyPass); string status = InstagramAccountManager.LoginNew(ref InstagramAccountManager.httpHelper); if (!status.Contains("Success")) { status = InstagramAccountManager.LoginNew(ref InstagramAccountManager.httpHelper); } AddToHashLoggerDAta("[ " + DateTime.Now + "] " + "[ Logged in with account : " + InstagramAccountManager.Username + " ]"); // string ddd = Uri.EscapeDataString(txtUrl); try { if (ClGlobul.HashFollower.Count != 0) { //foreach (string hashTagFollow in ClGlobul.HashFollower) //commented for divide data //foreach (string hashTagFollow in list_lstTargetHashTag_item) { new Thread(() => { try { GloBoardPro.HasTagListListThread.Add(Thread.CurrentThread); GloBoardPro.HasTagListListThread.Distinct(); Thread.CurrentThread.IsBackground = true; } catch { } objHashTag.HashTagFollow(ref InstagramAccountManager, list_lstTargetHashTag_item); }).Start(); } } if (ClGlobul.HashLiker.Count != 0) { //foreach (string hashTagLike in ClGlobul.HashLiker) { new Thread(() => { // objHashTag.HashTagLike(ref InstagramAccountManager, hashTagLike); objHashTag.HashTagLike(ref InstagramAccountManager, list_lstTargetHashTagLike_item); }).Start(); } } if (ClGlobul.HashComment.Count != 0) { //foreach (string hashTagComment in ClGlobul.HashComment) { new Thread(() => { objHashTag.HashTagComment(ref InstagramAccountManager, list_lstTargetHashTagComment_item); }).Start(); } } } catch (Exception ex) { } LstCounter++; Thread.Sleep(1000); } } } } catch (Exception ex) { } finally { { if (unlikeCompletionLikeCount == 0) { } } } }