public void getComment(string CommentIdsForMSG_item , ref InstagramUser usercomment) { try { lstThreadsCommentPoster.Add(Thread.CurrentThread); lstThreadsCommentPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } Queue<string> CommentIdQueue = new Queue<string>(); Queue<string> MsgQueue = new Queue<string>(); try { string photoLikeresult = string.Empty; photoLikeresult = string.Empty; string message = ClGlobul.commentMsgList[RandomNumberGenerator.GenerateRandom(0, ClGlobul.commentMsgList.Count)]; try { string status = Comment(CommentIdsForMSG_item, message,ref usercomment ); if (status == "Success") { DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User,DateTime, Photo_Id, Message,Status) values('" + "CommentModule" + "','" + usercomment.username + "','" + DateTime.Now+ "','" + CommentIdsForMSG_item + "','" + message + "','" + status + "')", "tbl_AccountReport"); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ comment is successfully posted from " +usercomment.username+ " To ===> " + CommentIdsForMSG_item +"]"); } else { if( status == "Instagram API does not respond") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Instagram API does not respond on " + CommentIdsForMSG_item + "]"); } else { if(status == "Fail") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Fail to comment " + CommentIdsForMSG_item + "]"); } } } if (minDelayCommentPoster != 0) { mindelay = minDelayCommentPoster; } if (maxDelayCommentPoster != 0) { maxdelay = maxDelayCommentPoster; } int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds For " + usercomment.username + " ]"); Thread.Sleep(delay * 1000); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } finally { // GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Comment is Finished From Account : " + usercomment.username + " ]"); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
public void Start_LikeFollowerpicture(ref InstagramUser Obj_Likefollowerpic) { try { lstThreadsUsingUsername.Add(Thread.CurrentThread); lstThreadsUsingUsername.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } string response =string.Empty; try { if (string.IsNullOrEmpty(UsingUsercontrol_Like_path)) { if (!string.IsNullOrEmpty(UsingUsercontrol_Like_single)) { string s = UsingUsercontrol_Like_single; if (s.Contains(",")) { string[] data = Regex.Split(s, ","); foreach (string item in data) { ClGlobul.UsingUsername_Usernmaelist.Add(item); } } else { ClGlobul.UsingUsername_Usernmaelist.Add(UsingUsercontrol_Like_single); ClGlobul.UsingUsername_Usernmaelist.Distinct(); } } } foreach (string user in ClGlobul.UsingUsername_Usernmaelist) { int count = 0; ClGlobul.UsingUsername_likeFollowerpicture.Clear(); string res_secondURL = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com/"), ""); string home_respone = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com/" + user+"/")); try { string Home_icon_Url = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri("http://iconosquare.com"), ""); string Icon_url = IGGlobals.Instance.IGiconosquareAuthorizeurl; string PPagesource = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri(Icon_url), ""); string responce_icon = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGiconosquareviewUrl), ""); if (!string.IsNullOrEmpty(responce_icon)) { string url = "http://iconosquare.com/viewer.php#/search/" + user; //postData = "q=" + Uri.EscapeDataString(itemHash); //if (!itemHash.Contains("#")) //{ // url = IGGlobals.Instance.IGwebstaSearchUrl + postData.Substring(postData.IndexOf("=") + 1); //} //else //{ // url = IGGlobals.Instance.IGwebstaSearchUrl + postData.Substring(postData.IndexOf("=") + 1).Replace("%23", ""); //} string referer = "http://iconosquare.com/viewer.php"; string viewer_responce = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri("http://iconosquare.com/viewer.php "), ""); string crs_token = Utils.getBetween(viewer_responce, " <div id=\"accesstoken\" style=\"display:none;\">", "</div>"); response = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri(url), ""); string postdata = "http://iconosquare.com/rqig.php?e=/users/search&a=ico2&t=" + crs_token + "&q=" + user; string respon_scrapeuser = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri(postdata), referer); string ID = Utils.getBetween(respon_scrapeuser, "id\":\"", "\""); //string[] data_divided = Regex.Split(respon_scrapeuser, "username"); string Profile_user = "******" + ID + "/"; string post_data = "http://iconosquare.com/rqig.php?e=/users/" + ID + "/follows&a=ico2&t=" + crs_token + "&count=20"; string list_follower = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri("http://iconosquare.com/viewer.php#/followers/" + ID), ""); string follow_respo = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri(post_data), "http://iconosquare.com/viewer.php"); string[] data = Regex.Split(follow_respo, "username"); foreach (string item in data) { try { if (item.Contains("profile_picture")) { string follower_name = Utils.getBetween(item, "\":\"", "\""); if (UsingUsername_like_Nouser > count) { ClGlobul.UsingUsername_likeFollowerpicture.Add(follower_name); GlobusLogHelper.log.Info(follower_name); count++; } else { break; } } } catch (Exception ex) { GlobusLogHelper.log.Info("Error :" + ex.StackTrace); } } if (follow_respo.Contains("next_url")) { value = true; while (value) { if (follow_respo.Contains("next_url")) { string next_pageurl_token = Utils.getBetween(follow_respo, "next_cursor\":\"", "\"},"); string page_Url = postdata + "&cursor=" + next_pageurl_token; follow_respo = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri(page_Url), "http://iconosquare.com/viewer.php"); string[] data1 = Regex.Split(follow_respo, "username"); foreach (string item in data1) { if (item.Contains("profile_picture")) { string follower_user = Utils.getBetween(item, "\":\"", "\""); if(UsingUsername_like_Nouser > count) { ClGlobul.UsingUsername_likeFollowerpicture.Add(follower_user); GlobusLogHelper.log.Info(follower_user); count++; } } } } else { value = false; } } } } } catch (Exception ex) { GlobusLogHelper.log.Info("Error :" + ex.StackTrace); } try { foreach (string URL_follower in ClGlobul.UsingUsername_likeFollowerpicture) { int num = 0; follow_user = URL_follower; string follower_home = Obj_Likefollowerpic.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com/" + URL_follower+"/")); if(follower_home.Contains("is_private\":true")) { GlobusLogHelper.log.Info("This user is private" + URL_follower); // break; } string[] data_resp = Regex.Split(follower_home, "code"); if(data_resp.Count()==1) { GlobusLogHelper.log.Info("NO Post is Posted" + URL_follower); // break; } foreach(string value in data_resp) { if(value.Contains("date")) { if (num < 1) { string update_postId = Utils.getBetween(value, "\":\"", "\""); ClGlobul.UsingUername_PhotoIDList.Add(update_postId); num++; } else { break; } } } } string Result = string.Empty; try { foreach (string photoID in ClGlobul.UsingUername_PhotoIDList) { Result = UsingUserName_liking(ref Obj_Likefollowerpic, photoID); if (!Result.Contains("LIKED") && !Result.Contains("All ready LIKED")) { #region commment try { QueryExecuter.insertLikeStatus(photoID, Obj_Likefollowerpic.username, 1); GlobusLogHelper.log.Info("photoID in Incorrect"); try { string path_AppDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Gram Dominator"; path_AppDataFolder = path_AppDataFolder + "\\LikeList"; if (!File.Exists(path_AppDataFolder)) { Directory.CreateDirectory(path_AppDataFolder); } string FollowIDFilePath = path_AppDataFolder + "\\" + Obj_Likefollowerpic.username + ".csv"; string CSV_Header = "Username,PhotoID,Liked"; string CSV_Content = Obj_Likefollowerpic.username.Replace(",", "") + "," + photoID.Replace(",", "") + "," + Result; GlobusFileHelper.ExportDataCSVFile(CSV_Header, CSV_Content, FollowIDFilePath); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { if (!ClGlobul.photoLikesCompletedList.Contains(Obj_Likefollowerpic.username))// + ":" + accountManager.Password + ":" + accountManager.proxyAddress + ":" + accountManager.proxyPort + ":" + accountManager.proxyUsername + ":" + accountManager.proxyPassword)) { ClGlobul.photoLikesCompletedList.Add(Obj_Likefollowerpic.username);// + ":" + accountManager.Password + ":" + accountManager.proxyAddress + ":" + accountManager.proxyPort + ":" + accountManager.proxyUsername + ":" + accountManager.proxyPassword); } GlobusFileHelper.AppendStringToTextfileNewLine(Obj_Likefollowerpic.username + ":" + photoID, GlobusFileHelper.LikePhotoAccountIdFilePath); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } #endregion try { if (Result.Contains("LIKED")) { // DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User, Photo_Id,Status) values('" + "UsingUser" + "','" + Obj_Likefollowerpic.username + "','" + PhotoList_item + "','" + Result + "')", "tbl_AccountReport"); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + Obj_Likefollowerpic.username + " LIKED : " + photoID + " ]"); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } else if (Result.Contains("Already LIKED")) { #region if photoallready like try { GlobusFileHelper.AppendStringToTextfileNewLine(Obj_Likefollowerpic.username + ":" + photoID, GlobusFileHelper.AllReadylikePhotoAccountIdFilePath); try { string path_AppDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Gram Dominator"; path_AppDataFolder = path_AppDataFolder + "\\LikeList"; if (!File.Exists(path_AppDataFolder)) { Directory.CreateDirectory(path_AppDataFolder); } string FollowIDFilePath = path_AppDataFolder + "\\" + Obj_Likefollowerpic.username + ".csv"; string CSV_Header = "Username,PhotoID,Already LIKED"; string CSV_Content = Obj_Likefollowerpic.username.Replace(",", "") + "," + photoID.Replace(",", "") + "," + Result; GlobusFileHelper.ExportDataCSVFile(CSV_Header, CSV_Content, FollowIDFilePath); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } #endregion GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + Obj_Likefollowerpic.username + " Already LIKED : " + photoID + " ]"); } else { try { if (Result.Contains("LIKED")) { DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User,UserName,Message, Photo_Id,Status,Operation) values('" + "UsingUser" + "','" + Obj_Likefollowerpic.username + "','" + follow_user.Replace("/n/",string.Empty) + "','" + " - " + "','" + photoID + "','"+"Success"+"','"+"Like only"+"')", "tbl_AccountReport"); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + Obj_Likefollowerpic.username + " LIKED : " + photoID + "]"); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } if (minDelayUsingUsername != 0) { mindelay = minDelayUsingUsername; } if (maxDelayUsingUsername != 0) { maxdelay = maxDelayUsingUsername; } int delayy = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delayy + " Seconds For " + Obj_Likefollowerpic.username + " ]"); Thread.Sleep(delayy * 1000); } } catch (Exception ex) { GlobusLogHelper.log.Info("Error : " + ex.StackTrace); } finally { GlobusLogHelper.log.Info("========================"); GlobusLogHelper.log.Info("Process Completed !!"); GlobusLogHelper.log.Info("========================"); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
public void Start_onlycommentonfollowerphoto(ref InstagramUser obj_onlycomment) { try { lstThreadsUsingUsername.Add(Thread.CurrentThread); lstThreadsUsingUsername.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { if ((!string.IsNullOrEmpty(UsingUsercontrol_onlycomment_single)) && (!string.IsNullOrEmpty(UsingUsercontrol_onlycommentmessage_single))) { string s = UsingUsercontrol_onlycomment_single; if (s.Contains(",")) { string[] data = Regex.Split(s, ","); foreach (string item in data) { ClGlobul.UsingUsername_onlycommentusernameList.Add(item); } } else { ClGlobul.UsingUsername_onlycommentusernameList.Add(UsingUsercontrol_onlycomment_single); } string k = UsingUsercontrol_onlycommentmessage_single; if (k.Contains(",")) { string[] data1 = Regex.Split(k, ","); foreach (string item1 in data1) { ClGlobul.UsingUsername_onlycommentmessageList.Add(item1); } } else { ClGlobul.UsingUsername_onlycommentmessageList.Add(UsingUsercontrol_onlycommentmessage_single); } } foreach (string user in ClGlobul.UsingUsername_onlycommentusernameList) { try { string resp = obj_onlycomment.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com"), ""); int count = 0; ClGlobul.UsingUsername_commentFollowerpicture.Clear(); string response = string.Empty; try { string Home_icon_Url = obj_onlycomment.globusHttpHelper.getHtmlfromUrl(new Uri("http://iconosquare.com"), ""); string Icon_url = IGGlobals.Instance.IGiconosquareAuthorizeurl; string PPagesource = obj_onlycomment.globusHttpHelper.getHtmlfromUrl(new Uri(Icon_url), ""); string responce_icon = obj_onlycomment.globusHttpHelper.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGiconosquareviewUrl), ""); if (!string.IsNullOrEmpty(responce_icon)) { string url = "http://iconosquare.com/viewer.php#/search/" + user; //postData = "q=" + Uri.EscapeDataString(itemHash); //if (!itemHash.Contains("#")) //{ // url = IGGlobals.Instance.IGwebstaSearchUrl + postData.Substring(postData.IndexOf("=") + 1); //} //else //{ // url = IGGlobals.Instance.IGwebstaSearchUrl + postData.Substring(postData.IndexOf("=") + 1).Replace("%23", ""); //} string referer = "http://iconosquare.com/viewer.php"; string viewer_responce = obj_onlycomment.globusHttpHelper.getHtmlfromUrl(new Uri("http://iconosquare.com/viewer.php "), ""); string crs_token = Utils.getBetween(viewer_responce, " <div id=\"accesstoken\" style=\"display:none;\">", "</div>"); response = obj_onlycomment.globusHttpHelper.getHtmlfromUrl(new Uri(url), ""); string postdata = "http://iconosquare.com/rqig.php?e=/users/search&a=ico2&t=" + crs_token + "&q=" + user; string respon_scrapeuser = obj_onlycomment.globusHttpHelper.getHtmlfromUrl(new Uri(postdata), referer); string ID = Utils.getBetween(respon_scrapeuser, "id\":\"", "\""); //string[] data_divided = Regex.Split(respon_scrapeuser, "username"); string Profile_user = "******" + ID + "/"; string post_data = "http://iconosquare.com/rqig.php?e=/users/" + ID + "/follows&a=ico2&t=" + crs_token + "&count=20"; string list_follower = obj_onlycomment.globusHttpHelper.getHtmlfromUrl(new Uri("http://iconosquare.com/viewer.php#/followers/" + ID), ""); string follow_respo = obj_onlycomment.globusHttpHelper.getHtmlfromUrl(new Uri(post_data), "http://iconosquare.com/viewer.php"); string[] data = Regex.Split(follow_respo, "username"); foreach (string item in data) { try { if (item.Contains("profile_picture")) { string follower_name = Utils.getBetween(item, "\":\"", "\""); if (UsingUsername_onlycomment_Nouser > count) { ClGlobul.UsingUsername_commentFollowerpicture.Add(follower_name); GlobusLogHelper.log.Info(follower_name); count++; } else { break; } } } catch (Exception ex) { GlobusLogHelper.log.Info("Error :" + ex.StackTrace); } } if (follow_respo.Contains("next_url") && UsingUsername_onlycomment_Nouser > count) { value = true; while (value) { if (follow_respo.Contains("next_url") || UsingUsername_onlycomment_Nouser > count) { string next_pageurl_token = Utils.getBetween(follow_respo, "next_cursor\":\"", "\"},"); string page_Url = postdata + "&cursor=" + next_pageurl_token; follow_respo = obj_onlycomment.globusHttpHelper.getHtmlfromUrl(new Uri(page_Url), "http://iconosquare.com/viewer.php"); string[] data1 = Regex.Split(follow_respo, "username"); foreach (string item in data1) { if (item.Contains("profile_picture")) { string follower_user = Utils.getBetween(item, "\":\"", "\""); if (UsingUsername_onlycomment_Nouser > count) { ClGlobul.UsingUsername_commentFollowerpicture.Add(follower_user); GlobusLogHelper.log.Info(follower_user); count++; } else { break; } } } } else { value = false; } } } } } catch (Exception ex) { GlobusLogHelper.log.Info("Error : " + ex.StackTrace); } try { foreach (string URL_follower in ClGlobul.UsingUsername_commentFollowerpicture) { int num = 0; string follower_home = obj_onlycomment.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com/" + URL_follower+"/")); string[] Data = Regex.Split(follower_home, "code"); foreach (string item in Data) { if (follower_home.Contains("is_private\":true")) { GlobusLogHelper.log.Info("This user is private --->" + URL_follower); break; } if (Data.Count() == 1) { GlobusLogHelper.log.Info("NO Post is Posted --->" + URL_follower); break; } if (item.Contains("date")) { if (num < 1) { string update_postId = Utils.getBetween(item, "\":\"", "\""); ClGlobul.UsingUername_commentPhotoIDList.Add(update_postId); num++; } else { break; } } } } foreach (string PhotoId in ClGlobul.UsingUername_commentPhotoIDList) { string message = ClGlobul.UsingUsername_onlycommentmessageList[RandomNumberGenerator.GenerateRandom(0, ClGlobul.UsingUsername_onlycommentmessageList.Count)]; string status = Comment(PhotoId, message, ref obj_onlycomment); if (status == "Success") { DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User,UserName,Message, Photo_Id,Status,Operation) values('" + "UsingUser" + "','" + obj_onlycomment.username + "','" + follow_user.Replace("/n/", string.Empty) + "','" + message + "','" + PhotoId + "','" + "Success" + "','" + "Comment Only" + "')", "tbl_AccountReport"); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ comment is successfully posted from " + obj_onlycomment .username+" To===> " +PhotoId + "]"); } else { } if (minDelayUsingUsername != 0) { mindelay = minDelayUsingUsername; } if (maxDelayUsingUsername != 0) { maxdelay = maxDelayUsingUsername; } int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds For " + obj_onlycomment.username + " ]"); Thread.Sleep(delay * 1000); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } finally { GlobusLogHelper.log.Info("========================"); GlobusLogHelper.log.Info("Process Completed !!"); GlobusLogHelper.log.Info("========================"); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } } catch { } }
public string Follow(string UserName, ref InstagramUser accountManager) { try { lstThreadsFollowerPoster.Add(Thread.CurrentThread); lstThreadsFollowerPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } GlobusHttpHelper obj = accountManager.globusHttpHelper; // string res_secondURL = obj.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGTestURL), ""); string res_secondURL = obj.getHtmlfromUrl(new Uri("https://www.instagram.com"), ""); if (!UserName.Contains(IGGlobals.Instance.IGWEP_HomePage)) { //UserName = IGGlobals.Instance.IGWEP_HomePage + UserName + "/"; UserName = "******" + UserName + "/"; } string UserPageContent = string.Empty; if (!string.IsNullOrEmpty(accountManager.proxyip) && !string.IsNullOrEmpty(accountManager.proxyport)) { try { UserPageContent = accountManager.globusHttpHelper.getHtmlfromUrlProxy(new Uri(UserName), accountManager.proxyip, Convert.ToInt32(accountManager.proxyport), accountManager.proxyusername, accountManager.proxypassword); } catch (Exception ex) { } if (string.IsNullOrEmpty(UserPageContent)) { Thread.Sleep(1000); try { UserPageContent = accountManager.globusHttpHelper.getHtmlfromUrlProxy(new Uri(UserName), accountManager.proxyip, Convert.ToInt32(accountManager.proxyport), accountManager.proxyusername, accountManager.proxypassword); } catch (Exception ex) { } } } else { try { UserPageContent = accountManager.globusHttpHelper.getHtmlfromUrlProxy(new Uri(UserName), "", 80, "", ""); } catch { }; if (string.IsNullOrEmpty(UserPageContent)) { Thread.Sleep(1000); try { UserPageContent = accountManager.globusHttpHelper.getHtmlfromUrlProxy(new Uri(UserName), "", 80, "", ""); } catch { }; } } if (chkNotSendRequest == true) { if (UserPageContent.Contains("\"is_private\":true")) { return "User is Private"; } } try { //if (UserPageContent.Contains("This user is private.")) //{ // return "private"; //} string PK = string.Empty; if (UserPageContent.Contains("")) { // PK = Utils.getBetween(UserPageContent, "id=\"follow_btn_wrapper\"", ">").Replace("data-target=", "").Replace("\"", "").Trim(); PK = Utils.getBetween(UserPageContent, "\"id\":", "\",").Replace("\"",""); } if (string.IsNullOrEmpty(PK)) { PK = Utils.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 postData = "https://www.instagram.com/web/friendships/" + PK + "/follow/"; string FollowedPageSource = string.Empty; if (!string.IsNullOrEmpty(PK)) { try { string test = accountManager.globusHttpHelper.getHtmlfromUrl(new Uri(UserName)); string txt_name = Utils.getBetween(UserName,"www.instagram.com/","/"); string csrf_token = Utils.getBetween(UserPageContent, "csrf_token\":\"", "\"}"); FollowedPageSource = accountManager.globusHttpHelper.postFormDatainta(new Uri(postData), "", "https://www.instagram.com/" + txt_name + "/", csrf_token); } catch { } } if (string.IsNullOrEmpty(FollowedPageSource)) { } if (FollowedPageSource.Contains("followed_by_viewer\":true") || FollowedPageSource.Contains("requested_by_viewer\":true")) { string status = string.Empty; try { status = QueryExecuter.getFollowStatus1(accountManager.username, UserName); } catch { } if (string.IsNullOrEmpty(status)) { if (FollowedPageSource.Contains("has_requested_viewer\":true") || FollowedPageSource.Contains("requested_by_viewer\":true")) { status = "requested"; } if(FollowedPageSource.Contains("followed_by_viewer\":true")) { status = "Followed"; } } switch (status) { case "Followed": //status = "Followed"; QueryExecuter.updateFollowStatus(accountManager.username, UserName, "Unfollowed"); break; case "Unfollowed": status = "Unfollowed"; QueryExecuter.updateFollowStatus(accountManager.username, UserName, "Unfollowed"); break; case "requested": status = "requested"; QueryExecuter.updateFollowStatus(accountManager.username, UserName, "requested"); break; default: status = "Followed"; try { // QueryExecuter.insertFollowInfo(accountManager.username, UserName, "Followed"); } catch { } break; } return status; } if (FollowedPageSource.Contains("Verify Your Account")) { return "Verify Your Account"; } if (FollowedPageSource.Contains("Instagram API does not respond")) { return "Instagram API does not respond"; } else { return "UnFollowed"; } } catch (Exception) { return "Follow option is not available In page...!!"; } }
public void bothlikecomment(string photoId, string photoMsg, ref InstagramUser User_comment) { try { lstThreadsUsingUsername.Add(Thread.CurrentThread); lstThreadsUsingUsername.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { string status_Like = UsingUserName_liking(ref User_comment, photoId); string status_comment = Comment(photoId, photoMsg, ref User_comment); if (status_Like == "LIKED" && status_comment == "Success") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Comment and Like is successfully posted from " + photoId + "]"); } if (status_Like == "LIKED" && status_comment == "Fail") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Comment Not Done But Like is successfully posted from " + photoId + "]"); } if (status_comment == "Success" && status_Like == "Already LIKED") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Comment Done But Like is Allready Done on " + photoId + "]"); } if (status_Like == "Instagram API does not respond" && status_comment == "Instagram API does not respond") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Fail to comment and Like on Because Instagram API does not respond " + photoId + "]"); } if(status_Like == "" && status_comment == "Success") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ only comment done on " + photoId + "]"); } if (status_Like == "" && status_comment == "Fail") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Fail to comment and Like on " + photoId + "]"); } else { } if (minDelayUsingUsername != 0) { mindelay = minDelayUsingUsername; } if (maxDelayUsingUsername != 0) { maxdelay = maxDelayUsingUsername; } int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds For " + User_comment.username + " ]"); Thread.Sleep(delay * 1000); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
public void unfollowBackUser(ref InstagramUser accountManager, string account, int count) { try { lstThreadsunFollowerBack.Add(Thread.CurrentThread); lstThreadsunFollowerBack.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } GlobusHttpHelper obj = accountManager.globusHttpHelper; // string res_secondURL = obj.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGTestURL), ""); string res_secondURL = obj.getHtmlfromUrl(new Uri("https://www.instagram.com"), ""); string pageSource = string.Empty; string response = string.Empty; string profileId = string.Empty; const string websta = "http://websta.me/api/relationships/"; // const string accountUrl = "http://websta.me/n/"; const string accountUrl = "https://www.instagram.com/"; try { try { if (account.Contains(IGGlobals.Instance.IGWEP_HomePage)) { pageSource = accountManager.globusHttpHelper.getHtmlfromUrlProxy(new Uri(account), "", 80, "", ""); } else { pageSource = accountManager.globusHttpHelper.getHtmlfromUrlProxy(new Uri(accountUrl + account), "", 80, "", ""); } } catch { }; if (pageSource.Contains("followed_by_viewer\":false") && pageSource.Contains("requested_by_viewer\":false")) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [Allready Unfollowed " + account + " from " + accountManager.username + " Count" + count + "]"); return; } else if (!string.IsNullOrEmpty(pageSource)) { try { // string test = accountManager.globusHttpHelper.getHtmlfromUrl(new Uri(UserName)); // string txt_name = Utils.getBetween(UserName, "www.instagram.com/", "/"); string csrf_token = Utils.getBetween(pageSource, "csrf_token\":\"", "\""); string PK = Utils.getBetween(pageSource, "\"id\":", "\",").Replace("\"", ""); string postdata = "https://www.instagram.com/web/friendships/" + PK + "/unfollow/"; response = accountManager.globusHttpHelper.postFormDatainta(new Uri(postdata), "", "https://www.instagram.com/" + account + "/", csrf_token); } catch (Exception ex) { } if (!string.IsNullOrEmpty(response) && response.Contains("ok")) { //if (_boolStopUnfollow) return; DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User,DateTime ,UnfollowUser,Status) values('" + "UnfollowModule" + "','" + accountManager.username + "','" + DateTime.Now + "','" + account + "','" + "Success" + "')", "tbl_AccountReport"); string status = string.Empty; try { status = QueryExecuter.getFollowStatus(accountManager.username, account); switch (status) { //case "Followed": QueryExecuter.updateFollowStatus(accountManager.Username, account, "Unfollowed"); case "Followed": QueryExecuter.updateFollowStatus(accountManager.username, account, "Unfollowed"); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Unfollowed " + account + " from " + accountManager.username + " Count" + count + "]"); try { // NoOfUnFollowCompleted++; string path_AppDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Gram Dominator"; path_AppDataFolder = path_AppDataFolder + "\\UnFollwedList"; if (!File.Exists(path_AppDataFolder)) { Directory.CreateDirectory(path_AppDataFolder); } string FollowIDFilePath = path_AppDataFolder + "\\" + accountManager.username + ".csv"; string CSV_Header = "Username,UnFollowerName,Unfollowed"; string CSV_Content = accountManager.username.Replace(",", "") + "," + account.Replace(",", "") + "," + status; GlobusFileHelper.ExportDataCSVFile(CSV_Header, CSV_Content, FollowIDFilePath); List<string> StrListReadData = new List<string>(); try { try { StreamReader strReader = new StreamReader(ClGlobul.UnFollowerListUploadedPath); string text = ""; while ((text = strReader.ReadLine()) != null) { //string strUserListFromFilePath = strReader.ReadToEnd(); StrListReadData.Add(text); } strReader.Close(); if (StrListReadData.Contains(account)) { try { StrListReadData.Remove(account); } catch { }; } } catch { }; try { StreamWriter strWriter = new StreamWriter(ClGlobul.UnFollowerListUploadedPath); strWriter.Write(""); if (StrListReadData.Count() > 0) { foreach (string itemStr in StrListReadData) { try { strWriter.WriteLine(itemStr); } catch { }; } } strWriter.Close(); } catch { }; } catch { }; //AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " Removed From TextFile - " + ClGlobul.UnFollowerListUploadedPath + " ]"); } catch { }; break; case "Unfollowed": GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ All Ready UnFollowed " + account + " from " + accountManager.username + "]"); break; try { // NoOfUnFollowCompleted++; string path_AppDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Gram Dominator"; path_AppDataFolder = path_AppDataFolder + "\\UnFollwedList"; if (!File.Exists(path_AppDataFolder)) { Directory.CreateDirectory(path_AppDataFolder); } string FollowIDFilePath = path_AppDataFolder + "\\" + accountManager.username + ".csv"; string CSV_Header = "Username,UnFollowerName,Unfollowed"; string CSV_Content = accountManager.username.Replace(",", "") + "," + account.Replace(",", "") + "," + status; GlobusFileHelper.ExportDataCSVFile(CSV_Header, CSV_Content, FollowIDFilePath); List<string> StrListReadData = new List<string>(); try { try { StreamReader strReader = new StreamReader(ClGlobul.UnFollowerListUploadedPath); string text = ""; while ((text = strReader.ReadLine()) != null) { //string strUserListFromFilePath = strReader.ReadToEnd(); StrListReadData.Add(text); } strReader.Close(); if (StrListReadData.Contains(account)) { try { StrListReadData.Remove(account); } catch { }; } } catch { }; try { StreamWriter strWriter = new StreamWriter(ClGlobul.UnFollowerListUploadedPath); strWriter.Write(""); if (StrListReadData.Count() > 0) { foreach (string itemStr in StrListReadData) { try { strWriter.WriteLine(itemStr); } catch { }; } } strWriter.Close(); } catch { }; } catch { }; //AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " Removed From TextFile - " + ClGlobul.UnFollowerListUploadedPath + " ]"); } catch { }; break; default: GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + accountManager.username + " Unfollowed " + account + " Count" + count + "]"); //account QueryExecuter.updateFollowStatus(accountManager.username, account, "Unfollowed"); // NoOfUnFollowCompleted++; try { string path_AppDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Gram Dominator"; path_AppDataFolder = path_AppDataFolder + "\\UnFollwedList"; if (!File.Exists(path_AppDataFolder)) { Directory.CreateDirectory(path_AppDataFolder); } string FollowIDFilePath = path_AppDataFolder + "\\" + accountManager.username + ".csv"; string CSV_Header = "Username,UnFollowerName"; string CSV_Content = accountManager.username.Replace(",", "") + "," + account.Replace(",", ""); GlobusFileHelper.ExportDataCSVFile(CSV_Header, CSV_Content, FollowIDFilePath); List<string> StrListReadData = new List<string>(); try { try { StreamReader strReader = new StreamReader(ClGlobul.UnFollowerListUploadedPath); string text = ""; while ((text = strReader.ReadLine()) != null) { //string strUserListFromFilePath = strReader.ReadToEnd(); StrListReadData.Add(text); } strReader.Close(); if (StrListReadData.Contains(account)) { try { StrListReadData.Remove(account); } catch { }; } } catch { }; try { StreamWriter strWriter = new StreamWriter(ClGlobul.UnFollowerListUploadedPath); strWriter.Write(""); if (StrListReadData.Count() > 0) { foreach (string itemStr in StrListReadData) { try { strWriter.WriteLine(itemStr); } catch { }; } } strWriter.Close(); } catch { }; } catch { }; // AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " Removed From TextFile - " + ClGlobul.UnFollowerListUploadedPath + " ]"); } catch { }; break; } } catch { } //AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Unfollowed " + account + " from " + accountManager.Username + " ]"); } else { // if (_boolStopUnfollow) return; GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Could not Unfollow " + account + " from " + accountManager.username + " Count" + count + "]"); } } else { GlobusLogHelper.log.Info("Page Not Found"); } } catch (Exception ex) { } }
public void Start_Action_UserFollower(ref InstagramUser obj_Gram) { try { lstThreadsUserFollower.Add(Thread.CurrentThread); lstThreadsUserFollower.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { string[] lst_UserFollower_listedUser = ClGlobul.lstUserFollower_Username.ToArray(); GlobusHttpHelper obj_globul = new GlobusHttpHelper(); bool value = false; string proxyAddress = string.Empty; string proxyport = "80"; string proxyusername = string.Empty; string proxypasswrd = string.Empty; List<string> lst_workingfinalproxy = new List<string>(); string[] lst_Userfollowerlist = {}; try { DataSet ds = DataBaseHandler.SelectQuery("select * from tlb_WorkingProxy", "tlb_WorkingProxy"); DataTable dt = ds.Tables[0]; foreach (DataRow item in dt.Rows) { lst_workingfinalproxy.Add(item[1] + ":" + item[2] + ":" + item[3] + ":" + item[4]); } } catch (Exception ex) { } try { if (lst_workingfinalproxy.Count > 0) { string res_secondURL = obj_Gram.globusHttpHelper.getHtmlfromUrl_withProxt(new Uri("https://www.instagram.com"), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); string proxy = lst_workingfinalproxy[RandomNumberGenerator.GenerateRandom(0, lst_workingfinalproxy.Count)]; string[] proxydata = Regex.Split(proxy, ":"); if (proxydata.Count() == 2) { proxyAddress = proxydata[0]; proxyport = proxydata[1]; } if (proxydata.Count() == 4) { proxyAddress = proxydata[0]; proxyport = proxydata[1]; proxyusername = proxydata[2]; proxypasswrd = proxydata[3]; } } } catch (Exception ex) { } foreach(string username in lst_UserFollower_listedUser) { string gramfeed_user_Url = "http://www.gramfeed.com/" + username; // Username_ScrapFollower = itemusername; List<string> follower_list = new List<string>(); int count = 0; ClGlobul.switchAccount = false; string GramFeed_Userhit = obj_globul.getHtmlfromUrl_withProxt(new Uri(gramfeed_user_Url), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); string client_Id = Utils.getBetween(GramFeed_Userhit, "client_id=", "&"); string Id_Url = "https://api.instagram.com/v1/users/search?q=" + username + "&client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; string Gram_Hit_second = obj_globul.getHtmlfromUrl_withProxt(new Uri(Id_Url), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); if (string.IsNullOrEmpty(Gram_Hit_second)) { Thread.Sleep(1 * 3000); Gram_Hit_second = obj_ChangeProxy.chnageproxyMethod(Id_Url); } string GramFeed_UserId = Utils.getBetween(Gram_Hit_second, "\"id\":", "\",").Replace("\"", "").Replace(" ", ""); string Follower_Url = "https://api.instagram.com/v1/users/" + GramFeed_UserId + "/followed-by?client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; string GramFeed_UserFollower = obj_globul.getHtmlfromUrl_withProxt(new Uri(Follower_Url), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); if (string.IsNullOrEmpty(GramFeed_UserFollower)) { if (lst_workingfinalproxy.Count > 0) { GramFeed_UserFollower = obj_ChangeProxy.chnageproxyMethod(Follower_Url); } else { Thread.Sleep(1 * 3000); GramFeed_UserFollower = obj_globul.getHtmlfromUrl_withProxt(new Uri(Follower_Url), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); } } string[] follower_regexlist = Regex.Split(GramFeed_UserFollower, "username"); foreach (string item in follower_regexlist) { if (item.Contains("profile_picture")) { string user_name = Utils.getBetween(item, "\":", "\",").Replace("\"", "").Replace(" ", ""); if (follower_list.Count < Number_Follower && !follower_list.Contains(user_name)) { follower_list.Add(user_name); follower_list = follower_list.Distinct().ToList(); ClGlobul.lst_follower_UserFollower.Add(user_name); count++; try { GlobusLogHelper.log.Info(obj_Gram.username +" --> Scraped ===> " + user_name); } catch (Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } } else { break; } } } if (UserFollower_Delaymin != 0) { mindelay = UserFollower_Delaymin; } if (UserFollower_Delaymax != 0) { maxdelay = UserFollower_Delaymax; } int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds "); Thread.Sleep(delay * 1000); if (GramFeed_UserFollower.Contains("next_url")) { value = true; while (value) { if (GramFeed_UserFollower.Contains("next_url") && follower_list.Count < Number_Follower) { string hit_data = Utils.getBetween(GramFeed_UserFollower, "next_url\":", "\",").Replace("\u0026", "&").Replace("\\", "").Replace("u0026", "&").Replace("\"", "").Replace(" ", ""); GramFeed_UserFollower = obj_globul.getHtmlfromUrl_withProxt(new Uri(hit_data), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); if (string.IsNullOrEmpty(GramFeed_UserFollower)) { if (lst_workingfinalproxy.Count > 0) { GramFeed_UserFollower = obj_ChangeProxy.chnageproxyMethod(hit_data); } else { Thread.Sleep(1 * 3000); GramFeed_UserFollower = obj_globul.getHtmlfromUrl_withProxt(new Uri(Follower_Url), proxyAddress, int.Parse(proxyport), proxyusername, proxypasswrd); } } string[] follower_regexlist2 = Regex.Split(GramFeed_UserFollower, "username"); foreach (string item in follower_regexlist2) { if (item.Contains("profile_picture")) { string user_name = Utils.getBetween(item, "\":", "\",").Replace("\"", "").Replace(" ", ""); if (follower_list.Count < Number_Follower && !follower_list.Contains(user_name)) { follower_list.Add(user_name); follower_list = follower_list.Distinct().ToList(); ClGlobul.lst_follower_UserFollower.Add(user_name); try { GlobusLogHelper.log.Info(obj_Gram.username + " --> Scraped ===> " + user_name); } catch (Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } } else { break; } } } if (UserFollower_Delaymin != 0) { mindelay = UserFollower_Delaymin; } if (UserFollower_Delaymax != 0) { maxdelay = UserFollower_Delaymax; } delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds For "); Thread.Sleep(delay * 1000); } else { value = false; } } } // lst_Userfollowerlist = follower_list.ToArray(); ClGlobul.lst_follower_UserFollower = ClGlobul.lst_follower_UserFollower.Distinct().ToList(); lst_Userfollowerlist = ClGlobul.lst_follower_UserFollower.ToArray(); } foreach (string SubFollower in lst_Userfollowerlist) { FollowActivitystart(ref obj_Gram , SubFollower); } } catch(Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } finally { GlobusLogHelper.log.Info("!!! Process Completed !!!"); } }
public void like_follow(ref InstagramUser Gram_follow_like) { try { if(string.IsNullOrEmpty(UserName_path_followWithLike)) { } try { string Photo_Idd = string.Empty; string Username = string.Empty; foreach(string Photo_Id in ClGlobul.lstphotoId_Followwithlike) { if(Photo_Id.Contains("https://www.instagram.com/p/")) { Photo_Idd = Photo_Id.Replace("https://www.instagram.com/p/", "").Replace("/",""); } else { Photo_Idd = Photo_Id; } string URL = "https://www.instagram.com/p/" + Photo_Idd; string URL_Responce = Gram_follow_like.globusHttpHelper.getHtmlfromUrl(new Uri(URL)); if(URL_Responce.Contains("followed_by_viewer\":false")) { Username = Utils.getBetween(URL_Responce,"owner\":{\"username\":\"","\""); string Result = Follow(Username, ref Gram_follow_like); if (Result == "Followed") { GlobusLogHelper.log.Info(Gram_follow_like.username + "==> Start Follow ==> " + Username); } } else { if(URL_Responce.Contains("followed_by_viewer\":true")) { Username = Utils.getBetween(URL_Responce, "owner\":{\"username\":\"", "\""); GlobusLogHelper.log.Info( " Already Follow--" + Username + "-- By ==> " + Gram_follow_like.username); } } if(URL_Responce.Contains("viewer_has_liked\":false")) { string Status = photolike(Photo_Id, ref Gram_follow_like); if (Status == "LIKED") { GlobusLogHelper.log.Info(Gram_follow_like.username + "==> LIKED PHOTO ==> " + Photo_Id); } } else { if(URL_Responce.Contains("viewer_has_liked\":true")) { GlobusLogHelper.log.Info(" Already Like--" + Photo_Id + "-- By ==> " + Gram_follow_like.username); } } if (minDelayFollowerwithlikePoster != 0) { mindelay = minDelayFollowerwithlikePoster; } if (maxDelayFollowerwithlikePoster != 0) { maxdelay = maxDelayFollowerwithlikePoster; } Random FolloweRandom = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = FolloweRandom.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } } catch(Exception ex) { } } catch(Exception ex) { } finally { GlobusLogHelper.log.Info("=================================="); GlobusLogHelper.log.Info("---- Proccess Completed ----"); GlobusLogHelper.log.Info("=================================="); } }
public void FollowUrls(ref InstagramUser accountManager, string url) { try { //lstThreadsHash_comment.Add(Thread.CurrentThread); //lstThreadsHash_comment.Distinct(); //Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } string followStatus = string.Empty; try { string res_secondURL = accountManager.globusHttpHelper.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGTestURL), ""); string user = accountManager.username; 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 (!(No_Follow_User == ClGlobul.SnapVideosCounterfollow)) { string status = Follow(url, ref accountManager); // Thread.Sleep(ClGlobul.hashTagDelay * 1000); No_Follow_User++; if (status == "Followed") { DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User,DateTime ,FollowerName,Status) values('" + "FollowModule" + "','" + accountManager.username + "','" + DateTime.Now + "','" + url + "','" + status + "')", "tbl_AccountReport"); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] " + "[ Profile followed with url : " + url + " with User = "******" , " + "Count" + No_Follow_User + "]"); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] " + "[ Profile followed with url : " + url + " with User = "******" , " + "Count" + No_Follow_User + " ]"); //Log("[ " + DateTime.Now + "] " + " [ " + ClGlobul.NumberOfProfilesToFollow + " profiles Unfollowed ]"); } } } } catch (Exception ex) { } }
public void StartAction(ref InstagramUser Gram_obj) { try { lstThreadsunFollowerbackPoster.Add(Thread.CurrentThread); lstThreadsunFollowerbackPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { if(isUnFollowBack) { UnFollowBack(ref Gram_obj); } } catch(Exception ex) { GlobusLogHelper.log.Error("Error: " + ex.StackTrace); } }
public void UnFollowBack(ref InstagramUser Gram_Obj) { try { lstThreadsunFollowerbackPoster.Add(Thread.CurrentThread); lstThreadsunFollowerbackPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } DataSet ds = null; int days = No_Days_To_Unfollow; try { ds = Qm.SelectFollowUser("Followed", Gram_Obj.username); DataTable firstTable = ds.Tables[0]; if(firstTable.Rows.Count==0) { GlobusLogHelper.log.Info("!! Inputed Days you Enter at that Days you not Follow Any user Thourgh This Bot !!"); return; } foreach (DataRow dRow in firstTable.Rows) { string following_username = dRow["FollowTime"].ToString() + ""; string follow_Username = dRow["FollowingUser"].ToString() + ""; DateTime dt = DateTime.Parse(following_username); TimeSpan tsDays = DateTime.Now.Date.Subtract(dt.Date); if (tsDays.TotalDays <= days) { lst_UnfollowUser.Add(follow_Username); lst_UnfollowUser = lst_UnfollowUser.Distinct().ToList(); } } GlobusHttpHelper obj_globalus = new GlobusHttpHelper(); #region Scrape Follower string gramfeed_user_Url = "http://www.gramfeed.com/" + Gram_Obj.username; List<string> follower_list = new List<string>(); int count = 0; ClGlobul.switchAccount = false; string GramFeed_Userhit = obj_globalus.getHtmlfromUrl(new Uri(gramfeed_user_Url), ""); string client_Id = Utils.getBetween(GramFeed_Userhit, "client_id=", "&"); string Id_Url = "https://api.instagram.com/v1/users/search?q=" + Gram_Obj.username + "&client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; string Gram_Hit_second = obj_globalus.getHtmlfromUrl(new Uri(Id_Url), ""); if (string.IsNullOrEmpty(Gram_Hit_second)) { Gram_Hit_second = obj_ChangeProxy.chnageproxyMethod(Id_Url); } string GramFeed_UserId = Utils.getBetween(Gram_Hit_second, "id\":", "\",").Replace(" ","").Replace("\"",""); string Follower_Url = "https://api.instagram.com/v1/users/" + GramFeed_UserId + "/followed-by?client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; string GramFeed_UserFollower = obj_globalus.getHtmlfromUrl(new Uri(Follower_Url), ""); if(string.IsNullOrEmpty(GramFeed_UserFollower)) { GramFeed_UserFollower = obj_ChangeProxy.chnageproxyMethod(Follower_Url); } string[] follower_regexlist = Regex.Split(GramFeed_UserFollower, "username"); foreach (string item in follower_regexlist) { if (item.Contains("profile_picture")) { string user_name = Utils.getBetween(item, "\":\"", "\""); if (!lst_Follower_unfollowback.Contains(user_name)) { lst_Follower_unfollowback.Add(user_name); lst_Follower_unfollowback = lst_Follower_unfollowback.Distinct().ToList(); } else { break; } } } if (GramFeed_UserFollower.Contains("next_url")) { value = true; while (value) { if (GramFeed_UserFollower.Contains("next_url")) { string hit_data = Utils.getBetween(GramFeed_UserFollower, "next_url\":\"", "\",").Replace("\u0026", "&").Replace("\\", "").Replace("u0026", "&"); GramFeed_UserFollower = obj_globalus.getHtmlfromUrl(new Uri(hit_data), ""); string[] follower_regexlist2 = Regex.Split(GramFeed_UserFollower, "username"); foreach (string item in follower_regexlist2) { if (item.Contains("profile_picture")) { string user_name = Utils.getBetween(item, "\":\"", "\""); if (!lst_Follower_unfollowback.Contains(user_name)) { lst_Follower_unfollowback.Add(user_name); lst_Follower_unfollowback = lst_Follower_unfollowback.Distinct().ToList(); } else { break; } } } //if (minDelayUnFollowerBack != 0) //{ // mindelay = minDelayUnFollowerBack; //} //if (maxDelayUnFollowerBack != 0) //{ // maxdelay = maxDelayUnFollowerBack; //} // delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); //GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds "); //Thread.Sleep(delay * 1000); } else { value = false; } } } #endregion #region UnfollowBack Process try { int Sum = 0; foreach (string item in lst_UnfollowUser) { string resp_test = Gram_Obj.globusHttpHelper.getHtmlfromUrl(new Uri("http://www.Instagram.com/" + item)); if (!lst_Follower_unfollowback.Contains(item)) { if (resp_test.Contains("followed_by_viewer\":false") || resp_test.Contains("requested_by_viewer\":false")) { Sum++; IsunfollowBack = true; unfollowAccount(ref Gram_Obj, item, Sum); Qm.DeleteunfollowUser(item); if (minDelayUnFollowerBack != 0) { mindelay = minDelayUnFollowerBack; } if (maxDelayUnFollowerBack != 0) { maxdelay = maxDelayUnFollowerBack; } Random rn = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = rn.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } else { if(resp_test.Contains("followed_by_viewer\":true") || resp_test.Contains("requested_by_viewer\":true")) { GlobusLogHelper.log.Info(item+ "--> Start Follow -->" +Gram_Obj.username); } } } else { // User Follow Back to You. } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } #endregion } catch(Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } GlobusLogHelper.log.Info(" ---Process Completed--- "); }
private void LoadAccountMultithreaded(string item) { //counter = counter + 1; try { counter++; string account = item; string[] AccArr = account.Split(':'); if (AccArr.Count() > 1) { string accountUser = string.Empty; accountUser = account.Split(':')[0]; string accountPass = account.Split(':')[1]; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; string Status = string.Empty; int DataCount = account.Split(':').Length; if (DataCount == 2) { //Globals.accountMode = AccountMode.NoProxy; } else if (DataCount == 4) { proxyAddress = account.Split(':')[2]; proxyPort = account.Split(':')[3]; } else if (DataCount > 5 && DataCount < 7) { proxyAddress = account.Split(':')[2]; proxyPort = account.Split(':')[3]; proxyUserName = account.Split(':')[4]; proxyPassword = account.Split(':')[5]; } else if (DataCount >= 7) { proxyAddress = account.Split(':')[2]; proxyPort = account.Split(':')[3]; proxyUserName = account.Split(':')[4]; proxyPassword = account.Split(':')[5]; Status = "Not Checked"; } Status = "Not Checked"; // dt.Rows.Add(accountUser, accountPass, proxyAddress, proxyPort, proxyUserName, proxyPassword, Status); // dt.Rows.Add(accountUser, accountPass, proxyAddress, proxyPort, proxyUserName, proxyPassword); string insertQuery = "insert into AccountVerification(Username,Password,ProxyAddress,ProxyPort,ProxyUsername,ProxyPassword,Status) values ('" + accountUser + "','" + accountPass + "','" + proxyAddress + "','" + proxyPort + "','" + proxyUserName + "','" + proxyPassword + "','" + Status + "') "; BaseLib.DataBaseHandler.InsertQuery(insertQuery, "AccountVerification"); try { InstagramUser objInstagramUser = new InstagramUser(accountUser, accountPass, proxyAddress, proxyPort); objInstagramUser.username = accountUser; objInstagramUser.password = accountPass; objInstagramUser.proxyip = proxyAddress; objInstagramUser.proxyport = proxyPort; objInstagramUser.proxyusername = proxyUserName; objInstagramUser.proxypassword = proxyPassword; IGGlobals.loadedAccountsDictionary.Add(objInstagramUser.username, objInstagramUser); IGGlobals.listAccounts.Add(objInstagramUser.username + ":" + objInstagramUser.password + ":" + objInstagramUser.proxyip + ":" + objInstagramUser.proxyport + ":" + objInstagramUser.proxyusername + ":" + objInstagramUser.proxypassword); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } ///Set this to "0" if loading unprofiled accounts /// string profileStatus = "0"; } else { GlobusLogHelper.log.Info("Account has some problem : " + item); GlobusLogHelper.log.Debug("Account has some problem : " + item); } lbl_AccountVerification_Report_NoOfAccountLoaded.Dispatcher.Invoke(new Action(() => { lbl_AccountVerification_Report_NoOfAccountLoaded.Content = IGGlobals.listAccounts.Count.ToString(); })); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } finally { counter--; } }
private void CheckedAccountFromDataGrid_Click(object sender, RoutedEventArgs e) { string accountUser = string.Empty; string accountPass = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; string status = string.Empty; try { //foreach (GramDominator.Classes.Validation objValidation in dgv_List_of_Account.SelectedItems) //{ //} DataSet ds = null; try { ds = Qm.SelectAccountreport(""); } catch(Exception ex) { GlobusLogHelper.log.Info("Error:" + ex.StackTrace); } IGGlobals.listAccounts.Clear(); for (int noRow = 0; noRow < ds.Tables[0].Rows.Count; noRow++) { string account = ds.Tables[0].Rows[noRow].ItemArray[0].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[1].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[2].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[3].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[4].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[5].ToString(); IGGlobals.listAccounts.Add(account); // dv.AllowNew = false; accountUser =ds.Tables[0].Rows[noRow].ItemArray[0].ToString(); accountPass =ds.Tables[0].Rows[noRow].ItemArray[1].ToString(); proxyAddress =ds.Tables[0].Rows[noRow].ItemArray[2].ToString(); proxyPort = ds.Tables[0].Rows[noRow].ItemArray[3].ToString(); proxyUserName=ds.Tables[0].Rows[noRow].ItemArray[4].ToString(); proxyPassword=ds.Tables[0].Rows[noRow].ItemArray[5].ToString(); InstagramUser objInstagramUser = new InstagramUser("","","",""); objInstagramUser.username = accountUser; objInstagramUser.password = accountPass; objInstagramUser.proxyip = proxyAddress; objInstagramUser.proxyport = proxyPort; objInstagramUser.proxyusername = proxyUserName; objInstagramUser.proxypassword = proxyPassword; try { IGGlobals.loadedAccountsDictionary.Add(objInstagramUser.username, objInstagramUser); } catch { } } } catch(Exception ex) { GlobusLogHelper.log.Info("Error :" + ex.StackTrace); } }
public void CommentOperation(string Acc, string[] Hash) { try { lstThreadsCommentPoster.Add(Thread.CurrentThread); lstThreadsCommentPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { string status = string.Empty; string[] arrAcc = Regex.Split(Acc, ":"); InstagramUser objInstagramUser = new InstagramUser(arrAcc[0], arrAcc[1], arrAcc[2], arrAcc[3]); GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); objInstagramUser.globusHttpHelper = objGlobusHttpHelper; AccountManager objAccountManager = new AccountManager(); if (!objInstagramUser.isloggedin) { status = objAccountManager.LoginUsingGlobusHttp(ref objInstagramUser); } if (status == "Success" || (objInstagramUser.isloggedin)) { foreach (string itemHash in Hash) { if (!string.IsNullOrEmpty(itemHash)) { //Operation string[] Data_ID = Regex.Split(itemHash, ","); string daaa = objInstagramUser.username; foreach (string Photo_ID in Data_ID) { if (!string.IsNullOrEmpty(Photo_ID)) { // CommentOnSnapsVideos(ref objInstagramUser, Photo_ID); getComment(Photo_ID, ref objInstagramUser); } else { break; } if (minDelayCommentPoster != 0) { mindelay = minDelayCommentPoster; } if (maxDelayCommentPoster != 0) { maxdelay = maxDelayCommentPoster; } Random obj_rn = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = obj_rn.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } } GlobusLogHelper.log.Info("========================="); GlobusLogHelper.log.Info("Process Completed !!!"); GlobusLogHelper.log.Info("========================="); } } } catch (Exception ex) { GlobusLogHelper.log.Info("Error : " + ex.StackTrace); } }
public void StartAction(ref InstagramUser Gram_obj) { try { if (isUnFollowBack) { UnFollowBack(ref Gram_obj); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error: " + ex.StackTrace); } }
public void FollowOperationequal(string Acc, string[] Hash) { string status = string.Empty; string[] arrAcc = Regex.Split(Acc, ":"); InstagramUser objInstagramUser = new InstagramUser(arrAcc[0], arrAcc[1], arrAcc[2], arrAcc[3]); GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); objInstagramUser.globusHttpHelper = objGlobusHttpHelper; AccountManager objAccountManager = new AccountManager(); if (!objInstagramUser.isloggedin) { status = objAccountManager.LoginUsingGlobusHttp(ref objInstagramUser); } if (status == "Success" || (objInstagramUser.isloggedin)) { foreach (string itemHash in Hash) { if (!string.IsNullOrEmpty(itemHash)) { //Operation string[] Data_ID = Regex.Split(itemHash, ","); string daaa = objInstagramUser.username; foreach (string Photo_ID in Data_ID) { if (!string.IsNullOrEmpty(Photo_ID)) { FollowUrls(ref objInstagramUser, Photo_ID); } else { break; } if (minDelayFollowerPoster != 0) { mindelay = minDelayFollowerPoster; } if (maxDelayFollowerPoster != 0) { maxdelay = maxDelayFollowerPoster; } Random obj_rn = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = obj_rn.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } } GlobusLogHelper.log.Info("========================="); GlobusLogHelper.log.Info("Process Completed !!!"); GlobusLogHelper.log.Info("========================="); } } }
public void UnFollowBack(ref InstagramUser Gram_Obj) { DataSet ds = null; int days = No_Days_To_Unfollow * 24 * 60; try { ds = Qm.SelectFollowUser("Followed", Gram_Obj.username); DataTable firstTable = ds.Tables[0]; foreach (DataRow dRow in firstTable.Rows) { string following_username = dRow["FollowTime"].ToString() + ""; string follow_Username = dRow["FollowingUser"].ToString() + ""; DateTime dt = DateTime.Parse(following_username); DateTime dp = DateTime.Now; TimeSpan dk = dp - dt; int minutes = (int)dk.TotalMinutes; if (minutes > days) { lst_UnfollowUser.Add(follow_Username); } } #region Scrape Follower string gramfeed_user_Url = "http://www.gramfeed.com/" + Gram_Obj.username; List<string> follower_list = new List<string>(); int count = 0; ClGlobul.switchAccount = false; string GramFeed_Userhit = Gram_Obj.globusHttpHelper.getHtmlfromUrl(new Uri(gramfeed_user_Url), ""); string client_Id = Utils.getBetween(GramFeed_Userhit, "client_id=", "&"); string Id_Url = "https://api.instagram.com/v1/users/search?q=" + Gram_Obj.username + "&client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; string Gram_Hit_second = Gram_Obj.globusHttpHelper.getHtmlfromUrl(new Uri(Id_Url), ""); string GramFeed_UserId = Utils.getBetween(Gram_Hit_second, "id\":\"", "\""); string Follower_Url = "https://api.instagram.com/v1/users/" + GramFeed_UserId + "/followed-by?client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; string GramFeed_UserFollower = Gram_Obj.globusHttpHelper.getHtmlfromUrl(new Uri(Follower_Url), ""); string[] follower_regexlist = Regex.Split(GramFeed_UserFollower, "username"); foreach (string item in follower_regexlist) { if (item.Contains("profile_picture")) { string user_name = Utils.getBetween(item, "\":\"", "\""); if (!lst_Follower_unfollowback.Contains(user_name)) { lst_Follower_unfollowback.Add(user_name); lst_Follower_unfollowback = lst_Follower_unfollowback.Distinct().ToList(); } else { break; } } } if (GramFeed_UserFollower.Contains("next_url")) { value = true; while (value) { if (GramFeed_UserFollower.Contains("next_url")) { string hit_data = Utils.getBetween(GramFeed_UserFollower, "next_url\":\"", "\",").Replace("\u0026", "&").Replace("\\", "").Replace("u0026", "&"); GramFeed_UserFollower = Gram_Obj.globusHttpHelper.getHtmlfromUrl(new Uri(hit_data), ""); string[] follower_regexlist2 = Regex.Split(GramFeed_UserFollower, "username"); foreach (string item in follower_regexlist2) { if (item.Contains("profile_picture")) { string user_name = Utils.getBetween(item, "\":\"", "\""); if (!lst_Follower_unfollowback.Contains(user_name)) { lst_Follower_unfollowback.Add(user_name); lst_Follower_unfollowback = lst_Follower_unfollowback.Distinct().ToList(); } else { break; } } } } else { value = false; } } } #endregion #region UnfollowBack Process try { int Sum = 0; foreach (string item in lst_UnfollowUser) { if (!lst_Follower_unfollowback.Contains(item)) { Sum++; IsunfollowBack = true; unfollowBackUser(ref Gram_Obj, item, Sum); } else { // User Follow Back to You. } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } #endregion } catch (Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } GlobusLogHelper.log.Info(" ---Process Completed--- "); }
private void StartActionFollowerModule(ref InstagramUser fbUser) { try { if (IsUnFollow == true) { Start_Unfollow(ref fbUser); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
public void StartAction(ref InstagramUser Obj_Gram) { try { lstThreadsUserFollower.Add(Thread.CurrentThread); lstThreadsUserFollower.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { Start_Action_UserFollower(ref Obj_Gram); } catch(Exception ex) { GlobusLogHelper.log.Error("Error:"+ex.StackTrace); } }
public void Start_Follow(ref InstagramUser obj_follow) { try { lstThreadsFollowerPoster.Add(Thread.CurrentThread); lstThreadsFollowerPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { if (string.IsNullOrEmpty(UserName_path)) { } if (status == "Success") { getFollow(ref obj_follow); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
public void FollowActivitystart(ref InstagramUser Obj_gram , string Username) { try { lstThreadsUserFollower.Add(Thread.CurrentThread); lstThreadsUserFollower.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { string FollowerName = Username; int count = 0; string Result = string.Empty; string Home_Checkfollow = Obj_gram.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com/" + FollowerName + "/"), ""); if (!Home_Checkfollow.Contains("followed_by_viewer\":true") && !Home_Checkfollow.Contains("requested_by_viewer\":true")) { Result = Follow(FollowerName, ref Obj_gram); count++; } else { if (Home_Checkfollow.Contains("followed_by_viewer\":true")) { GlobusLogHelper.log.Info("!!" + Obj_gram.username + "--> Allready Following -->" + FollowerName + "!!"); } if (Home_Checkfollow.Contains("requested_by_viewer\":true")) { GlobusLogHelper.log.Info("!!" + Obj_gram.username + "--> AllReady Requested -->" + FollowerName + "!!"); } } abc: if (Result == "Followed") { GlobusLogHelper.log.Info(Obj_gram.username + "--> Succesfully Follow --> " + FollowerName); } if (Result == "requested") { GlobusLogHelper.log.Info(Obj_gram.username + "--> User Private Request Send to --> " + FollowerName); } if(string.IsNullOrEmpty(Result)) { Result = Follow(FollowerName, ref Obj_gram); if (string.IsNullOrEmpty(Result)) { GlobusLogHelper.log.Info(Obj_gram.username + " --> Cannot Follow Or Requested -->" +FollowerName + "--> Due API Not responding "); } else { goto abc; } } if (UserFollower_Delaymin != 0) { mindelay = UserFollower_Delaymin; } if (UserFollower_Delaymax != 0) { maxdelay = UserFollower_Delaymax; } int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds "); Thread.Sleep(delay * 1000); } catch(Exception ex) { GlobusLogHelper.log.Error("Error:" + ex.StackTrace); } }
public void Start_Unfollow(ref InstagramUser Obj_Unfollow) { try { lstThreadsUnFollowerPoster.Add(Thread.CurrentThread); lstThreadsUnFollowerPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { GlobusHttpHelper obj = Obj_Unfollow.globusHttpHelper; // string res_secondURL = obj.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGTestURL), ""); string res_secondURL = obj.getHtmlfromUrl(new Uri("https://www.instagram.com"), ""); if (string.IsNullOrEmpty(UserName_path_Unfollow)) { } if (Obj_Unfollow.isloggedin == true) { try { if (No_UnFollow_User != 0) { NoOfMaximumNoOfUnfollow = No_UnFollow_User; // } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Please Enter Maximum No. of count of Follwers To Be Folllowed ]"); return; } } catch { }; int Data_count = 0; int sum = NoOfMaximumNoOfUnfollow; foreach (string item in ClGlobul.lstUnfollowerList) { try { Data_count = Data_count + 1; if (Data_count > sum) { //AddToLogger("[ " + DateTime.Now + " ] => [ Maximum No of UnFollowers are UnFollowed . Its completed with username - " + AccountName + " ]"); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Maximum No of UnFollowers are All Ready UnFollowed . Its completed with username - " + Obj_Unfollow.username + " ]"); break; } try { unfollowAccount(ref Obj_Unfollow, item, Data_count); // count++; } catch { }; if (minDelayUnFollowerPoster != 0) { mindelay = minDelayUnFollowerPoster; } if (maxDelayUnFollowerPoster != 0) { maxdelay = maxDelayUnFollowerPoster; } Random rn = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = rn.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [Process Completed from " + Obj_Unfollow.username + " ]"); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
public void Start_LikeAndComment(ref InstagramUser obj_likecommnet) { try { lstThreadsUsingUsername.Add(Thread.CurrentThread); lstThreadsUsingUsername.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { string test_resp = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com"), ""); if (string.IsNullOrEmpty(UsingUsercontrol_Likecomment_User_path) && string.IsNullOrEmpty(UsingUsercontrol_Likecomment_message_single_path)) { if (!string.IsNullOrEmpty(UsingUsercontrol_Likecomment_single) && (!string.IsNullOrEmpty(UsingUsercontrol_Likecomment_message_single))) { string s = UsingUsercontrol_Likecomment_single; if (s.Contains(",")) { string[] data = Regex.Split(s, ","); foreach (string item in data) { ClGlobul.UsingUsername_likecommentUserList.Add(item); } } else { ClGlobul.UsingUsername_likecommentUserList.Add(UsingUsercontrol_Likecomment_single); } string k = UsingUsercontrol_Likecomment_message_single; if (k.Contains(",")) { string[] data1 = Regex.Split(k, ","); foreach (string item1 in data1) { ClGlobul.UsingUsername_likecommentMessageList.Add(item1); } } else { ClGlobul.UsingUsername_likecommentMessageList.Add(UsingUsercontrol_Likecomment_message_single); } } } foreach (string user in ClGlobul.UsingUsername_likecommentUserList) { try { string resp = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com"), ""); int count = 0; ClGlobul.UsingUsername_likecommentFollowerpicture.Clear(); string response = string.Empty; try { string Home_icon_Url = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri("http://iconosquare.com"), ""); string Icon_url = IGGlobals.Instance.IGiconosquareAuthorizeurl; string PPagesource = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri(Icon_url), ""); string responce_icon = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGiconosquareviewUrl), ""); if (!string.IsNullOrEmpty(responce_icon)) { string url = "http://iconosquare.com/viewer.php#/search/" + user; string referer = "http://iconosquare.com/viewer.php"; string viewer_responce = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri("http://iconosquare.com/viewer.php "), ""); string crs_token = Utils.getBetween(viewer_responce, " <div id=\"accesstoken\" style=\"display:none;\">", "</div>"); response = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri(url), ""); string postdata = "http://iconosquare.com/rqig.php?e=/users/search&a=ico2&t=" + crs_token + "&q=" + user; string respon_scrapeuser = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri(postdata), referer); string ID = Utils.getBetween(respon_scrapeuser, "id\":\"", "\""); //string[] data_divided = Regex.Split(respon_scrapeuser, "username"); string Profile_user = "******" + ID + "/"; string post_data = "http://iconosquare.com/rqig.php?e=/users/" + ID + "/follows&a=ico2&t=" + crs_token + "&count=20"; string list_follower = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri("http://iconosquare.com/viewer.php#/followers/" + ID), ""); string follow_respo = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri(post_data), "http://iconosquare.com/viewer.php"); string[] data = Regex.Split(follow_respo, "username"); foreach (string item in data) { try { if (item.Contains("profile_picture")) { string follower_name = Utils.getBetween(item, "\":\"", "\""); if (UsingUsername_likecomment_Nouser > count) { ClGlobul.UsingUername_likecommentPhotoIDList.Add(follower_name); GlobusLogHelper.log.Info(follower_name); count++; } else { break; } } } catch (Exception ex) { GlobusLogHelper.log.Info("Error :" + ex.StackTrace); } } if (follow_respo.Contains("next_url") && UsingUsername_likecomment_Nouser > count) { value = true; while (value) { if (follow_respo.Contains("next_url") || UsingUsername_likecomment_Nouser > count) { string next_pageurl_token = Utils.getBetween(follow_respo, "next_cursor\":\"", "\"},"); string page_Url = postdata + "&cursor=" + next_pageurl_token; follow_respo = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri(page_Url), "http://iconosquare.com/viewer.php"); string[] data1 = Regex.Split(follow_respo, "username"); foreach (string item in data1) { if (item.Contains("profile_picture")) { string follower_user = Utils.getBetween(item, "\":\"", "\""); if (UsingUsername_likecomment_Nouser > count) { ClGlobul.UsingUername_likecommentPhotoIDList.Add(follower_user); GlobusLogHelper.log.Info(follower_user); count++; } else { break; } } } } else { value = false; } } } } } catch(Exception ex) { GlobusLogHelper.log.Info("Error:" + ex.StackTrace); } try { foreach (string URL_follower in ClGlobul.UsingUername_likecommentPhotoIDList) { int num = 0; string follower_home = obj_likecommnet.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com/" + URL_follower)); string[] Data = Regex.Split(follower_home, "code"); foreach (string item in Data) { if (follower_home.Contains("is_private\":true")) { GlobusLogHelper.log.Info("This user is private --->" + URL_follower); break; } if (Data.Count() == 1) { GlobusLogHelper.log.Info("NO Post is Posted --->" + URL_follower); break; } if (item.Contains("date")) { if (num < 1) { string photoid = Utils.getBetween(item, "\":\"", "\""); ClGlobul.UsingUername_PhotoIDList.Add(photoid); num++; } else { break; } } } } foreach (string photoIdd in ClGlobul.UsingUername_PhotoIDList) { string message = ClGlobul.UsingUsername_likecommentMessageList[RandomNumberGenerator.GenerateRandom(0, ClGlobul.UsingUsername_likecommentMessageList.Count)]; bothlikecomment(photoIdd, message, ref obj_likecommnet); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
public void getFollow(ref InstagramUser obj_folow) { try { lstThreadsFollowerPoster.Add(Thread.CurrentThread); lstThreadsFollowerPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { GlobusHttpHelper obj = obj_folow.globusHttpHelper; string res_resonce = obj.getHtmlfromUrl(new Uri("https://www.instagram.com"), ""); if (ClGlobul.followingList.Count != 0) { int maximumNoOfCount = 0; try { if (No_Follow_User != 0) { maximumNoOfCount = No_Follow_User; } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Please Enter Maximum No. of count of Follwers To Be Followed ]"); return; } if (No_Follow_User != 0) { maximumNoOfCount = No_Follow_User; } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Please Enter Maximum No. of count of Follwers To Be Followed ]"); return; } } catch { }; int CountOfFollowersInForeach = 0; int count = 0; counter_follow = IGGlobals.listAccounts.Count() * maximumNoOfCount; string Result = string.Empty; foreach (string followingList_item in ClGlobul.followingList) { List<string> AllreadyfollowingList = new List<string>(); try { #region commented ////------------------------------------------------------------------------------------------// //string gramfeed_user_Url = "http://www.gramfeed.com/" + obj_folow.username; //ClGlobul.switchAccount = false; //string GramFeed_Userhit = obj_Global.getHtmlfromUrl(new Uri(gramfeed_user_Url), ""); //if(string.IsNullOrEmpty(GramFeed_Userhit)) //{ // GramFeed_Userhit = obj_ChangeProxy.chnageproxyMethod(gramfeed_user_Url); //} //string client_Id = Utils.getBetween(GramFeed_Userhit, "client_id=", "&"); //string Id_Url = "https://api.instagram.com/v1/users/search?q=" + obj_folow.username + "&client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; //string Gram_Hit_second = obj_Global.getHtmlfromUrl(new Uri(Id_Url), ""); //if (string.IsNullOrEmpty(Gram_Hit_second)) //{ // Gram_Hit_second = obj_ChangeProxy.chnageproxyMethod(Id_Url); //} //string GramFeed_UserId = Utils.getBetween(Gram_Hit_second, "id\":\"", "\""); //string Follower_Url = "https://api.instagram.com/v1/users/" + GramFeed_UserId + "/follows?client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024"; //string GramFeed_UserFollower = obj_Global.getHtmlfromUrl(new Uri(Follower_Url), ""); //if (string.IsNullOrEmpty(GramFeed_UserFollower)) //{ // GramFeed_UserFollower = obj_ChangeProxy.chnageproxyMethod(Follower_Url); //} //string[] follower_regexlist = Regex.Split(GramFeed_UserFollower, "username"); //foreach (string item in follower_regexlist) //{ // if (item.Contains("profile_picture")) // { // string user_name = Utils.getBetween(item, "\":", "\",").Replace("\"","").Replace(" ",""); // if (!AllreadyfollowingList.Contains(user_name)) // { // AllreadyfollowingList.Add(user_name); // AllreadyfollowingList = AllreadyfollowingList.Distinct().ToList(); // ClGlobul.lstfollowerList_final.Add(user_name); // // GlobusLogHelper.log.Info("Scraped===>" + user_name); // } // else // { // break; // } // } //} //if (GramFeed_UserFollower.Contains("next_url")) //{ // value = true; // while (value) // { // if (GramFeed_UserFollower.Contains("next_url")) // { // string hit_data = Utils.getBetween(GramFeed_UserFollower, "next_url\":\"", "\",").Replace("\u0026", "&").Replace("\\", "").Replace("u0026", "&"); // GramFeed_UserFollower = obj_Global.getHtmlfromUrl(new Uri(hit_data), ""); // if (string.IsNullOrEmpty(GramFeed_UserFollower)) // { // GramFeed_UserFollower = obj_ChangeProxy.chnageproxyMethod(hit_data); // } // string[] follower_regexlist2 = Regex.Split(GramFeed_UserFollower, "username"); // foreach (string item in follower_regexlist2) // { // if (item.Contains("profile_picture")) // { // string user_name = Utils.getBetween(item, "\":\"", "\""); // if (!AllreadyfollowingList.Contains(user_name)) // { // AllreadyfollowingList.Add(user_name); // AllreadyfollowingList = AllreadyfollowingList.Distinct().ToList(); // ClGlobul.lstfollowerList_final.Add(user_name); // } // else // { // break; // } // } // } // } // else // { // value = false; // } // } //} #endregion string FollowerName = followingList_item; string Home_Checkfollow = obj_folow.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com/" + FollowerName+"/"), ""); if(!Home_Checkfollow.Contains("followed_by_viewer\":true") && !Home_Checkfollow.Contains("requested_by_viewer\":true")) { if (count < maximumNoOfCount) { Result = Follow(FollowerName, ref obj_folow); count++; } else { break; } } else { if(Home_Checkfollow.Contains("followed_by_viewer\":true")) { GlobusLogHelper.log.Info("!!" + obj_folow.username + "--> Allready Following -->" + FollowerName + "!!"); } if (Home_Checkfollow.Contains("requested_by_viewer\":true")) { GlobusLogHelper.log.Info("!!" + obj_folow.username + "--> AllReady Requested -->" + FollowerName + "!!"); } } if (CountOfFollowersInForeach >= maximumNoOfCount) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Maximum No of Followers are Followed . Its completed with username - " + obj_folow.username + " ]"); return; } if (Result == "Followed") { CountOfFollowersInForeach++; ClGlobul.TotalNoOfFollow++; DataBaseHandler.InsertQuery("insert into FollowInfo(AccountHolder,FollowingUser,FollowTime ,FollowStatus) values('" + obj_folow.username + "','" + FollowerName + "','" + DateTime.Now + "','" + Result + "')", "FollowInfo"); DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User,DateTime ,FollowerName,Status) values('" + "FollowModule" + "','" + obj_folow.username + "','" + DateTime.Now + "','" + FollowerName + "','" + Result + "')", "tbl_AccountReport"); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [" + obj_folow.username + " Followed " + FollowerName + " , " + "Count" + CountOfFollowersInForeach + " ]"); objaddlablefollowDelegate(); try { string path_AppDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Gram Dominator"; path_AppDataFolder = path_AppDataFolder + "\\FollwedList"; if (!File.Exists(path_AppDataFolder)) { Directory.CreateDirectory(path_AppDataFolder); } string FollowIDFilePath = path_AppDataFolder + "\\" + obj_folow.username + ".csv"; string CSV_Header = "Username,FollowerName,Followed/Requested"; string CSV_Content = obj_folow.username.Replace(",", "") + "," + FollowerName.Replace(",", "") + "," + Result; GlobusFileHelper.ExportDataCSVFile(CSV_Header, CSV_Content, FollowIDFilePath); } catch { }; if (minDelayFollowerPoster != 0) { mindelay = minDelayFollowerPoster; } if (maxDelayFollowerPoster != 0) { maxdelay = maxDelayFollowerPoster; } Random FolloweRandom = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); // delay = FolloweRandom.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); if (!followingList.Contains(obj_folow.username)) { followingList.Add(obj_folow.username); GlobusFileHelper.AppendStringToTextfileNewLine("Followed: " + FollowerName + " By: " + obj_folow.username + ":" + obj_folow.password, GlobusFileHelper.FollowIDFilePath); } List<string> StrListReadData = new List<string>(); try { try { StreamReader strReader = new StreamReader(ClGlobul.FollowerListUploadedPath); string text = ""; while ((text = strReader.ReadLine()) != null) { //string strUserListFromFilePath = strReader.ReadToEnd(); StrListReadData.Add(text); } strReader.Close(); if (StrListReadData.Contains(FollowerName)) { try { StrListReadData.Remove(FollowerName); } catch { }; } } catch { }; try { StreamWriter strWriter = new StreamWriter(ClGlobul.FollowerListUploadedPath); strWriter.Write(""); if (StrListReadData.Count() > 0) { foreach (string itemStr in StrListReadData) { try { strWriter.WriteLine(itemStr); } catch { }; } } strWriter.Close(); } catch { }; } catch { }; // AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + FollowerName + " Removed From TextFile - " + ClGlobul.FollowerListUploadedPath + " ]"); } else if (Result == "private") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Followed: " + FollowerName + " is a private user and can not be followed. ]"); GlobusFileHelper.AppendStringToTextfileNewLine(obj_folow.username + ":" + obj_folow.password, GlobusFileHelper.FollowedOptionNotAvailableFilePath); if (minDelayFollowerPoster != 0) { mindelay = minDelayFollowerPoster; } if (maxDelayFollowerPoster != 0) { maxdelay = maxDelayFollowerPoster; } Random FolloweRandom = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); // delay = FolloweRandom.Next(mindelay, maxdelay); Thread.Sleep(delay * 1000); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); } else if (Result == "requested") { CountOfFollowersInForeach++; DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User,DateTime, FollowerName,Status) values('" + "FollowModule" + "','" + obj_folow.username + "','" + DateTime.Now + "','" + FollowerName + "','" + Result + "')", "tbl_AccountReport"); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ By " + obj_folow.username + " Request has been sent to . " + FollowerName + "Count" + CountOfFollowersInForeach + " ]"); objaddlableRequestedDelegate(); GlobusFileHelper.AppendStringToTextfileNewLine(obj_folow.username + ":" + obj_folow.password + ":" + " Requested", GlobusFileHelper.hasBeenRequestedFilePath); try { string path_AppDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Gram Dominator"; path_AppDataFolder = path_AppDataFolder + "\\FollwedList"; if (!File.Exists(path_AppDataFolder)) { Directory.CreateDirectory(path_AppDataFolder); } string FollowIDFilePath = path_AppDataFolder + "\\" + obj_folow.username + ".csv"; string CSV_Header = "Username,FollowerName,Followed/Requested"; string CSV_Content = obj_folow.username.Replace(",", "") + "," + FollowerName.Replace(",", "") + "," + Result; GlobusFileHelper.ExportDataCSVFile(CSV_Header, CSV_Content, FollowIDFilePath); if (minDelayFollowerPoster != 0) { mindelay = minDelayFollowerPoster; } if (maxDelayFollowerPoster != 0) { maxdelay = maxDelayFollowerPoster; } Random FolloweRandom = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = FolloweRandom.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } catch { }; List<string> StrListReadData = new List<string>(); try { try { StreamReader strReader = new StreamReader(ClGlobul.FollowerListUploadedPath); string text = ""; while ((text = strReader.ReadLine()) != null) { //string strUserListFromFilePath = strReader.ReadToEnd(); StrListReadData.Add(text); } strReader.Close(); if (StrListReadData.Contains(FollowerName)) { try { StrListReadData.Remove(FollowerName); } catch { }; } } catch { }; try { StreamWriter strWriter = new StreamWriter(ClGlobul.FollowerListUploadedPath); strWriter.Write(""); if (StrListReadData.Count() > 0) { foreach (string itemStr in StrListReadData) { try { strWriter.WriteLine(itemStr); } catch { }; } } strWriter.Close(); } catch { }; } catch { }; //AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + FollowerName + " Removed From TextFile - " + ClGlobul.FollowerListUploadedPath + " ]"); } else if (Result == "Already Followed") { ClGlobul.TotalNoOfFollow++; GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Account:" + obj_folow.username + ClGlobul.TotalNoOfFollow + " Already Followed " + FollowerName + " ]"); if (!AlreadyFollowedlist.Contains(obj_folow.username)) { AlreadyFollowedlist.Add(obj_folow.username); GlobusFileHelper.AppendStringToTextfileNewLine("Already Followed: " + FollowerName + " By: " + obj_folow.username + ":" + obj_folow.password, GlobusFileHelper.AllReadyFollowedIdFilePath); } if (minDelayFollowerPoster != 0) { mindelay = minDelayFollowerPoster; } if (maxDelayFollowerPoster != 0) { maxdelay = maxDelayFollowerPoster; } Random FolloweRandom = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = FolloweRandom.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); List<string> StrListReadData = new List<string>(); try { try { StreamReader strReader = new StreamReader(ClGlobul.FollowerListUploadedPath); string text = ""; while ((text = strReader.ReadLine()) != null) { //string strUserListFromFilePath = strReader.ReadToEnd(); StrListReadData.Add(text); } strReader.Close(); if (StrListReadData.Contains(FollowerName)) { try { StrListReadData.Remove(FollowerName); } catch { }; } } catch { }; try { StreamWriter strWriter = new StreamWriter(ClGlobul.FollowerListUploadedPath); strWriter.Write(""); if (StrListReadData.Count() > 0) { foreach (string itemStr in StrListReadData) { try { strWriter.WriteLine(itemStr); } catch { }; } } strWriter.Close(); } catch { }; } catch { }; // AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + FollowerName + " Removed From TextFile - " + ClGlobul.FollowerListUploadedPath + " ]"); } else if (Result == "Follow option is not available In page...!!") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Follow option is not available In page...!!" + obj_folow.username + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(obj_folow.username + ":" + obj_folow.password, GlobusFileHelper.FollowedOptionNotAvailableFilePath); } else if(Result == "Instagram API does not respond") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Instagram API does not respond to follow...!!" + FollowerName + " ]"); } else if (Result == "User is Private") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ User is Private " + FollowerName + " ]"); } else { if (Result == "Verify Your Account") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + obj_folow.username + " Verify Your Account " + FollowerName + " ]"); } else { // GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + obj_folow.username + " Already Followed " + FollowerName + " ]"); if (!NotFollowedlist.Contains(obj_folow.username)) { NotFollowedlist.Add(obj_folow.username); GlobusFileHelper.AppendStringToTextfileNewLine(obj_folow.username + ":" + obj_folow.password, GlobusFileHelper.UnFollowIdFilePath); } } } } catch (Exception ex) { } } } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Please upload Following ID's ]"); } } catch (Exception ex) { } finally { ClGlobul.FolloConpletedList.Add(obj_folow.username + ":" + obj_folow.password); ClGlobul.TotalNoOfIdsForFollow--; counter_follow--; if (counter_follow == 0) { GlobusLogHelper.log.Info("-----------------------------------------------------------------------------------------------"); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Complete PROCESS COMPLETED ]"); GlobusLogHelper.log.Info("-----------------------------------------------------------------------------------------------"); } GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED By : ==> ]" + obj_folow.username); try { string UserName = obj_folow.username.ToString(); var DicValue = ClGlobul.ThreadList.Single(s => s.Key.Contains(UserName)); Thread value = DicValue.Value; if (value.IsAlive || value.IsBackground) { value = null; } } catch (Exception ex) { } } }
private void StartActionFollowerModule(ref InstagramUser fbUser) { try { if (onlyLike == true) { Start_LikeFollowerpicture(ref fbUser); } if (onlyComment == true) { Start_onlycommentonfollowerphoto(ref fbUser); } if (likeandcomment == true) { Start_LikeAndComment(ref fbUser); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
private void StartActionFollowerModule(ref InstagramUser fbUser) { try { lstThreadsFollow_like.Add(Thread.CurrentThread); lstThreadsFollow_like.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { if (isStopFollowerwithlikePoster == true) { like_follow(ref fbUser); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
public string UsingUserName_liking(ref InstagramUser obj_liking, string PhotoId) { try { lstThreadsUsingUsername.Add(Thread.CurrentThread); lstThreadsUsingUsername.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } GlobusHttpHelper obj = obj_liking.globusHttpHelper; string Photolink = string.Empty; string FollowedPageSource = string.Empty; string res_secondURL = obj.getHtmlfromUrl(new Uri("https://www.instagram.com"), ""); string get_photoId = obj.getHtmlfromUrl(new Uri("https://www.instagram.com/p/" + PhotoId),""); string photo_ID = Utils.getBetween(get_photoId, "content=\"instagram://media?id=", " />").Replace("\"",""); if (photo_ID.Contains("https://www.instagram.com/p/")) { photo_ID = PhotoId.Replace(IGGlobals.Instance.IGhomeurl, string.Empty); } if (!photo_ID.Contains("https://www.instagram.com/p/")) { Photolink = "https://www.instagram.com/web/likes/" + photo_ID + "/like/ ".Replace(IGGlobals.Instance.IGhomeurl, ""); } else { Photolink = photo_ID; } string url = "https://www.instagram.com/p/" + PhotoId; string Check_like = obj.getHtmlfromUrl(new Uri(url), ""); string token = Utils.getBetween(Check_like, "csrf_token\":\"", "\"}"); // string Data = Utils.getBetween(Check_like, "class=\"list-inline pull-left\">", "</ul>"); if (Check_like.Contains("viewer_has_liked\":false")) { string PageContent = string.Empty; if (string.IsNullOrEmpty(obj_liking.proxyport)) { obj_liking.proxyport = "80"; } try { if (ClGlobul.checkHashTagLiker == true) { PageContent = obj_liking.globusHttpHelper.getHtmlfromUrl(new Uri(Photolink), ""); } else { PageContent = obj_liking.globusHttpHelper.PostData_LoginThroughInstagram(new Uri(Photolink), "", "https://www.instagram.com/", token); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } if (string.IsNullOrEmpty(PageContent)) { if (ClGlobul.checkHashTagLiker == true) { PageContent = obj_liking.globusHttpHelper.getHtmlfromUrl(new Uri(Photolink)); } else { PageContent = obj_liking.globusHttpHelper.getHtmlfromUrlProxy(new Uri(Photolink), "", 80, "", ""); } } if (PageContent.Contains("Instagram API does not respond")) { FollowedPageSource = "Instagram API does not respond"; } if (PageContent.Contains("{\"status\":\"ok\"}")) { FollowedPageSource = "LIKED"; // DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User, Photo_Id,Status) values('" + "UsingUser" + "','" + obj_liking.username + "','" + PhotoId + "','" + "LIKED" + "')", "tbl_AccountReport"); try { if (ClGlobul.checkHashTagLiker == true) { try { DataBaseHandler.InsertQuery("insert into liker_hash_tag (account_holder, photo_id, like_date, like_status) values ('" + obj_liking.username + "','" + PhotoId + "','" + Convert.ToString(DateTime.Now) + "','" + FollowedPageSource + "')", "liker_hash_tag"); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } } else if (Check_like.Contains("viewer_has_liked\":true")) { FollowedPageSource = "Already LIKED"; } return FollowedPageSource; }
public void like_follow(ref InstagramUser Gram_follow_like) { try { lstThreadsFollow_like.Add(Thread.CurrentThread); lstThreadsFollow_like.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { if (string.IsNullOrEmpty(UserName_path_followWithLike)) { } try { string Photo_Idd = string.Empty; string Username = string.Empty; foreach (string Photo_Id in ClGlobul.lstphotoId_Followwithlike) { if (Photo_Id.Contains("https://www.instagram.com/p/")) { Photo_Idd = Photo_Id.Replace("https://www.instagram.com/p/", "").Replace("/", ""); } else { Photo_Idd = Photo_Id; } string URL = "https://www.instagram.com/p/" + Photo_Idd; string URL_Responce = Gram_follow_like.globusHttpHelper.getHtmlfromUrl(new Uri(URL)); if (URL_Responce.Contains("followed_by_viewer\":false")) { Username = Utils.getBetween(URL_Responce, "owner\":{\"username\":\"", "\""); string Result = Follow(Username, ref Gram_follow_like); if (Result == "Followed") { GlobusLogHelper.log.Info(Gram_follow_like.username + "==> Successfully Follow ==> " + Username); DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User,DateTime ,FollowerName,Status) values('" + "FollowLike" + "','" + Gram_follow_like.username + "','" + DateTime.Now + "','" + Username + "','" + Result + "')", "tbl_AccountReport"); DataBaseHandler.InsertQuery("insert into FollowInfo(AccountHolder,FollowingUser,FollowTime ,FollowStatus) values('" + Gram_follow_like.username + "','" + Username + "','" + DateTime.Now + "','" + Result + "')", "FollowInfo"); objaddlbeunfollowSuccessDelegate(); } } else { if (URL_Responce.Contains("followed_by_viewer\":true")) { Username = Utils.getBetween(URL_Responce, "owner\":{\"username\":\"", "\""); GlobusLogHelper.log.Info(" Already Follow--" + Username + "-- By ==> " + Gram_follow_like.username); } } if (URL_Responce.Contains("viewer_has_liked\":false")) { string Status = photolike(Photo_Id, ref Gram_follow_like); if (Status == "LIKED") { GlobusLogHelper.log.Info(Gram_follow_like.username + "==> LIKED PHOTO ==> " + Photo_Id); DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User,DateTime ,Photo_Id,Status) values('" + "FollowLike" + "','" + Gram_follow_like.username + "','" + DateTime.Now + "','" + Photo_Id + "','" + Status + "')", "tbl_AccountReport"); objaddlablePhotoLikeSucessDelegate(); } } else { if (URL_Responce.Contains("viewer_has_liked\":true")) { GlobusLogHelper.log.Info(" Already Like--" + Photo_Id + "-- By ==> " + Gram_follow_like.username); } } if (minDelayFollowerwithlikePoster != 0) { mindelay = minDelayFollowerwithlikePoster; } if (maxDelayFollowerwithlikePoster != 0) { maxdelay = maxDelayFollowerwithlikePoster; } Random FolloweRandom = new Random(); int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay = FolloweRandom.Next(mindelay, maxdelay); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } } catch (Exception ex) { } } catch (Exception ex) { } finally { GlobusLogHelper.log.Info("=================================="); GlobusLogHelper.log.Info("---- Proccess Completed ----"); GlobusLogHelper.log.Info("=================================="); } }
public string Comment(string commentId, string CommentMsg, ref InstagramUser User_comment) { //abc: try { lstThreadsUsingUsername.Add(Thread.CurrentThread); lstThreadsUsingUsername.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } string FollowedPageSource = string.Empty; try { string res_secondURL = User_comment.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com"), ""); string CommentIdlink = string.Empty; string commentIdLoggedInLink = string.Empty; if (commentId.Contains(IGGlobals.Instance.IGhomeurl)) { commentId = commentId.Replace(IGGlobals.Instance.IGhomeurl, string.Empty); } if (!commentId.Contains("https://www.instagram.com/p/")) { try { CommentIdlink = "https://www.instagram.com/p/" + commentId + "/"; commentIdLoggedInLink = "https://www.instagram.com/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 = IGGlobals.Instance.IGStagram_api + commentId; string resp_photourl = User_comment.globusHttpHelper.getHtmlfromUrl(new Uri(CommentIdlink), ""); string Cooment_ID = Utils.getBetween(resp_photourl, "content=\"instagram://media?id=", " />").Replace("\"", ""); string postdata_url = "https://www.instagram.com/web/comments/" + Cooment_ID + "/add/"; string poatdata = "comment_text=" + CommentMsg; string token = Utils.getBetween(resp_photourl, "csrf_token\":\"", "\""); try { FollowedPageSource = User_comment.globusHttpHelper.postFormDatainta(new Uri(postdata_url), poatdata, "https://www.instagram.com/", token); } catch (Exception ex) { } if (FollowedPageSource.Contains("status\":\"ok\"") || FollowedPageSource.Contains("created_time")) { try { FollowedPageSource = "Success"; } catch (Exception ex) { return ex.Message; }; } else { if (FollowedPageSource.Contains("Instagram API does not respond")) { FollowedPageSource = "Instagram API does not respond"; } 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 try { if (ClGlobul.checkHashTagComment == true) { try { DataBaseHandler.InsertQuery("insert into comment_hash_tag (account_holder, photo_id, comment_date, comment_status) values ('" + User_comment.username + "','" + commentId + "','" + Convert.ToString(DateTime.Now) + "','" + FollowedPageSource + "')", "comment_hash_tag"); } catch (Exception ex) { } } } catch { } } catch { FollowedPageSource = string.Empty; } return FollowedPageSource; }
public void Start_Comment(ref InstagramUser IGcomment) { try { lstThreadsCommentPoster.Add(Thread.CurrentThread); lstThreadsCommentPoster.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { bool ProcessStartORnot = false; GlobusHttpHelper obj = IGcomment.globusHttpHelper; // string res_secondURL = obj.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGTestURL), ""); string res_secondURL = obj.getHtmlfromUrl(new Uri("https://www.instagram.com"), ""); int parsedValue; if (!string.IsNullOrEmpty(CommentPhoto_ID) && !string.IsNullOrEmpty(message_comment)) { string s = CommentPhoto_ID; string k = message_comment; ClGlobul.CommentIdsForMSG.Clear(); ClGlobul.commentMsgList.Clear(); if (s.Contains(',')) { string[] Data = s.Split(','); foreach (var item in Data) { ClGlobul.CommentIdsForMSG.Add(item); } } else { ClGlobul.CommentIdsForMSG.Add(CommentPhoto_ID); } if(k.Contains(",")) { string[] data1 = Regex.Split(k,","); foreach(string item in data1) { ClGlobul.commentMsgList.Add(item); } } else { ClGlobul.commentMsgList.Add(message_comment); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } if (string.IsNullOrEmpty(message_comment_path)) { if (!string.IsNullOrEmpty(message_comment))//txtsingalmsg { // ClGlobul.commentMsgList.Clear(); if (Nothread_comment != 0) { //if (MessageBox.Show("Do you really want to Start Without Thread", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes) //txtsingalmsg //{ // ProcessStartORnot = true; // ClGlobul.NoOfcommentThread = 1; // try // { // string AllMessege = txtsingalmsg.Text.Trim(); // string[] ListMessages = Regex.Split(AllMessege, ","); // foreach (string str in ListMessages) // { // ClGlobul.commentMsgList.Add(str); // } // } // catch { }; //} //else //{ //} } else { try { ClGlobul.NoOfcommentThread = Nothread_comment; try { string AllMessege = message_comment; string[] ListMessages = Regex.Split(AllMessege, ","); foreach (string str in ListMessages) { ClGlobul.commentMsgList.Add(str); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Please upload Comments. ]"); } } if (status == "Success") { foreach (var CommentIdsForMSG_item in ClGlobul.CommentIdsForMSG) { getComment(CommentIdsForMSG_item, ref IGcomment); } } else { if(status == "Failed") { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Login Fail. ]" + IGcomment.username); } } }