public void BoardMethod(string BoardName, string BoardUrl, ref PinInterestUser objPinInUser) { try { try { lstThreadsBoards.Add(Thread.CurrentThread); lstThreadsBoards.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; lock (this) { string BoardId = string.Empty; AddNewPinManager objaddnewPin = new AddNewPinManager(); RePinManager objRepin = new RePinManager(); try { boardinput.Add(Thread.CurrentThread); boardinput.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; if (string.IsNullOrEmpty(BoardName)) { try { List<string> baordnames = GetAllBoardNames_new(ref objPinInUser); BoardName = baordnames[RandomNumberGenerator.GenerateRandom(0, baordnames.Count - 1)]; BoardId = objaddnewPin.GetBoardId(BoardName, ref objPinInUser); } catch (Exception ex) { }; } else { //testing GlobusHttpHelper objHttp = new GlobusHttpHelper(); try { BoardId = objaddnewPin.GetBoardId_Board(BoardName, ref objPinInUser); } catch (Exception ex) { } } if (string.IsNullOrEmpty(BoardId)) { BoardId = objaddnewPin.GetBoardId(BoardName, ref objPinInUser); } int counter = 0; int RepinCounter = 0; if (!BoardId.Contains("failure")) { if (!string.IsNullOrEmpty(BoardId)) { if (PDGlobals.ValidateNumber(BoardId)) { GlobusLogHelper.log.Info(" => [ Adding Pins From Board :" + BoardUrl + " ]"); clsSettingDB db = new clsSettingDB(); List<string> lstPins = new List<string>(); lstPins = GetBoardPinsNew(BoardId, BoardUrl, 10, ref objPinInUser); lstPins.Distinct(); List<string> lstOfRepin = new List<string>(); lstOfRepin.AddRange(lstPins); string[] lstPinNo = null; lstPinNo = lstPins.ToArray(); //getting lstPins length int lenOFlstPins = lstOfRepin.Count; foreach (string Pins in lstPinNo) { if (MaxRePinCount > RepinCounter) { string Message = string.Empty; if (ClGlobul.lstBoardRepinMessage.Count > 0) { if (counter < ClGlobul.lstBoardRepinMessage.Count) { Message = ClGlobul.lstBoardRepinMessage[counter]; } else { counter = 0; Message = ClGlobul.lstBoardRepinMessage[counter]; } } bool IsReppined = false; if (!Pins.Contains("n")) { try { int index = lstOfRepin.Where(x => x == Pins).Select(x => lstOfRepin.IndexOf(x)).Single<int>(); string NoOfPages = Convert.ToString(index / lenOFlstPins); IsReppined = objRepin.RepinwithMessage(Pins, Message, BoardId, NoOfPages, ref objPinInUser); } catch { } if (IsReppined) { //GlobusLogHelper.log.Info("[ => [ Repin Id : " + Pins + " ]"); #region AccountReport string module = "Boards"; string status = "Repined"; Qm.insertAccRePort(objPinInUser.Username, module, "https://www.pinterest.com/pin/" + Pins, BoardName, "", "", "", "", status, "", "", DateTime.Now); objBoardDelegate(); #endregion GlobusLogHelper.log.Info(" => [ Repin Pin : " + Pins + " to Account : " + objPinInUser.Username + " In " + BoardName + " ]"); try { string CSV_Header = "Date" + "," + "UserName" + "," + "Message" + "," + "Pin" + "Board Id"; string CSV_Data = System.DateTime.Now.ToString() + "," + objPinInUser.Username + "," + Message + "," + "https://www.pinterest.com/pin/" + Pins + "," + BoardId; PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, Boardpath + "\\Board.csv"); RepinCounter++; } catch (Exception ex) { } //kept here int delay = RandomNumberGenerator.GenerateRandom(minDelayBoards, maxDelayBoards); GlobusLogHelper.log.Info(" => [ Delay for " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } else { } counter++; } } else { GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinInUser.Username + " In " + BoardName + "]"); GlobusLogHelper.log.Info("-----------------------------------------------------------------------------"); break; } } } } } else { GlobusLogHelper.log.Info(" => [ You already have a board with that name. " + objPinInUser.Username + " ]"); } } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
public string Getscreen_Name(ref PinInterestUser objPinUser) { string FindScreenName = string.Empty; try { string ScreenName1 = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"), "", "", ""); string ScreenName = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com/settings/"), "", "", ""); int StartIndex = ScreenName.IndexOf("username\":"); int EndIndex = ScreenName.IndexOf(",");//username": "******", "email_commen //FindScreenName = ScreenName.Substring(StartIndex, EndIndex).Replace(":", string.Empty).Replace("email_commen", string.Empty).Replace("\"", "").Replace("username", string.Empty).Replace(",", string.Empty).Replace("email_com", string.Empty).Replace(" ", "@").Trim(); FindScreenName = Utils.Utils.getBetween(ScreenName,"username\":\"","\","); string[] arr = System.Text.RegularExpressions.Regex.Split(FindScreenName, "@"); if (arr.Count() == 3) { FindScreenName = arr[1]; } else { FindScreenName = arr[0]; } return FindScreenName; } catch(Exception ex) { GlobusLogHelper.log.Error("Error :" + ex.StackTrace); } return FindScreenName; }
public string GetFollowercount(string screen_Name, ref PinInterestUser objPinUser) { string followers = string.Empty; try { string pagesource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://pinterest.com/" + screen_Name), "", "", ""); int Startindex = pagesource.IndexOf("pinterestapp:followers"); //string _sorce = pagesource.Substring(Startindex).Replace("pinterestapp:followers", ""); string _sorce = Utils.Utils.getBetween(pagesource, "follower_count\":", ",\""); int Endindex = _sorce.IndexOf(","); //_sorce = _sorce.Substring(0, Endindex).Replace("\"", "").Replace(":", "").Replace("FollowingLinks\">\n<", string.Empty).Trim(); followers = _sorce; return followers; } catch(Exception ex) { GlobusLogHelper.log.Error("Error :" + ex.StackTrace); } return followers; }
public bool LoginPinterestAccount(ref PinInterestUser objPinUser) { StartAgain: lock (this) { string Name = string.Empty; try { string PinPage = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com/")); string _MainSourcePage = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com/resource/NoopResource/get/?source_url=%2Flogin%2F%3Fnext%3Dhttps%253A%252F%252Fwww.pinterest.com%252F%26prev%3Dhttps%253A%252F%252Fwww.pinterest.com%252F&data=%7B%22options%22%3A%7B%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3EHomePage()%3EUnauthHomePage(signup_email%3Dnull%2C+tab%3Dfollowing%2C+cmp%3Dnull%2C+resource%3DInspiredWallResource())&_=1424169081757")); ///Get App Version if (_MainSourcePage.Contains("app_version")) { try { string[] ArrAppVersion = System.Text.RegularExpressions.Regex.Split(_MainSourcePage, "app_version"); if (ArrAppVersion.Count() > 0) { string DataString = ArrAppVersion[ArrAppVersion.Count() - 1]; int startindex = DataString.IndexOf("\""); string start = DataString.Substring(startindex).Replace("\": \"", "").Replace("}", string.Empty).Replace("\"", string.Empty); int endindex = start.IndexOf(","); App_version = start.Substring(0, endindex); if (!string.IsNullOrEmpty(App_version)) { objPinUser.App_version = App_version; } } } catch { }; } else { } string referer = "https://www.pinterest.com/"; string PostData1 = "source_url=%2Flogin%2F%3Fnext%3Dhttps%253A%252F%252Fwww.pinterest.com%252F%26prev%3Dhttps%253A%252F%252Fwww.pinterest.com%252F&data=%7B%22options%22%3A%7B%22username_or_email%22%3A%22" + Uri.EscapeDataString(objPinUser.Username) + "%22%2C%22password%22%3A%22" + Uri.EscapeDataString(objPinUser.Password) + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3ELoginPage()%3ELogin()%3EButton(text%3DLog+In%2C+size%3Dlarge%2C+class_name%3Dprimary%2C+type%3Dsubmit)"; string login = string.Empty; try { login = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri("https://www.pinterest.com/resource/UserSessionResource/create/"), PostData1, referer); } catch (Exception ex) { } string AfterLoginPageSource = string.Empty; try { AfterLoginPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); } catch (Exception ex) { GlobusLogHelper.log.Info(" => [ Trying login again. ]"); Thread.Sleep(2 * 1000); goto StartAgain; } if (AfterLoginPageSource.Contains("Logout") || AfterLoginPageSource.Contains("pinHolder") || AfterLoginPageSource.Contains("header1\": \"What are you interested in?") || AfterLoginPageSource.Contains("\"error\": null") || login.Contains("\"error\": null")) { //GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Successfully Login for " + Username + " ]"); this.LoggedIn = true; return true; } else { GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]"); this.LoggedIn = false; return false; } } catch (Exception ex) { GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]"); this.LoggedIn = false; return false; } } }
public List<string> GetAllBoardNames_new1(string screenName,ref PinInterestUser objPinUser) { BaseLib.GlobusRegex rgx = new GlobusRegex(); Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper(); List<string> lstBoardIdNew = new List<string>(); //GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Getting All Board Names ]"); string UserUrl = "http://pinterest.com/" + screenName; string BoardPage = httpHelper.getHtmlfromUrl(new Uri(UserUrl), "", "", ""); string[] data = Regex.Split(BoardPage, "is_collaborative"); foreach (var itemdata in data) { try { string boardUrl = getBetween(itemdata, ", \"url\":", ",").Replace("\"", "").Trim(); if (!lstBoardUrls.Contains(boardUrl) && !string.IsNullOrEmpty(boardUrl)) { lstBoardUrls.Add(boardUrl); } if (itemdata.Contains("board_id")) { string boardId = getBetween(itemdata, "board_id\":", ",").Replace("\"", "").Trim(); if (!lstBoardIdNew.Contains(boardId)) { lstBoardIdNew.Add(boardId); } objPinUser.lstBoardId = lstBoardIdNew; } } catch (Exception ex) { GlobusLogHelper.log.Error("Error :" + ex.StackTrace); } } string[] Items = Regex.Split(BoardPage, "item"); int counter = 0; foreach (string item in Items) { try { if (item.Contains("id=\\\"Board") && item.Contains("boardLinkWrapper")) { //if (counter == 1) { string[] Data = System.Text.RegularExpressions.Regex.Split(item, "boardLinkWrapper"); foreach (string Dataitem in Data) { if (Dataitem.Contains("boardName")) { string BoardUrl = string.Empty; int startIndex = Dataitem.IndexOf("title"); int LastPoint = Dataitem.IndexOf("<h2"); //string Board = Dataitem.Substring(startIndex, LastPoint).Replace("\\n", string.Empty).Replace("\"", "").Replace("<div class=\\b", string.Empty).Replace(" ", string.Empty).Replace("\"title\"", "").Replace("</div", ""); string Board = Utils.Utils.getBetween(Dataitem, "<h2 class=\\\"title\\\">", "</h2>"); //BoardUrl = rgx.StripTagsRegex(Board); //try //{ // Board = getBetween(BoardUrl, ">>", "<"); // //modified done // if (Board == "") // { // Board = getBetween(BoardUrl, "title=", ">").Replace("\\", "").Trim(); // } //} //catch(Exception ex) //{ }; if (!BoardNames.Contains(Board)) { BoardNames.Add(Board); //DropDowenBox.Items.Add(Board); } } } } counter++; } } catch (Exception ex) { GlobusLogHelper.log.Error("Error :" + ex.StackTrace); } } return BoardNames; }
public string FollowPeople_New(ref PinInterestUser objPinUser, string Username, string KeywordUser) { try { string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); if (Checking.Contains("profileName")) { } else { ObjAccountManager.LoginPinterestAccount(ref objPinUser); } string redirectDomain = GlobusHttpHelper.valueURl.Split('.')[0]; string newHomePageUrl = redirectDomain + "." + "pinterest.com"; string UserUrl = redirectDomain + ".pinterest.com/resource/UserFollowResource/create/"; string Refrer = "http://www.pinterest.com/" + Username.Replace(" ", ""); //Refrer = "http://www.pinterest.com/"; // string Refrer = Username.Replace(" ", ""); string UserPage = objPinUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri(Refrer), "", "", 80, "", "", ""); if (string.IsNullOrEmpty(UserPage)) { //User Does not exist } string userid = string.Empty;//GetUserID(UserPage); try { int startindex = UserPage.IndexOf("\"user_id\":"); string start = UserPage.Substring(startindex).Replace("\"user_id\":", ""); int endindex = start.IndexOf(","); string end = start.Substring(0, endindex); userid = end.Replace("\"", "").Replace("}}", string.Empty).Trim(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } string checkalreadyFollowed = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com/" + Username.Replace(" ", "") + "/")); if (checkalreadyFollowed.Contains("buttonText\">Unfollow")) { return "Unfollow"; } Thread.Sleep(10 * 1000); string PostData = "source_url=%2F" + Username.Replace(" ", "") + "%2F&data=%7B%22options%22%3A%7B%22user_id%22%3A%22" + userid + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3EUserProfilePage(resource%3DUserResource(username%3D" + Username.Replace(" ", "") + "%2C+invite_code%3Dnull))%3EUserProfileHeader(resource%3DUserResource(username%3D" + Username.Replace(" ", "") + "%2C+invite_code%3Dnull))%3EUserFollowButton(followed%3Dfalse%2C+is_me%3Dfalse%2C+unfollow_text%3DUnfollow%2C+memo%3D%5Bobject+Object%5D%2C+follow_ga_category%3Duser_follow%2C+unfollow_ga_category%3Duser_unfollow%2C+disabled%3Dfalse%2C+color%3Dprimary%2C+text%3DFollow%2C+user_id%3D" + userid + "%2C+follow_text%3DFollow%2C+follow_class%3Dprimary)"; try { string FollowPageSource = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri(UserUrl), PostData, newHomePageUrl); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } string AfterFollowPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com/" + Username.Replace(" ", "") + "/")); if (!string.IsNullOrEmpty(AfterFollowPageSource) && AfterFollowPageSource.Contains("buttonText\">Unfollow")) { #region AccountReport string module = "FollowByKeyword"; string status = "Followed"; QM.insertAccRePort(objPinUser.Username, module, "", "", Username, "", KeywordUser, "", status, "", "", DateTime.Now); objFollowByKeywordDelegate(); #endregion return "Followed"; } else { return "NotFollowed"; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); return "NotFollowed"; } return null; }
public void StartActionMultithreadInvite(ref PinInterestUser objPinUser) { try { try { lstThreadsInvite.Add(Thread.CurrentThread); lstThreadsInvite.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; foreach (var item_lstEmailInvites in ClGlobul.lstEmailInvites) { try { Invite(item_lstEmailInvites, ref objPinUser); GlobusFileHelper.AppendStringToTextfileNewLine(item_lstEmailInvites, PDGlobals.InviteSentPath); Thread.Sleep(1000); } catch (Exception ex) { GlobusLogHelper.log.Info(" => [ Invite Failed For This Email " + item_lstEmailInvites + " ]"); } int DelayTime = RandomNumberGenerator.GenerateRandom(minDelayInvite, maxDelayInvite); GlobusLogHelper.log.Info(" => [ Delay For " + DelayTime + " Seconds ]"); Thread.Sleep(DelayTime); } } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
public string CreateBoard_new(string BoardName, string Category, ref PinInterestUser objPinUser) { try { string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com/settings/")); string ScreenName = objPinUser.ScreenName; //ObjAccountManager.Getscreen_NameRepin(ref objPinUser); if (Checking.Contains("profileName")) { } else { ObjAccountManager.LoginPinterestAccount(ref objPinUser); } string redirectDomain = GlobusHttpHelper.valueURl.Split('.')[0]; string newHomePageUrl = redirectDomain + "." + "pinterest.com"; if (!string.IsNullOrEmpty(Checking)) { ChilkatHttpHelpr objChilkatHttpHelpr = new ChilkatHttpHelpr(); //string newpostdata = "source_url=%2F" + ScreenName + "%2F&data=%7B%22options%22%3A%7B%22name%22%3A%22" + (BoardName.Replace(" ", "+")) + "%22%2C%22category%22%3A%22other%22%2C%22description%22%3A%22%22%2C%22privacy%22%3A%22public%22%2C%22layout%22%3A%22default%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3EUserProfilePage(resource%3DUserResource(username%3D" + ScreenName + "%2C+invite_code%3Dnull))%3EUserProfileContent(resource%3DUserResource(username%3D" + objPinUser.ScreenName + "%2C+invite_code%3Dnull))%3EUserBoards()%3EGrid(resource%3DProfileBoardsResource(username%3D" + ScreenName + "))%3EGridItems(resource%3DProfileBoardsResource(username%3D" + ScreenName + "))%3EBoardCreateRep(ga_category%3Dboard_create%2C+text%3DCreate+a+board%2C+submodule%3D%5Bobject+Object%5D)%23Modal(module%3DBoardCreate())"; string newpostdata = "source_url=%2F" + ScreenName + "%2F&data=%7B%22options%22%3A%7B%22name%22%3A%22" + (BoardName.Replace(" ", "+")) + "%22%2C%22category%22%3A%22other%22%2C%22description%22%3A%22%22%2C%22privacy%22%3A%22public%22%2C%22layout%22%3A%22default%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EUserProfilePage%3EUserProfileContent%3EUserBoards%3EGrid%3EGridItems%3EBoardCreateRep(ga_category%3Dboard_create%2C+text%3DCreate+a+board%2C+submodule%3D%5Bobject+Object%5D)%23App%3EModalManager%3EModal(showCloseModal%3Dtrue%2C+mouseDownInModal%3Dfalse)"; string PostUrlBoard = redirectDomain + ".pinterest.com/resource/BoardResource/create/"; try { CreatedBoardPageSource = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri(PostUrlBoard), newpostdata, newHomePageUrl); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } if (CreatedBoardPageSource.Contains("error\": null")) { if (newpostdata.Contains("You already have a board with that name.")) { GlobusLogHelper.log.Info(" => [ You already have a board with this name. " + BoardName + " For " + objPinUser.Username + " ]"); return null; } try { string ModuleName = "AddBoardName"; string Status = "Board_Created"; QueryManager qm = new QueryManager(); qm.insertAccRePort(objPinUser.Username, ModuleName, "", BoardName, "", "", "", "", Status, "", "", DateTime.Now); //qm.insertBoard_AddBoardName(objPinUser.Username, ModuleName, BoardName, Status); objDelegateAccountReport(); } catch (Exception ex) { GlobusLogHelper.log.Info(" => [ Board Created " + BoardName + " ]"); return null; } GlobusLogHelper.log.Info(" => [ Successfully Created Board " + BoardName + " For " + objPinUser.Username + " ]"); string BoardId = objAddNewPinManager.GetBoardId_Board(BoardName, ref objPinUser);//GetBoardId(BoardName, ref pinterestAccountManager); return BoardId; } else if (CreatedBoardPageSource.Contains("You have a board with this name.")) { GlobusLogHelper.log.Info(" => [ You already have a board with this name. " + BoardName + " For " + objPinUser.Username + " ]"); string BoardId = objAddNewPinManager.GetBoardId_Board(BoardName, ref objPinUser); return BoardId; } else { GlobusLogHelper.log.Info(" => [ Board Creation Process Failed " + BoardName + " ]"); return CreatedBoardPageSource; } } else { GlobusLogHelper.log.Info(" => [ Login Issue " + " For " + objPinUser.Username + " ]"); } } catch (Exception ex) { GlobusLogHelper.log.Info(" => [ Board Creation Process Failed " + BoardName + " ]"); return null; } return null; }
public void StartLikeMultiThreaded(object objparameters) { PinInterestUser objPinUser = new PinInterestUser(); try { if (!isStopLike) { try { lstThreadsLike.Add(Thread.CurrentThread); lstThreadsLike.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { Array paramsArray = new object[1]; paramsArray = (Array)objparameters; objPinUser = (PinInterestUser)paramsArray.GetValue(0); try { if (chkBox_Like_DivideData == true) { list_lstTargetLike_item = list_lstTargetLike[LstCounter_Like]; } else { list_lstTargetLike_item = ClGlobul.lstAddToBoardUserNames; } } catch { } #region Login if (!objPinUser.isloggedin) { GlobusLogHelper.log.Info(" => [ Logging With " + objPinUser.Username + " ]"); if (string.IsNullOrEmpty(objPinUser.ProxyPort)) { objPinUser.ProxyPort = "80"; } bool checkLogin = ObjAccountManager.LoginPinterestAccount1forlee(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName); //ObjAccountManager.LoginPinterestAccount1(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName); // accountManager.Login(); // if (!accountManager.LoggedIn) if (!checkLogin) { checkLogin = ObjAccountManager.LoginPinterestAccount1forlee(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName); if (!checkLogin) { GlobusLogHelper.log.Info(" => [ Not Logged In With " + objPinUser.Username + " ]"); return; } } string checklogin = httpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); //GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]"); //StartActionMultithreadLike(ref objPinUser, list_lstTargetLike_item); } if(objPinUser.isloggedin == true) { try { GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]"); StartActionMultithreadLike(ref objPinUser, list_lstTargetLike_item); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } #endregion } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } finally { try { if (countThreadControllerLike > Nothread_Like) { lock (LikeObjThread) { Monitor.Pulse(LikeObjThread); } Likedata_count--; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } countThreadControllerLike--; //GlobusLogHelper.log.Info(" => [ Liked Process Finished ]"); //GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED ]"); //GlobusLogHelper.log.Info("----------------------------------------------------------------------------"); } }
public void StartActionMultithreadAddPinWithNewBoard(ref PinInterestUser objPinUser12) { Pins obj = new Pins(); try { PinInterestUser objPinUser = (PinInterestUser)objPinUser12; try { lstThreadsAddPinWithNewBoard.Add(Thread.CurrentThread); lstThreadsAddPinWithNewBoard.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; //string strPin=string.Empty; //string[] arrPin = null; //foreach (string strPinList in ClGlobul.addNewPinWithBoard) //{ // strPin = strPinList.Replace("\0", "").Trim(); // arrPin = Regex.Split(strPin, ","); // if (arrPin.Count() != 4) // { // GlobusLogHelper.log.Info(" => [ Please upload correct file format ]"); // return; // } //} PinInterestUser objPinUseaddpin = objPinUser; UserPins = ClGlobul.lst_AddnewPinWithNewBoard.FindAll(P => P.Email == objPinUseaddpin.Username).ToList(); //GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total Pins Count is " + UserPins.Count + " ]"); if (UserPins.Count == 0) { UserPins = ClGlobul.lst_AddnewPinWithNewBoard; } foreach (Pins pin in UserPins) { if (pin.Niche == objPinUser12.Niches) { Thread thread = new Thread(() => ThreadRepinMethod(pin, objPinUser)); thread.Start(); Thread.Sleep(ThreadDelay * 1000); } } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
public void ThreadRepinMethod(Pins pin, PinInterestUser objPinUser) { try { try { lstThreadsAddPinWithNewBoard.Add(Thread.CurrentThread); lstThreadsAddPinWithNewBoard.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; Board = Regex.Split(pin.Board, ":")[0]; if (!string.IsNullOrEmpty(Board)) { //Board = pin.Board; BoardNumber = objAddNewPinManager.GetBoardId(Board, ref objPinUser); if (string.IsNullOrEmpty(BoardNumber)) { GlobusLogHelper.log.Info(" => [ " + Board + " Not Found. Creating Board ]"); BoardNumber = CreateBoard_new(Board, "Other", ref objPinUser); BoardNumber = objAddNewPinManager.GetBoardId(Board, ref objPinUser); } } else { if (objPinUser.Boards.Count <= 0) { objAddNewPinManager.GetBoards(ref objPinUser); } if (objPinUser.Boards.Count > 0) { Random Boardrnd = new Random(); int BoardNum = 0; try { BoardNum = Boardrnd.Next(0, objPinUser.Boards.Count - 1); BoardNumber = objPinUser.Boards[BoardNum]; } catch (Exception ex) { //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartNewPinCreationMultiThreaded() 1--> " + ex.Message, ApplicationData.ErrorLogFile); } } } ImageUrl = pin.ImageUrl; Desc = pin.Description; string Data = objAddNewPinManager.NewPin(BoardNumber, Desc, ImageUrl, ref objPinUser); if (Data.Equals("true")) { #region AccountReport string module = "AddPinWithNewBoard"; string status = "Added"; objqm.insertAccRePort(objPinUser.Username, module, "", Board, "", Desc, "", ImageUrl, status, "", "", DateTime.Now); objAddPinWithBoardDelegate(); #endregion //GlobusLogHelper.log.Info(" => [ Pin Added To " + Board + " From " + objPinUser.Username + " ]"); try { string CSV_Header = "Date" + "," + "UserName" + "," + "Board" + "," + "Description" + "," + "ImageUrl"; string CSV_Data = System.DateTime.Now.ToString() + "," + objPinUser.Username + "," + Board.Replace(",", " ").Replace("'", "") + "," + Desc.Replace(",", " ").Replace("'", "") + "," + ImageUrl.Replace(",", " ").Replace("'", ""); PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, Pinpath + "\\NewPin.csv"); } catch (Exception ex) { } } else { GlobusLogHelper.log.Info(" => [ Pin Not Added To " + Board + " From " + objPinUser.Username + " ]"); } } catch (Exception ex) { //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartNewPinCreationMultiThreaded() 2 --> " + ex.Message, ApplicationData.ErrorLogFile); } finally { try { if (countThreadControllerAddPinWithNewBoard > Nothread_AddPinWithNewBoard) { lock (AddPinWithNewBoardObjThread) { Monitor.Pulse(AddPinWithNewBoardObjThread); } AddPinWithNewBoarddata_count--; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } countThreadControllerAddPinWithNewBoard--; GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------"); } }
public void StartActionMultithreadCommentByKeyword(ref PinInterestUser objPinUser, List<string> UserCount_CommentByKeyword) { try { try { lstThreadsCommentByKeyword.Add(Thread.CurrentThread); lstThreadsCommentByKeyword.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; int counter = 0; string[] arrayItem = new string[100]; foreach (string newItem in UserCount_CommentByKeyword) { try { arrayItem = Regex.Split(newItem, "::"); if (arrayItem.Length == 3 && arrayItem[0] == objPinUser.Niches) { if (arrayItem.Length == 3) { string[] Keywordarrray = Regex.Split(arrayItem[1], ","); foreach (string KeywordsItem in Keywordarrray) { lock (this) { try { Keyword = KeywordsItem + "::" + arrayItem[2].ToString(); lstCommnet.Add(Keyword); List<string> LstPins = new List<string>(); LstPins = KeywordPins_New(KeywordsItem, MaxCommentByKeyword, ref objPinUser); //PinterestComments Comments = new PinterestComments(); keyword = Utils.Utils.getBetween(KeywordsItem, "", "::"); GlobusLogHelper.log.Info(" => [ Finding Pins On Keyword : " + KeywordsItem + " For " + objPinUser.Username + " ]"); GlobusLogHelper.log.Info(" => [ " + LstPins.Count + " Pins On Keyword :" + KeywordsItem + " For " + objPinUser.Username + " ]"); List<string> lstofPin = new List<string>(); lstofPin = LstPins.Distinct().ToList(); string[] lstCommnet_strlist = Regex.Split(newItem, "::");//lstCommnet.ToArray(); foreach (string pin in lstofPin) { try { clsSettingDB Db = new clsSettingDB(); string user = PinterestPins.getUserNameFromPinId(pin, ref objPinUser); if (counter >= MaxCommentByKeyword) { break; } else { #region Commented //comment = lstCommnet[RandomNumberGenerator.GenerateRandom(0, lstCommnet.Count)]; //if (comment.Contains("::")) //{ // comment = Regex.Split(comment, "::")[1]; //} //else if (comment.Contains(":")) //{ // if (comment.Contains("http:")) // { // comment = comment.Split(':')[comment.Split(':').Count() - 1]; // comment = "http:" + comment.Split(':')[comment.Split(':').Count() - 1]; // } // else // { // comment = comment.Split(':')[comment.Split(':').Count() - 1]; // } //} #endregion #region try { DataSet DS = QM.selectCommentedPinDetails(objPinUser.Username, pin); DataTable Dt = DS.Tables[0]; string dateTime = Dt.Rows[Dt.Rows.Count - 1].ItemArray[3].ToString(); DateTime previousDateTime = Convert.ToDateTime(dateTime); DateTime currentDate = DateTime.Today; TimeSpan dt_Difference = currentDate.Subtract(previousDateTime); double dt_Difference1 = dt_Difference.Days; if (dt_Difference1 < 30) { continue; } } catch (Exception Ex) { //CommentAddToLogger("Error ==> " + Ex.StackTrace); } #endregion Thread.Sleep(1 * 1000); bool IsCommented = objCommentManagers.Comment_new(ref objPinUser, pin, lstCommnet_strlist[2]); if (IsCommented) { #region AccountReport string module = "CommentByKeyword"; string status = "Commented"; Qm.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + pin, "", "", lstCommnet_strlist[2], KeywordsItem, "", status, "", "", DateTime.Now); objCommentByKeywordDelegate(); #endregion counter++; GlobusLogHelper.log.Info(" => [ Commneted on Pin : " + pin + " From " + objPinUser.Username + " ]"); clsSettingDB Databse = new clsSettingDB(); Databse.insertMessageDate(objPinUser.Username, user.Replace("/", ""), pin, KeywordsItem, comment); try { QueryManager.insertCommentedPinDetails(objPinUser.Username, pin, DateTime.Now.ToString()); } catch { }; try { string CSV_Header = "Date" + "," + "UserName" + "," + "Comment" + "," + "Keyword" + "," + "Niche" + "," + "PinUrl"; string CSV_Data = System.DateTime.Now.ToString() + "," + objPinUser.Username + "," + comment + "," + KeywordsItem + "," + objPinUser.Niches + "," + "https://www.pinterest.com/pin/" + pin; string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Comment"); PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\CommentBykeyword.csv"); } catch (Exception ex) { } } else { GlobusLogHelper.log.Info(" => [ Not Commneted on Pin : " + pin + " From " + objPinUser.Username + " ]"); } //if (rdbDivideGivenByUserCommentByKeyword == true) //{ // CountGivenByUserCommentByKeyword--; // if (CountGivenByUserCommentByKeyword < 0) // { // break; // } //} int delay = RandomNumberGenerator.GenerateRandom(minDelayCommentByKeyword, maxDelayCommentByKeyword); GlobusLogHelper.log.Info(" => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : 3.4" + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : 3.4" + ex.StackTrace); } } } } } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : 3.4" + ex.StackTrace); } #region Comment // } //string[] lstCommnet_strlist = lstCommnet.ToArray(); //if (objPinUser.Niches == arrayItem[0]) //{ // foreach (string FindKeyword in lstCommnet_strlist) // { // try // { // List<string> LstPins = KeywordPins_New(FindKeyword, MaxCommentByKeyword, ref objPinUser); // //PinterestComments Comments = new PinterestComments(); // keyword = Utils.Utils.getBetween(FindKeyword, "", "::"); // GlobusLogHelper.log.Info(" => [ Finding Pins On Keyword : " + FindKeyword + " For " + objPinUser.Username + " ]"); // GlobusLogHelper.log.Info(" => [ " + LstPins.Count + " Pins On Keyword :" + FindKeyword + " For " + objPinUser.Username + " ]"); // List<string> lstofPin = LstPins; // foreach (string pin in lstofPin) // { // clsSettingDB Db = new clsSettingDB(); // string user = PinterestPins.getUserNameFromPinId(pin, ref objPinUser); // if (counter >= MaxCommentByKeyword) // { // GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); // GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------"); // break; // } // else // { // comment = lstCommnet[RandomNumberGenerator.GenerateRandom(0, lstCommnet.Count)]; // if (comment.Contains("::")) // { // comment = Regex.Split(comment, "::")[1]; // } // else if (comment.Contains(":")) // { // if (comment.Contains("http:")) // { // comment = comment.Split(':')[comment.Split(':').Count() - 1]; // comment = "http:" + comment.Split(':')[comment.Split(':').Count() - 1]; // } // else // { // comment = comment.Split(':')[comment.Split(':').Count() - 1]; // } // } // #region // try // { // DataSet DS = QM.selectCommentedPinDetails(objPinUser.Username, pin); // DataTable Dt = DS.Tables[0]; // string dateTime = Dt.Rows[Dt.Rows.Count - 1].ItemArray[3].ToString(); // DateTime previousDateTime = Convert.ToDateTime(dateTime); // DateTime currentDate = DateTime.Today; // TimeSpan dt_Difference = currentDate.Subtract(previousDateTime); // double dt_Difference1 = dt_Difference.Days; // if (dt_Difference1 < 30) // { // continue; // } // } // catch (Exception Ex) // { // //CommentAddToLogger("Error ==> " + Ex.StackTrace); // } // #endregion // bool IsCommented = objCommentManagers.Comment_new(ref objPinUser, pin, comment); // if (IsCommented) // { // #region AccountReport // string module = "CommentByKeyword"; // string status = "Commented"; // Qm.insertAccRePort(objPinUser.Username, module, pin, "", "", comment, keyword, "", status, "", "", DateTime.Now); // objCommentByKeywordDelegate(); // #endregion // GlobusLogHelper.log.Info(" => [ Commneted on Pin : " + pin + " From " + objPinUser.Username + " ]"); // clsSettingDB Databse = new clsSettingDB(); // Databse.insertMessageDate(objPinUser.Username, user.Replace("/", ""), pin, keyword, comment); // try // { // QueryManager.insertCommentedPinDetails(objPinUser.Username, pin, DateTime.Now.ToString()); // } // catch { }; // counter++; // try // { // string CSV_Header = "Date" + "," + "UserName" + "," + "Comment" + "," + "Keyword" + "," + "Niche" + "," + "PinUrl"; // string CSV_Data = System.DateTime.Now.ToString() + "," + objPinUser.Username + "," + comment + "," + keyword + "," + objPinUser.Niches + "," + "https://www.pinterest.com/pin/" + pin; // string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Comment"); // PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\CommentBykeyword.csv"); // } // catch (Exception ex) // { // } // } // else // { // GlobusLogHelper.log.Info(" => [ Not Commneted on Pin : " + pin + " From " + objPinUser.Username + " ]"); // } // //if (rdbDivideGivenByUserCommentByKeyword == true) // //{ // // CountGivenByUserCommentByKeyword--; // // if (CountGivenByUserCommentByKeyword < 0) // // { // // break; // // } // //} // int delay = RandomNumberGenerator.GenerateRandom(minDelayCommentByKeyword, maxDelayCommentByKeyword); // GlobusLogHelper.log.Info(" => [ Delay For " + delay + " Seconds ]"); // Thread.Sleep(delay * 1000); // } // } // } // catch (Exception ex) // { // GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); // } // } ////} #endregion } GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------"); } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } finally { try { if (countThreadControllerCommentByKeyword > Nothread_CommentByKeyword) { lock (CommentByKeywordObjThread) { Monitor.Pulse(CommentByKeywordObjThread); } CommentByKeyworddata_count--; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } countThreadControllerCommentByKeyword--; } }
public List<string> GetBoardPinsNew(string BoardId, string BoardUrl, int PageCount, ref PinInterestUser objPinInUser) { List<string> lstPopularPins = new List<string>(); try { //Log("[ " + DateTime.Now + " ] => [ Start Getting Popular Pins For this User " + objPinInUser.Username + " ]"); string LikeUrl = BoardUrl; try { PopularPinPageSource = objPinInUser.globusHttpHelper.getHtmlfromUrl(new Uri(LikeUrl), "http://pinterest.com/", string.Empty, objPinInUser.UserAgent); } catch (Exception ex) { } if (PopularPinPageSource.Contains("BoardResource\", \"options\": {\"board_id\":")) { BoardIdOfBoardUrl = Utils.Utils.getBetween(PopularPinPageSource, "BoardResource\", \"options\": {\"board_id\":", ",").Replace("\"", "").Trim(); } BoardUrlEdited = BoardUrl.Replace("https://www.pinterest.com", "").Replace("/", "%2F"); while (!string.IsNullOrEmpty(PopularPinPageSource)) { if (!string.IsNullOrEmpty(PopularPinPageSource)) { if (PopularPinPageSource.Contains("board_layout")) { BookMark = Utils.Utils.getBetween(PopularPinPageSource, "board_layout\": \"default\", \"bookmarks\": [", "]").Replace("\"", "").Replace("=", ""); } if (PopularPinPageSource.Contains("pinHolder")) { string[] arrPin = Regex.Split(PopularPinPageSource, "pinHolder"); foreach (var itemArrPin in arrPin) { string Pin = Utils.Utils.getBetween(itemArrPin, "/pin/", "class=").Replace("\\", "").Replace("/", "").Replace("\"", "").Trim(); if (!string.IsNullOrEmpty(Pin) && !lstPopularPins.Contains(Pin)) { lstPopularPins.Add(Pin); } } } if (PopularPinPageSource.Contains("\"id\":")) { string[] arrPin = Regex.Split(PopularPinPageSource, "uri"); foreach (var itemArrPin in arrPin) { if (itemArrPin.Contains("/v3/pins/")) { string Pin = Utils.Utils.getBetween(itemArrPin, "/v3/pins/", "/comments/").Replace("\\", "").Replace("/", "").Replace("\"", "").Trim(); if (!string.IsNullOrEmpty(Pin) && !lstPopularPins.Contains(Pin)) { lstPopularPins.Add(Pin); } } } } } NextPageUrl = "https://www.pinterest.com/resource/BoardFeedResource/get/?source_url=" + BoardIdOfBoardUrl + "&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardIdOfBoardUrl + "%22%2C%22board_url%22%3A%22" + BoardUrlEdited + "%22%2C%22page_size%22%3Anull%2C%22prepend%22%3Atrue%2C%22access%22%3A%5B%5D%2C%22board_layout%22%3A%22default%22%2C%22bookmarks%22%3A%5B%22" + BookMark + "%3D%3D%22%5D%7D%2C%22context%22%3A%7B%7D%7D&_=142710648289" + count + ""; try { PopularPinPageSource = objPinInUser.globusHttpHelper.getHtmlfromUrl(new Uri(NextPageUrl), "https://www.pinterest.com/", string.Empty, objPinInUser.UserAgent); } catch (Exception ex) { PopularPinPageSource = null; } count++; } lstPopularPins = lstPopularPins.Distinct().ToList(); //lstPopularPins.Reverse(); GlobusLogHelper.log.Info(" => [ Total Pin Urls Collected " + lstPopularPins.Count + " ]"); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } return lstPopularPins; }
public List<string> GetAllBoardNames_new(ref PinInterestUser objPinInUser) { List<string> BoardNames = new List<string>(); BaseLib.GlobusRegex rgx = new GlobusRegex(); Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper(); string UserUrl = "http://pinterest.com/" + objPinInUser.Username; string BoardPage = httpHelper.getHtmlfromUrl(new Uri(UserUrl), "", "", objPinInUser.UserAgent); string[] Items = Regex.Split(BoardPage, "item"); int counter = 0; foreach (string item in Items) { try { if (item.Contains("id=\\\"Board") && item.Contains("boardLinkWrapper")) { //if (counter == 1) { string[] Data = System.Text.RegularExpressions.Regex.Split(item, "boardLinkWrapper"); foreach (string Dataitem in Data) { if (Dataitem.Contains("-end-")) { continue; } if (Dataitem.Contains("boardName")) { int startIndex = Dataitem.IndexOf("title"); int LastPoint = Dataitem.IndexOf("<h4"); string Board = Dataitem.Substring(startIndex, LastPoint).Replace("\\n", string.Empty).Replace("\"", "").Replace("<div class=\\b", string.Empty).Replace(" ", string.Empty).Replace("\"title\"", "").Replace("</div", ""); Board = rgx.StripTagsRegex(Board); try { Board = Board.Split('>')[1]; } catch { } if (!BoardNames.Contains(Board)) { BoardNames.Add(Board); } } } } counter++; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } return BoardNames; }
public void StartActionMultithreadFollowByKeyword(ref PinInterestUser objPinUser) { try { try { lstThreadsFollowByKeyword.Add(Thread.CurrentThread); lstThreadsFollowByKeyword.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; DataTable FollowedCount = QM.SelectFollowsToday(objPinUser.Username); int TotalFollow = NoOfUserFollowByKeyword; //int CountLeft = NoOfUserFollowByKeyword - FollowedCount.Rows.Count; int FollowData = 0; if (TotalFollow > 0) { int Time = AccPerDayUserFollowByKeyword; int delay = (Time * 60 * 60) / TotalFollow; foreach (string comment in ClGlobul.lstkeyword) { string[] arraykey = Regex.Split(comment, "::"); if (arraykey.Length == 2) { if (arraykey[0] == objPinUser.Niches) { string[] keywordArray = Regex.Split(arraykey[1], ","); bool OverFollow = false; foreach (string PinSearch in keywordArray) { try { Pins = getUserKeywordSearch_New(PinSearch, NoOfUserFollowByKeyword, ref objPinUser); foreach (string FollowUser in Pins) { try { DataTable dt = QM.SelectFollowsToday(objPinUser.Username); DataTable dt1 = QM.SelectFollowsCheck(objPinUser.Username, FollowUser); if (FollowData >= TotalFollow) { GlobusLogHelper.log.Info(" => [ Followed " + dt.Rows.Count + " Users ]"); OverFollow = true; TotalFollow = TotalFollow + NoOfUserFollowByKeyword; break; } if (dt1.Rows.Count == 0) { string User = FollowPeople_New(ref objPinUser, FollowUser, PinSearch); if (User == "Followed") { string CSV_Header = "UserName" + "," + "Follow User" + "," + "Date"; string CSV_Data = objPinUser.Username + "," + FollowUser + "," + System.DateTime.Now.ToString(); string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Follow"); PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\FollowByKeyword.csv"); QM.insertFollowDate(objPinUser.Username, FollowUser, PinSearch); OverFollow = false; FollowData++; GlobusLogHelper.log.Info(" => [ Successfully Followed " + FollowUser + ">>>" + objPinUser.Username + " ]"); } else if (User == "exceeded the maximum rate") { GlobusLogHelper.log.Info(" => [ Rate Limit Exceeded ]"); } else if (User == "NotFollowed") { GlobusLogHelper.log.Info(" => [ Follow Process Failed User " + FollowUser + ">>>" + objPinUser.Username + " ]"); } else if (User == "Unfollow") { GlobusLogHelper.log.Info(" => [ Already Followed " + FollowUser + " from " + objPinUser.Username + "]"); } int RandomDelayAdd = RandomNumberGenerator.GenerateRandom(minDelayFollowByKeyword, maxDelayFollowByKeyword); GlobusLogHelper.log.Info(" => [ Delay For " + RandomDelayAdd + " Seconds ]"); int totaldelay = (RandomDelayAdd * 1000); Thread.Sleep(totaldelay); } else { GlobusLogHelper.log.Info(" => [ Already Followed " + FollowUser + " from " + objPinUser.Username + "]"); } if (OverFollow) { break; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } } catch (Exception ex) { } } } } } GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); GlobusLogHelper.log.Info("----------------------------------------------------------------------------------------------------"); } } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
public void StartActionMultithreadLike(ref PinInterestUser objPinUser, List<string> UserLikecount) { try { try { lstThreadsLike.Add(Thread.CurrentThread); lstThreadsLike.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } int LikeCount = 0; if (rbListLikePinUrls == true) { ClGlobul.lstPins = UserLikecount; if (MaxLike == ClGlobul.lstPins.Count) { ClGlobul.lstPins.Add("1"); } #region Comment //if (rdbDivideByUser == true) //{ // int splitNo = 0; // //LikePinLst = Split(ClGlobul.lstAddToBoardUserNames, MaxLike); // list_lstTargetLike = Split(ClGlobul.lstAddToBoardUserNames, splitNo); // //List<List<string>> Temp_LikePinList = new List<List<string>>(); // //Temp_LikePinList = LikePinLst; // foreach (List<string> item_LikePinLst in list_lstTargetLike) // { // ClGlobul.lstPins = item_LikePinLst; // LikePinLst.Remove(item_LikePinLst); // break; // } //} #endregion Comment } else { if (rdbDivideByUser == true) { GlobusLogHelper.log.Info(" => [ Using Random Url to Like ]"); int countLoadEmails = PDGlobals.loadedAccountsDictionary.Count(); lstAllPins = GetPins(ref objPinUser, MaxLike); Random Pinrnd = new Random(); ClGlobul.lstPins = lstAllPins.OrderBy(X => Pinrnd.Next()).ToList(); } else { GlobusLogHelper.log.Info(" => [ Using Random Url to Like ]"); int countLoadEmails = PDGlobals.loadedAccountsDictionary.Count(); lstAllPins = GetPins(ref objPinUser, MaxLike); Random Pinrnd = new Random(); ClGlobul.lstPins = lstAllPins.OrderBy(X => Pinrnd.Next()).ToList(); } } #region foreach foreach (string Pin in ClGlobul.lstPins) { if (MaxLike > LikeCount) { try { DataSet dt = DataBaseHandler.SelectQuery("SELECT * FROM LikeUsingUrl Where LikeUrl = '" + Pin + "' and UserName = '******' ", "LikeUsingUrl"); int count_NO_RoWs = dt.Tables[0].Rows.Count; if (count_NO_RoWs == 0) { bool IsLiked = Like_New(ref objPinUser, Pin); if (IsLiked) { #region AccountReport string module = "Like"; string status = "Liked"; Qm.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + Pin, "", "", "", "", "", status, "", "", DateTime.Now); objLikeDelegate(); #endregion GlobusLogHelper.log.Info(" => [ Liked : " + Pin + " From " + objPinUser.Username + " ]"); try { if (!string.IsNullOrEmpty(Pin) && !string.IsNullOrEmpty(objPinUser.Username)) { string query = "INSERT INTO LikeUsingUrl (LikeUrl,UserName) VALUES ('" + Pin + "' ,'" + objPinUser.Username + "') "; DataBaseHandler.InsertQuery(query, "LikeUsingUrl"); } try { string CSV_Header = "Username" + "," + "Pin" + "," + "" + "Date"; string CSV_Data = objPinUser.Username + "," + "https://www.pinterest.com/pin/" + Pin + "/" + "," + System.DateTime.Now.ToString(); string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Like"); PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\NormalLike.csv"); } catch (Exception ex) { } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } else { GlobusLogHelper.log.Info(" => [ Not Liked : " + Pin + " From " + objPinUser.Username + " ]"); } int Delay = RandomNumberGenerator.GenerateRandom(minDelayLike, maxDelayLike); GlobusLogHelper.log.Info(" => [ Delay For " + Delay + " Seconds ]"); Thread.Sleep(Delay * 1000); } else { GlobusLogHelper.log.Info(" => [ Already Liked : " + Pin + " From " + objPinUser.Username + " ]"); int Delay = RandomNumberGenerator.GenerateRandom(minDelayLike, maxDelayLike); GlobusLogHelper.log.Info(" => [ Delay For " + Delay + " Seconds ]"); Thread.Sleep(Delay * 1000); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } LikeCount++; } else { break; } } #endregion if (MaxLike <= LikeCount) { GlobusLogHelper.log.Info(" [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------"); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
public List<string> getUserKeywordSearch_New(string keyword, int Count, ref PinInterestUser objPinUser) { List<string> lstUserPins = new List<string>(); try { GlobusLogHelper.log.Info(" => [ Start Getting Pins For the Keyword " + keyword + " ]"); string UserUrl = string.Empty; string UserPins = string.Empty; string Board = string.Empty; string Pins = string.Empty; string Like = string.Empty; string Follower = string.Empty; string Following = string.Empty; for (int i = 0; i <= Count; i++) { try { if (i == 0) { UserUrl = "http://pinterest.com/search/people/?q=" + keyword; } else { UserUrl = "http://pinterest.com/resource/SearchResource/get/?source_url=%2Fsearch%2Fpins%2F%3Fq%3Droses%26rs%3Dac%26len%3D4&data=%7B%22options%22%3A%7B%22query%22%3A%22roses%22%2C%22bookmarks%22%3A%5B%22b281MHw4ODgyNzJiYWQxN2E0NmM2MTNlNjNkYjY1Y2E4ZDY2OTI4ODZkMzBiNGEyNjU4ZGMyODFmMzhhOTUzZjE2NTRm%22%5D%2C%22show_scope_selector%22%3Atrue%2C%22scope%22%3A%22pins%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22411bd12%22%7D%2C%22module%22%3A%7B%22name%22%3A%22GridItems%22%2C%22options%22%3A%7B%22scrollable%22%3Atrue%2C%22show_grid_footer%22%3Atrue%2C%22centered%22%3Atrue%2C%22reflow_all%22%3Atrue%2C%22virtualize%22%3Atrue%2C%22item_options%22%3A%7B%22show_pinner%22%3Atrue%2C%22show_pinned_from%22%3Afalse%2C%22show_board%22%3Atrue%7D%2C%22layout%22%3A%22variable_height%22%7D%7D%2C%22append%22%3Atrue%2C%22error_strategy%22%3A1%7D&module_path=App()%3EHeader()%3Eui.SearchForm()%3Eui.TypeaheadField(enable_recent_queries%3Dtrue%2C+name%3Dq%2C+view_type%3Dsearch%2C+prefetch_on_focus%3Dtrue%2C+value%3D%22%22%2C+populate_on_result_highlight%3Dtrue%2C+search_delay%3D0%2C+search_on_focus%3Dtrue%2C+placeholder%3DSearch%2C+tags%3Dautocomplete)&_=" + DateTime.Now.Ticks; } string UserPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(UserUrl), "http://pinterest.com/", string.Empty, objPinUser.UserAgent); if (!UserPageSource.Contains("The page you're looking for could not be found")) { List<string> lst = globusRegex.GetHrefUrlTags(UserPageSource); string[] array = System.Text.RegularExpressions.Regex.Split(UserPageSource, "href="); foreach (string item in array) { if (item.Contains("class=\\\"userWrapper\\\"")) { try { int FirstPinPoint = item.IndexOf("\\\"/"); int SecondPinPoint = item.IndexOf("/\\\""); string PinUrl = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\\", "").Replace("\"", string.Empty).Replace("href=", string.Empty).Replace("/", string.Empty).Trim(); string FollowersUrl = "https://pinterest.com/" + PinUrl; string GetResponse = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(FollowersUrl)); #region ChkboxFollowCertainAmtofValue if (ChkboxFollowCertainAmtofValue == true) { if (!GetResponse.Contains("<div>Something went wrong!</div>")) { try { try { Board = Utils.Utils.getBetween(GetResponse, "pinterestapp:boards\" content=\"", "\" data-app>"); } catch (Exception ex) { Board = "NA"; GlobusLogHelper.log.Error(" Error ==>" + ex.Message); } try { Pins = Utils.Utils.getBetween(GetResponse, "pinterestapp:pins\" content=\"", "\" data-app>"); } catch (Exception ex) { Pins = "NA"; GlobusLogHelper.log.Error(" Error ==>" + ex.Message); } try { Like = Utils.Utils.getBetween(GetResponse, "like_count\":", ",\""); } catch (Exception ex) { Like = "NA"; GlobusLogHelper.log.Error(" Error ==>" + ex.Message); } try { Follower = Utils.Utils.getBetween(GetResponse, "pinterestapp:followers\" content=\"", "\" data-app>"); } catch (Exception ex) { Follower = "NA"; GlobusLogHelper.log.Error(" Error ==>" + ex.Message); } try { Following = Utils.Utils.getBetween(GetResponse, "pinterestapp:following\" content=\"", "\" data-app>"); } catch (Exception ex) { Following = "NA"; GlobusLogHelper.log.Error(" Error ==>" + ex.Message); } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error ==>" + ex.Message); } if (chkBoard == true) { if ((minValueBoard <= int.Parse(Board)) && (int.Parse(Board) <= maxValueBoard)) { } else { continue; } } if (chkPin == true) { if ((minValuePin <= int.Parse(Pins)) && (int.Parse(Pins) <= maxValuePin)) { } else { continue; } } if (chkLike == true) { if ((minValueLike <= int.Parse(Like)) && (int.Parse(Like) <= maxValueLike)) { } else { continue; } } if (chkFollower == true) { if ((minValueFollower <= int.Parse(Follower)) && (int.Parse(Follower) <= maxValueFollower)) { } else { continue; } } if (chkFollowing == true) { if ((minValueFollowing <= int.Parse(Following)) && (int.Parse(Following) <= maxValueFollowing)) { } else { continue; } } lstUserPins.Add(PinUrl); } } #endregion ChkboxFollowCertainAmtofValue else { lstUserPins.Add(PinUrl); } if (lstUserPins.Count == NoOfUserFollowByKeyword) { break; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error ==>" + ex.Message); } } } } } catch (Exception ex) { GlobusLogHelper.log.Info(" => [ Sorry No More Pages ]"); break; } lstUserPins = lstUserPins.Distinct().ToList(); lstUserPins.Reverse(); } GlobusLogHelper.log.Info(" => [ Total Pin Urls Collected " + lstUserPins.Count + " ]"); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } return lstUserPins; }
public List<string> GetPins(ref PinInterestUser objPinUser, int MaxPin) { string CategoryName = string.Empty; //List<string> _Pins = new List<string>(); try { PinterestPins pintrestPins = new PinterestPins(); // int EmailCount = lstAccounts.Count; int EmailCount = LoadedAccountCount; int PageCount = ((MaxPin * EmailCount) / 25) + 2; if (PageCount > 10) { PageCount = 10; } //if (rbPinType.Checked) //{ try { //if (rbPopularPin.Checked) //{ // if (lstPins.Count <= 0) //{ ClGlobul.lstPins = pintrestPins.PopularPins(PageCount, ref objPinUser); //} //} //else if (rbVideoPin.Checked) //{ if (ClGlobul.lstPins.Count <= 0) { ClGlobul.lstPins = pintrestPins.VideoPins(PageCount, ref objPinUser); } //} if (ClGlobul.lstPins.Count <= 0) { ClGlobul.lstPins = pintrestPins.NormalPins(ref objPinUser); } } catch (Exception) { } //} //else //{ try { if (ClGlobul.lstPins.Count <= 0) { ClGlobul.lstPins = pintrestPins.CategoryPins(CategoryName, PageCount, ref objPinUser); } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } // } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } return ClGlobul.lstPins; }
public void StartInviteMultiThreaded(object objparameters) { PinInterestUser objPinUser = new PinInterestUser(); try { Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper(); Accounts Obj_AccountManager = new Accounts(); if (!isStopInvite) { try { lstThreadsInvite.Add(Thread.CurrentThread); lstThreadsInvite.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; try { Array paramsArray = new object[1]; paramsArray = (Array)objparameters; objPinUser = (PinInterestUser)paramsArray.GetValue(0); #region Login if (!objPinUser.isloggedin) { GlobusLogHelper.log.Info(" => [ Logging In With : " + objPinUser.Username + " ]"); bool checkLogin; if (string.IsNullOrEmpty(objPinUser.ProxyPort)) { objPinUser.ProxyPort = "80"; } try { //checkLogin = ObjAccountManager.LoginPinterestAccount1(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName); checkLogin = ObjAccountManager.LoginPinterestAccount1forlee(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName); if (!checkLogin) { GlobusLogHelper.log.Info(" => [ Logging UnSuccessfull : " + objPinUser.Username + " ]"); return; } string checklogin = httpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); //GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]"); //StartActionMultithreadInvite(ref objPinUser); } catch { }; } if (objPinUser.isloggedin == true) { try { GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]"); StartActionMultithreadInvite(ref objPinUser); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } #endregion } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } finally { try { if (countThreadControllerInvite > Nothread_Invite) { lock (InviteObjThread) { Monitor.Pulse(InviteObjThread); } Invitedata_count--; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } countThreadControllerInvite--; //if (Invitedata_count == 0) //|| DivideByUserinput < 0) //{ GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------"); //} } }
public bool Like_New(ref PinInterestUser objPinUser, string PinId) { try { string LikeUrl = string.Empty; string Pin = PinId; if (PinId.Contains("pinterest.com")) { Pin = ObjAccountManager.getBetween(Pin, "pinterest.com/pin/", "/"); PinId = Pin; } string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); if (Checking.Contains("profileName")) { } else { ObjAccountManager.LoginPinterestAccount(ref objPinUser); } string RedirectUrlDomain = GlobusHttpHelper.valueURl.Split('.')[0]; string newHomePage = RedirectUrlDomain + ".pinterest.com/"; LikeUrl = RedirectUrlDomain + ".pinterest.com/resource/PinLikeResource2/create/"; string PostData = "source_url=%2F&data=%7B%22options%22%3A%7B%22pin_id%22%3A%22" + PinId + "%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22" + objPinUser.App_version + "%22%7D%7D&module_path=App()%3EHomePage()%3EAuthHomePage(resource%3DUserResource(username%3D" + objPinUser.Username + "))%3EGrid(resource%3DUserHomefeedResource())%3EGridItems(resource%3DUserHomefeedResource())%3EPin(resource%3DPinResource(id%3D" + PinId + "))%3EPinLikeButton(liked%3Dfalse%2C+class_name%3DlikeSmall%2C+pin_id%3D" + PinId + "%2C+has_icon%3Dtrue%2C+tagName%3Dbutton%2C+text%3DLike%2C+show_text%3Dfalse%2C+ga_category%3Dlike)"; string AfterLikePageSourceData = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri(LikeUrl), PostData, newHomePage); if (!AfterLikePageSourceData.Contains("<div>Uh oh! Something went wrong")) { //Log("[ " + DateTime.Now + " ] => [ Successfully Liked For this User " + pinterestAccountManager.Username + " ]"); return true; } else { if (AfterLikePageSourceData.Contains("You are liking really fast")) { GlobusLogHelper.log.Info(" => [ You are liking really fast. Slow down a little. Try after some time " + objPinUser.Username + " ]"); return false; } else { GlobusLogHelper.log.Info(" => [ Like Process Failed For this User " + objPinUser.Username + " ]"); return false; } } } catch (Exception ex) { GlobusLogHelper.log.Error(" => Error : " + ex.StackTrace); return false; } return false; }
public void Invite(string Email, ref PinInterestUser objPinUser) { try { string email = Email.Replace("@", "%").Replace("hotmail", "40163"); //InvitePostData = "source_url=%2F&data=%7B%22options%22%3A%7B%22email%22%3A%22" + email + "%22%2C%22type%22%3A%22email%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EHomePage%3EAuthHomePage%3EGrid%3EGridItems%3EUserNews(anchored%3Dtrue)%23App%3EModalManager%3EModal(can_dismiss%3Dtrue%2C+only_modal%3Dtrue)"; InvitePostData = "source_url=%2Ffind_friends%2F&data=%7B%22options%22%3A%7B%22email%22%3A%22" + email + "%22%2C%22type%22%3A%22email%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EFriendCenter%3EDiscoverFriends%3EInviteTiles%3EDiscoveryTile%3EInvitePanelEmail%3ESocialTypeaheadField(bypass_maxheight%3Dtrue%2C+tags%3Dinvitability%2C+class_name%3DsearchBox%2C+prefetch_on_focus%3Dtrue%2C+prevent_default_on_enter%3Dtrue%2C+bypass_lru_cache%3Dtrue%2C+placeholder%3DEnter+name+or+email%2C+preserve_typeahead%3Dfalse%2C+allow_email%3Dtrue%2C+allowed_social_networks%3Dfacebook%2Cgplus%2Cyahoo%2C+name%3Dname%2C+view_type%3DuserCircleSelect%2C+autocomplete%3Doff%2C+template%3Duser_circle_avatar%2C+search_delay%3D0%2C+close_on_selection%3Dtrue%2C+autofocus%3Dfalse)"; try { InvitedPageSource = objPinUser.globusHttpHelper.postFormData(new Uri("https://www.pinterest.com/resource/EmailInviteSentResource/create/"), InvitePostData, "https://www.pinterest.com/", objPinUser.Token, objPinUser.UserAgent); if (InvitedPageSource.Contains("error\": null")) { #region AccountReport string module = "Invite"; string status = "Invitation Sent"; qm.insertAccRePort(objPinUser.Username, module, "", "", "", Email, "", "", status, "", "", DateTime.Now); objInviteDelegate(); #endregion GlobusLogHelper.log.Info(" => [ " + objPinUser.Username + " Successfully invited to " + Email + " ]"); } else { if (InvitedPageSource.Contains("Failed to send invite")) { GlobusLogHelper.log.Info(" =>(" + objPinUser.Username + "Failed to send invite. Try again after some time " + Email); } else { GlobusLogHelper.log.Info(" =>(" + objPinUser.Username + "Invitation Process Failed " + Email); } } } catch { }; } catch (Exception ex) { Console.Write(ex.Message); } }
public void StartLikeByKeywordMultiThreaded(object objparameters) { PinInterestUser objPinUser = new PinInterestUser(); try { if (!isStopLikeByKeyword) { try { lstThreadsLikeByKeyword.Add(Thread.CurrentThread); lstThreadsLikeByKeyword.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; try { Array paramsArray = new object[1]; paramsArray = (Array)objparameters; objPinUser = (PinInterestUser)paramsArray.GetValue(0); #region Login if (!objPinUser.isloggedin) { GlobusLogHelper.log.Info(" => [ Logging In With : " + objPinUser.Username + " ]"); bool checkLogin; if (string.IsNullOrEmpty(objPinUser.ProxyPort)) { objPinUser.ProxyPort = "80"; } try { checkLogin = ObjAccountManager.LoginPinterestAccount1forlee(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName); if (!checkLogin) { GlobusLogHelper.log.Info(" => [ Logging UnSuccessfull : " + objPinUser.Username + " ]"); return; } string checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); //GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]"); //StartActionMultithreadLikeByKeyword(ref objPinUser); } catch { }; } if (objPinUser.isloggedin == true) { try { GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]"); StartActionMultithreadLikeByKeyword(ref objPinUser); } catch (Exception ex) { GlobusLogHelper.log.Error("Error :" + ex.StackTrace); } } #endregion } catch (Exception ex) { GlobusLogHelper.log.Error("Error :" + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
public string GetBoard(string screen_Name, ref PinInterestUser objPinUser) { string Boards = string.Empty; try { string pagesourceboards = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://pinterest.com/" + screen_Name), "", "", ""); int StartBoards = pagesourceboards.IndexOf("pinterestapp:boards\":"); string _boards = pagesourceboards.Substring(StartBoards); int endboard = _boards.IndexOf(","); _boards = _boards.Substring(0, endboard).Replace("pinterestapp:boards\":", string.Empty).Replace("\"", string.Empty).Trim(); Boards = _boards; return Boards; } catch(Exception ex) { GlobusLogHelper.log.Error("Error :" + ex.StackTrace); } return Boards; }
public void StartActionMultithreadLikeByKeyword(ref PinInterestUser objPinUser) { try { try { lstThreadsLikeByKeyword.Add(Thread.CurrentThread); lstThreadsLikeByKeyword.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; int counter = 0; string[] arrayItem = new string[100]; foreach (string newItem in ClGlobul.lstLikeByKeyword) { try { arrayItem = Regex.Split(newItem, "::"); if (arrayItem.Length == 2 && arrayItem[0] == objPinUser.Niches) { if (arrayItem.Length == 2) { string[] Keywordarrray = Regex.Split(arrayItem[1], ","); foreach (string KeywordsItem in Keywordarrray) { lock (this) { try { lstLike.Add(KeywordsItem); List<string> LstPins = new List<string>(); LstPins = KeywordPins_New(KeywordsItem, MaxLikeByKeyword, ref objPinUser); LstPins = LstPins.Distinct().ToList(); GlobusLogHelper.log.Info(" => [ Finding Pins On Keyword : " + KeywordsItem + " For " + objPinUser.Username + " ]"); GlobusLogHelper.log.Info(" => [ " + LstPins.Count + " Pins On Keyword :" + KeywordsItem + " For " + objPinUser.Username + " ]"); string[] lstofPinLike = null; lstofPinLike = LstPins.ToArray(); #region foreach foreach (string Pin in lstofPinLike) { if (MaxLikeByKeyword > counter) { try { DataSet dt = DataBaseHandler.SelectQuery("SELECT * FROM LikeUsingUrl Where LikeUrl = '" + Pin + "' and UserName = '******' ", "LikeUsingUrl"); int count_NO_RoWs = dt.Tables[0].Rows.Count; if (count_NO_RoWs == 0) { bool IsLiked = objLikeManagers.Like_New(ref objPinUser, Pin); if (IsLiked) { #region AccountReport string module = "LikeByKeyword"; string status = "Liked"; QM.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + Pin, "", "", "", KeywordsItem, "", status, "", "", DateTime.Now); objLikeByKeywordDelegate(); #endregion counter++; GlobusLogHelper.log.Info(" => [ Liked : " + Pin + " From " + objPinUser.Username + " ]"); try { if (!string.IsNullOrEmpty(Pin) && !string.IsNullOrEmpty(objPinUser.Username)) { string query = "INSERT INTO LikeUsingUrl (LikeUrl,UserName) VALUES ('" + Pin + "' ,'" + objPinUser.Username + "') "; DataBaseHandler.InsertQuery(query, "LikeUsingUrl"); } try { string CSV_Header = "Username" + "," + "Pin" + "," + "" + "Date"; string CSV_Data = objPinUser.Username + "," + "https://www.pinterest.com/pin/" + Pin + "/" + "," + System.DateTime.Now.ToString(); string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Like"); PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\LikeByKeyword.csv"); } catch (Exception ex) { } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } else { GlobusLogHelper.log.Info(" => [ Not Liked : " + Pin + " From " + objPinUser.Username + " ]"); } int Delay = RandomNumberGenerator.GenerateRandom(minDelayLikeByKeyword, maxDelayLikeByKeyword); GlobusLogHelper.log.Info(" => [ Delay For " + Delay + " Seconds ]"); Thread.Sleep(Delay * 1000); } else { GlobusLogHelper.log.Info(" => [ Already Liked : " + Pin + " From " + objPinUser.Username + " ]"); int Delay = RandomNumberGenerator.GenerateRandom(minDelayLikeByKeyword, maxDelayLikeByKeyword); GlobusLogHelper.log.Info(" => [ Delay For " + Delay + " Seconds ]"); Thread.Sleep(Delay * 1000); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } else { break; } } #endregion if (MaxLikeByKeyword == counter) { GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); GlobusLogHelper.log.Info("-----------------------------------------------------------------------------------"); } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : 3.4" + ex.StackTrace); } } } } } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : 3.4" + ex.StackTrace); } } GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------"); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } finally { try { if (countThreadControllerLikeByKeyword > Nothread_LikeByKeyword) { lock (LikeByKeywordObjThread) { Monitor.Pulse(LikeByKeywordObjThread); } LikeByKeyworddata_count--; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } countThreadControllerLikeByKeyword--; } }
//public bool LoginPinterestAccount1(ref PinInterestUser objPinUser, string Username, string Password, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string ss) //{ // try // { // lock (this) // { // GlobusHttpHelper globusHttpHelper=new GlobusHttpHelper(); // string Name = string.Empty; // string ProxyAddress = proxyAddress; // string ProxyPort = proxyPort; // string ProxyUsername = proxyUsername; // string ProxyPassword = proxyPassword; // string AfterLoginPageSource = string.Empty; // try // { // string PinPage = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com/"), ProxyAddress, 80, proxyUsername, proxyPassword); // string _MainSourcePage = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com/resource/NoopResource/get/?source_url=%2Flogin%2F%3Fnext%3Dhttps%253A%252F%252Fwww.pinterest.com%252F%26prev%3Dhttps%253A%252F%252Fwww.pinterest.com%252F&data=%7B%22options%22%3A%7B%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3EHomePage()%3EUnauthHomePage(signup_email%3Dnull%2C+tab%3Dfollowing%2C+cmp%3Dnull%2C+resource%3DInspiredWallResource())&_=1424169081757"), proxyAddress, 80, proxyUsername, proxyPassword); // Get App Version // if (PinPage.Contains("app_version")) // { // try // { // string[] ArrAppVersion = System.Text.RegularExpressions.Regex.Split(PinPage, "app_version"); // if (ArrAppVersion.Count() > 0) // { // string DataString = ArrAppVersion[ArrAppVersion.Count() - 1]; // int startindex = DataString.IndexOf("\""); // string start = DataString.Substring(startindex).Replace("\": \"", "").Replace("}", string.Empty).Replace("\"", string.Empty); // int endindex = start.IndexOf(","); // App_version = start.Substring(0, endindex); // if (!string.IsNullOrEmpty(App_version)) // { // objPinUser.App_version = App_version; // } // } // } // catch { }; // } // else // { // App version is not available in page source // } // string referer = "https://www.pinterest.com/"; // string login = string.Empty; // try // { // string PostData1 = "source_url=%2Flogin%2F%3Fnext%3Dhttps%253A%252F%252Fwww.pinterest.com%252F%26prev%3Dhttps%253A%252F%252Fwww.pinterest.com%252F&data=%7B%22options%22%3A%7B%22username_or_email%22%3A%22" + Uri.EscapeDataString(Username) + "%22%2C%22password%22%3A%22" + Uri.EscapeDataString(Password) + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3ELoginPage()%3ELogin()%3EButton(text%3DLog+In%2C+size%3Dlarge%2C+class_name%3Dprimary%2C+type%3Dsubmit)"; // login = globusHttpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/UserSessionResource/create/"), PostData1, referer, proxyAddress, 80, proxyUsername, proxyPassword); // } // catch { }; // try // { // AfterLoginPageSource = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com"), proxyAddress, 80, proxyUsername, proxyPassword); // } // catch (Exception ex) // { // } // if (AfterLoginPageSource.Contains("Logout") || AfterLoginPageSource.Contains("pinHolder") || AfterLoginPageSource.Contains("header1\": \"What are you interested in?") || AfterLoginPageSource.Contains("\"error\": null") || login.Contains("\"error\": null")) // { // objPinUser.globusHttpHelper = globusHttpHelper; // GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Successfully Login for " + Username + " ]"); // this.LoggedIn = true; // } // else // { // GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]"); // this.LoggedIn = false; // return false; // } // } // catch (Exception ex) // { // GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]"); // this.LoggedIn = false; // return false; // } // try // { // List<string> listFollowersFromDatabse = new List<string>(); // try // { // string screen_Name = Getscreen_Name(ref objPinUser); // DataSet ds = QME.getFollower(screen_Name); // foreach (System.Data.DataRow dRow in ds.Tables[0].Rows) // { // try // { // listFollowersFromDatabse.Add(dRow["FollwerName"].ToString()); // } // catch (Exception ex) // { } // } // } // catch { } // try // { // string screen_Name = Getscreen_Name(ref objPinUser); // objPinUser.ScreenName = screen_Name; // Get current followers list from website // List<string> FollowersName = GetRefrshFollowerName(screen_Name, ref objPinUser); // FollowersName.RemoveAt(0); // if (FollowersName != null) // { // FollowersName = FollowersName.Distinct().ToList(); // } // if (FollowersName.Contains(screen_Name)) // { // FollowersName.Remove(screen_Name); // } // listFollowersFromDatabse.Add("gunde"); // List<string> listUnfollowers = listFollowersFromDatabse.Except(FollowersName).ToList(); // GlobusLogHelper.log.Info(listUnfollowers.Count + " users Unfollowed Account : " + screen_Name); // string UnfollowersList = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\PInterestUnfollowersList.csv"; // write unfollowers list to csv // if (!System.IO.File.Exists(UnfollowersList)) //* CSV Header *// // { // try // { // string dataFormat = "Account_ScreenName" + "," + "UnfollowerUsername"; // GlobusFileHelper.AppendStringToTextfileNewLine(dataFormat, UnfollowersList); //dataFormat // } // catch (Exception ex) { }; // } // foreach (string unfollower in listUnfollowers) // { // try // { // string dataFormat = screen_Name + "," + unfollower; // GlobusFileHelper.AppendStringToTextfileNewLine(dataFormat, UnfollowersList); //dataFormat // GlobusLogHelper.log.Info("Unfollower : " + unfollower + " for Account : " + screen_Name + " written to file " + UnfollowersList); // } // catch (Exception ex) // { }; // try // { // QueryExecuter.deleteFollower(screen_Name, unfollower); // GlobusLogHelper.log.Info("Unfollower : " + unfollower + " for Account : " + screen_Name + " deleted from Databse"); // } // catch (Exception ex) // { } // } // List<string> listNewFollowers = FollowersName.Except(listFollowersFromDatabse).ToList(); // GlobusLogHelper.log.Info(listNewFollowers.Count + " NEW Followers for Account : " + screen_Name + ""); // foreach (string follName_item in listNewFollowers) // { // try // { // QueryExecuter.insertFollowerName(screen_Name, follName_item); // GlobusLogHelper.log.Info("New follower : " + follName_item + " for Account : " + screen_Name + " added to Databse"); // } // catch { } // } // string follower = GetFollowercount(screen_Name, ref objPinUser); // string following = GetFollowingCount(screen_Name, ref objPinUser); // string BOARDS = GetBoard(screen_Name, ref objPinUser); // string followingCount = getBetween(following, "value'>", "</span>"); // string BoardsName = string.Empty; // List<string> BOARDSNAMES = new List<string>(); // if (inviteStart) // { // BOARDSNAMES = GetAllBoardNames_new1(screen_Name, ref objPinUser); // foreach (var itemBoardNames in BOARDSNAMES) // { // try // { // lstBoardNames.Add(itemBoardNames.ToLower().Replace(" ", "-")); // } // catch(Exception ex) // { }; // } // } // inviteStart = true; // try // { // foreach (string item_BoardNames in BOARDSNAMES) // { // BoardsName += item_BoardNames + (":").ToString(); // } // } // catch(Exception ex) // { }; // try // { // // QueryExecuter.updatetb_emails(follower, followingCount, BOARDS, BoardsName, screen_Name, Username); // objUploadAccount.AccounLoad(); // objDelegateAccountLoad(); // } // catch(Exception ex) // { }; // } // catch(Exception ex) // { }; // string[] ArrData = System.Text.RegularExpressions.Regex.Split(AfterLoginPageSource, "username"); // foreach (var item in ArrData) // { // try // { // if (item.Contains("{\"page_info")) // { // continue; // } // if (!item.StartsWith("\": null,") && !item.StartsWith("{\"request_identifier\"")) // { // int startindex = item.IndexOf(":"); // int endindex = item.IndexOf("\", \""); // this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); // break; // } // if (item.Contains("locale"))// && item.Contains("P.currentUser.set")) // { // int startindex = item.IndexOf(":"); // int endindex = item.IndexOf("\", \""); // this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); // break; // } // else if (item.Contains("name\": \"AuthHomePage")) // { // int startindex = item.IndexOf(":"); // int endindex = item.IndexOf("\", \""); // this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("\"", string.Empty).Trim(); // } // } // catch (Exception ex) // { } // } // if (ArrData.Count() == 2 && string.IsNullOrEmpty(Name)) // { // try // { // int startindex = ArrData[1].IndexOf(":"); // int endindex = ArrData[1].IndexOf("\", \""); // this.Name = ArrData[1].Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); // } // catch { }; // } // } // catch (Exception ex) // { // this.Name = string.Empty; // } // } // if (this.LoggedIn) // { // return true; // } // } // catch (Exception ex) // { // } // return false; //} public bool LoginPinterestAccount1forlee(ref PinInterestUser objPinUser, string Username, string Password, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string ss) { try { if (!checkFirstTimeLicense) { bool checkValideLicense = checkLoginTimeLicenseStatus(); if (!checkValideLicense) { GlobusLogHelper.log.Debug("-----------------------------------------------------"); GlobusLogHelper.log.Info(" Please Re-Start The Software !"); return false; } } lock (this) { GlobusHttpHelper globusHttpHelper = new GlobusHttpHelper(); string Name = string.Empty; string ProxyAddress = proxyAddress; string ProxyPort = proxyPort; string ProxyUsername = proxyUsername; string ProxyPassword = proxyPassword; string LoginStatus = string.Empty; string AfterLoginPageSource = string.Empty; try { string PinPage = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com/"), ProxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword); /// string _MainSourcePage = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com/resource/NoopResource/get/?source_url=%2Flogin%2F%3Fnext%3Dhttps%253A%252F%252Fwww.pinterest.com%252F%26prev%3Dhttps%253A%252F%252Fwww.pinterest.com%252F&data=%7B%22options%22%3A%7B%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3EHomePage()%3EUnauthHomePage(signup_email%3Dnull%2C+tab%3Dfollowing%2C+cmp%3Dnull%2C+resource%3DInspiredWallResource())&_=1424169081757"), proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); ///Get App Version if (PinPage.Contains("app_version")) { try { string[] ArrAppVersion = System.Text.RegularExpressions.Regex.Split(PinPage, "app_version"); if (ArrAppVersion.Count() > 0) { string DataString = ArrAppVersion[ArrAppVersion.Count() - 1]; int startindex = DataString.IndexOf("\""); string start = DataString.Substring(startindex).Replace("\": \"", "").Replace("}", string.Empty).Replace("\"", string.Empty); int endindex = start.IndexOf(","); App_version = start.Substring(0, endindex); if (!string.IsNullOrEmpty(App_version)) { objPinUser.App_version = App_version; } } } catch { }; } else { ///App version is not available in page source } string referer = "https://www.pinterest.com/"; string login = string.Empty; try { string PostData1 = "source_url=%2F&data=%7B%22options%22%3A%7B%22username_or_email%22%3A%22" + Uri.EscapeDataString(Username) + "%22%2C%22password%22%3A%22" + Uri.EscapeDataString(Password) + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EModalManager%3EModal%3EPlainSignupModal%3ESignupForm%3EUserRegister(next%3D%2F%2C+wall_class%3DgrayWall%2C+container%3Dplain_signup_modal%2C+unified_auth%3Dundefined%2C+is_login_form%3Dtrue%2C+show_personalize_field%3Dundefined%2C+auto_follow%3Dundefined%2C+register%3Dtrue)"; login = globusHttpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/UserSessionResource/create/"), PostData1, referer, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); } catch (Exception ex) { } try { AfterLoginPageSource = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com"), proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); } catch (Exception ex) { } if (AfterLoginPageSource.Contains("Logout") || AfterLoginPageSource.Contains("pinHolder") || AfterLoginPageSource.Contains("header1\": \"What are you interested in?") || AfterLoginPageSource.Contains("\"error\": null") || login.Contains("\"error\": null")) { // GlobusLogHelper.log.Info(" => [ Successfully Login for " + Username + " ]"); objPinUser.globusHttpHelper = globusHttpHelper; this.LoggedIn = true; objPinUser.isloggedin = true; objPinUser.LoginStatus = "Success"; } else { //GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]"); this.LoggedIn = false; objPinUser.LoginStatus = "Fail"; try { try { QueryExecuter.updatetb_emails("", "", "", "", objPinUser.ScreenName, Username, objPinUser.LoginStatus); } catch { } //objUploadAccount.AccounLoad(); objDelegateAccountLoad(); } catch { } return false; } } catch (Exception ex) { //GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]"); this.LoggedIn = false; objPinUser.LoginStatus = "Fail"; try { try { QueryExecuter.updatetb_emails("", "", "", "", objPinUser.ScreenName, Username, objPinUser.LoginStatus); } catch { } //objUploadAccount.AccounLoad(); objDelegateAccountLoad(); } catch { } return false; } try { List<string> listFollowersFromDatabse = new List<string>(); try { string screen_Name = Getscreen_Name(ref objPinUser); objPinUser.ScreenName = screen_Name; DataSet ds = QME.getFollower(screen_Name); foreach (System.Data.DataRow dRow in ds.Tables[0].Rows) { try { listFollowersFromDatabse.Add(dRow["FollwerName"].ToString()); } catch { } } } catch { } try { #region old Commented Code ///string screen_Name = Getscreen_Name(ref objPinUser); ///Screen_Name = screen_Name; //Get current followers list from website // List<string> FollowersName = GetRefrshFollowerName(objPinUser.ScreenName, ref objPinUser); // //FollowersName.RemoveAt(0); // if (FollowersName != null) // { // FollowersName = FollowersName.Distinct().ToList(); // } // if (FollowersName.Contains(objPinUser.ScreenName)) // { // FollowersName.Remove(objPinUser.ScreenName); // } // //listFollowersFromDatabse.Add("gunde"); // List<string> listUnfollowers = listFollowersFromDatabse.Except(FollowersName).ToList(); //// GlobusLogHelper.log.Info(listUnfollowers.Count + " users Unfollowed Account : " + screen_Name); // string UnfollowersList = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\PInterestUnfollowersList.csv"; // //write unfollowers list to csv // if (!System.IO.File.Exists(UnfollowersList)) //* CSV Header *// // { // try // { // string dataFormat = "Account_ScreenName" + "," + "UnfollowerUsername"; // GlobusFileHelper.AppendStringToTextfileNewLine(dataFormat, UnfollowersList); //dataFormat // } // catch (Exception ex) { }; // } // foreach (string unfollower in listUnfollowers) // { // try // { // string dataFormat = objPinUser.ScreenName + "," + unfollower; // GlobusFileHelper.AppendStringToTextfileNewLine(dataFormat, UnfollowersList); //dataFormat // //GlobusLogHelper.log.Info("Unfollower : " + unfollower + " for Account : " + screen_Name + " written to file " + UnfollowersList); // } // catch (Exception ex) { }; // try // { // QueryExecuter.deleteFollower(objPinUser.ScreenName, unfollower); // //GlobusLogHelper.log.Info("Unfollower : " + unfollower + " for Account : " + screen_Name + " deleted from Databse"); // } // catch { } // } // List<string> listNewFollowers = FollowersName.Except(listFollowersFromDatabse).ToList(); //// GlobusLogHelper.log.Info(listNewFollowers.Count + " NEW Followers for Account : " + screen_Name + ""); // foreach (string follName_item in listNewFollowers) // { // try // { // QueryExecuter.insertFollowerName(objPinUser.ScreenName, follName_item); // //GlobusLogHelper.log.Info("New follower : " + follName_item + " for Account : " + screen_Name + " added to Databse"); // } // catch { } // } #endregion string follower = GetFollowercount(objPinUser.ScreenName, ref objPinUser); string following = GetFollowingCount(objPinUser.ScreenName, ref objPinUser); //string BOARDS = GetBoard(objPinUser.ScreenName, ref objPinUser); //Globals.followingCountLogin = int.Parse(PinterestAccountManager.getBetween(following, "value'>", "</span>")); string followingCount = following; string BOARDS = string.Empty; string BoardsName = string.Empty; List<string> BOARDSNAMES = new List<string>(); List<string> lstBoardNamesNew = new List<string>(); if (inviteStart) { BOARDSNAMES = GetAllBoardNames_new1(objPinUser.ScreenName, ref objPinUser); foreach (var itemBoardNames in BOARDSNAMES) { lstBoardNamesNew.Add(itemBoardNames.ToLower().Replace(" ", "-")); } objPinUser.Boards = lstBoardNamesNew; } inviteStart = true; try { foreach (string item_BoardNames in BOARDSNAMES) { BoardsName += item_BoardNames + (":").ToString(); } } catch { } try { try { QueryExecuter.updatetb_emails(follower, followingCount, BOARDS, BoardsName, objPinUser.ScreenName, Username, objPinUser.LoginStatus); } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } //objUploadAccount.AccounLoad(); objDelegateAccountLoad(); } catch { } } catch { } string[] ArrData = System.Text.RegularExpressions.Regex.Split(AfterLoginPageSource, "username"); foreach (var item in ArrData) { try { if (item.Contains("{\"page_info")) { continue; } if (!item.StartsWith("\": null,") && !item.StartsWith("{\"request_identifier\"")) { int startindex = item.IndexOf(":"); int endindex = item.IndexOf("\", \""); this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); break; } if (item.Contains("locale"))// && item.Contains("P.currentUser.set")) { int startindex = item.IndexOf(":"); int endindex = item.IndexOf("\", \""); this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); break; } else if (item.Contains("name\": \"AuthHomePage")) { int startindex = item.IndexOf(":"); int endindex = item.IndexOf("\", \""); this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("\"", string.Empty).Trim(); } } catch (Exception ex) { } } try { if (ArrData.Count() == 2 && string.IsNullOrEmpty(Name)) { int startindex = ArrData[1].IndexOf(":"); int endindex = ArrData[1].IndexOf("\", \""); this.Name = ArrData[1].Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim(); } } catch (Exception ex) { } } catch (Exception ex) { this.Name = string.Empty; } } if (this.LoggedIn) { return true; } } catch (Exception ex) { } return false; }
public List<string> KeywordPins_New(string keyword, int Count, ref PinInterestUser objPinUser) { try { // Test string[] Keyword = Regex.Split(keyword, ":"); foreach (string item in Keyword) { keyword = item; break; } // try { GlobusLogHelper.log.Info(" => [ Start Getting Pins For this User " + keyword + " ]"); for (int i = 0; i <= Count; i++) { try { if (i == 0) { UserUrl = "http://pinterest.com/search/?q=" + keyword; } else { //http://pinterest.com/resource/SearchResource/get/?source_url=%2Fsearch%2Fpins%2F%3Fq%3Dhairstyle&data=%7B%22options%22%3A%7B%22query%22%3A%22hairstyle%22%2C%22bookmarks%22%3A%5B%22b28xMDB8MDQ0NWZiOTBjNzNiODlkOTQ1ZTk3ZjY0ZTBhYjU0YjM0ZDYyNDg3NjU3ZWQ3OGJmZjI4ZTliZGRmODBlMzJlNQ%3D%3D%22%5D%2C%22show_scope_selector%22%3Atrue%2C%22scope%22%3A%22pins%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22fc93456%22%7D%2C%22module%22%3A%7B%22name%22%3A%22GridItems%22%2C%22options%22%3A%7B%22scrollable%22%3Atrue%2C%22show_grid_footer%22%3Atrue%2C%22centered%22%3Atrue%2C%22reflow_all%22%3Atrue%2C%22virtualize%22%3Atrue%2C%22item_options%22%3A%7B%22show_pinner%22%3Atrue%2C%22show_pinned_from%22%3Afalse%2C%22show_board%22%3Atrue%7D%2C%22layout%22%3A%22variable_height%22%7D%7D%2C%22append%22%3Atrue%2C%22error_strategy%22%3A2%7D&_=1375699543906 UserUrl = "http://pinterest.com/resource/SearchResource/get/?source_url=%2Fsearch%2Fpins%2F%3Fq%3D" + keyword + "&data=%7B%22options%22%3A%7B%22query%22%3A%22" + keyword + "%22%2C%22bookmarks%22%3A%5B%22" + Uri.EscapeDataString(bookmark) + "%22%5D%2C%22show_scope_selector%22%3Atrue%2C%22scope%22%3A%22pins%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22" + objPinUser.App_version + "%22%7D%2C%22module%22%3A%7B%22name%22%3A%22GridItems%22%2C%22options%22%3A%7B%22scrollable%22%3Atrue%2C%22show_grid_footer%22%3Atrue%2C%22centered%22%3Atrue%2C%22reflow_all%22%3Atrue%2C%22virtualize%22%3Atrue%2C%22item_options%22%3A%7B%22show_pinner%22%3Atrue%2C%22show_pinned_from%22%3Afalse%2C%22show_board%22%3Atrue%7D%2C%22layout%22%3A%22variable_height%22%7D%7D%2C%22append%22%3Atrue%2C%22error_strategy%22%3A" + i + "%7D&_=" + DateTime.Now.Ticks; } try { UserPageSource = objPinUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri(UserUrl), "http://pinterest.com/", string.Empty, 80, "", "", objPinUser.UserAgent); } catch { UserPageSource = objPinUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri(UserUrl), objPinUser.ProxyAddress, Convert.ToInt32(objPinUser.ProxyPort), objPinUser.ProxyUsername, objPinUser.ProxyPassword); } ///get bookmarks value from page /// if (UserPageSource.Contains("bookmarks")) { string[] bookmarksDataArr = System.Text.RegularExpressions.Regex.Split(UserPageSource, "bookmarks"); string Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 1]; bookmark = Datavalue.Substring(Datavalue.IndexOf(": [\"") + 4, Datavalue.IndexOf("]") - Datavalue.IndexOf(": [\"") - 5); } List<string> lst = System.Text.RegularExpressions.Regex.Split(UserPageSource, "pin_id").ToList(); List<string> templst = new List<string>(); foreach (string item in lst) { if (!item.StartsWith("\": \"") || item.Contains("$") || item.Contains("?{pin}")) { continue; } if (item.Contains("id\": \"pinItButton"))// && item.Contains("/repins/")) { try { int FirstPinPoint = item.IndexOf("\": \""); int SecondPinPoint = item.IndexOf("}, "); if (SecondPinPoint > 30) { SecondPinPoint = item.IndexOf("\", ") + 1; } string Pinid = item.Substring(FirstPinPoint + 4, SecondPinPoint - FirstPinPoint - 5).Trim(); if (!lstUserPins.Any(pid => pid == Pinid)) { lstUserPins.Add(Pinid); } } catch (Exception ex) { } } } } catch (Exception ex) { GlobusLogHelper.log.Info(" => [ Sorry No More Pages ]"); } lstUserPins = lstUserPins.Distinct().ToList(); // lstUserPins.Reverse(); } GlobusLogHelper.log.Info(" => [ Total Pin Urls Collected " + lstUserPins.Count + " ]"); } catch (Exception ex) { } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } return lstUserPins; }
public List<string> GetRefrshFollowerName(string screen_Name, ref PinInterestUser objPinUser) { List<string> FollwrName = new List<string>(); FollwrName.Clear(); string followers = string.Empty; int val = 0; try { string F_usrer = string.Empty; string pagesource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://pinterest.com/" + screen_Name + "/followers/"), "", "", ""); try { string Usrs = getBetween(pagesource, "UserFollowersResource", "UserFollowersResource"); string[] Fnauser = Regex.Split(Usrs, "bookmarks\":"); F_usrer = getBetween(Fnauser[1], "[", "\"]}}").Replace("\"", ""); string Usrs1 = getBetween(pagesource, "UserFollowersResource", "resource_response"); string[] Fnauser1 = Regex.Split(Usrs1, "username"); foreach (string item in Fnauser1) { try { string temp = "username" + item; string username = GlobusHttpHelper.ParseEncodedJson(temp, "username").Trim(); FollwrName.Add(username); } catch { } } } catch { }; while (true) { var url = "http://www.pinterest.com/resource/UserFollowersResource/get/?source_url=%2F" + screen_Name + "%2Ffollowers%2F&data=%7B%22options%22%3A%7B%22username%22%3A%22prabhat101%22%2C%22bookmarks%22%3A%5B%22" + F_usrer + "%22%5D%7D%2C%22context%22%3A%7B%7D%2C%22module%22%3A%7B%22name%22%3A%22GridItems%22%2C%22options%22%3A%7B%22scrollable%22%3Atrue%2C%22show_grid_footer%22%3Afalse%2C%22centered%22%3Atrue%2C%22reflow_all%22%3Atrue%2C%22virtualize%22%3Atrue%2C%22layout%22%3A%22fixed_height%22%7D%7D%2C%22render_type%22%3A3%2C%22error_strategy%22%3A1%7D&_=" + GenerateTimeStamp().ToString(); string Foolwer_pagesource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(url), "", "", ""); if (string.IsNullOrEmpty(Foolwer_pagesource)) { break; } try { string Usrs = getBetween(Foolwer_pagesource, "UserFollowersResource", "GridItems"); string[] Fnauser = Regex.Split(Usrs, "bookmarks\":"); F_usrer = getBetween(Fnauser[1], "[", "\"]}}").Replace("\"", ""); } catch { } string Usrs1 = getBetween(Foolwer_pagesource, "UserFollowersResource", "resource_response"); string[] Fnauser1 = Regex.Split(Usrs1, "username"); foreach (string item in Fnauser1) { try { string temp = "username" + item; string username = GlobusHttpHelper.ParseEncodedJson(temp, "username").Trim(); FollwrName.Add(username); } catch { } } if (F_usrer.Contains("-end-")) { break; } } } catch(Exception ex) { GlobusLogHelper.log.Info("Error :" + ex.StackTrace); } return FollwrName; }
public void StartFollowByKeywordMultiThreaded(object objParameters) { PinInterestUser objPinUser = new PinInterestUser(); try { if (!isStopFollowByKeyword) { try { lstThreadsFollowByKeyword.Add(Thread.CurrentThread); lstThreadsFollowByKeyword.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; try { Array paramsArray = new object[1]; paramsArray = (Array)objParameters; objPinUser = (PinInterestUser)paramsArray.GetValue(0); foreach (string comment in ClGlobul.lstkeyword) { array = Regex.Split(comment, "::"); if (array.Length == 2) { if (array[0] == objPinUser.Niches) { GlobusLogHelper.log.Info(" => [ " + objPinUser.Username + ">>>>" + objPinUser.Niches + " ]"); #region Login if (!objPinUser.isloggedin) { GlobusLogHelper.log.Info(" => [ Logging In With : " + objPinUser.Username + " ]"); bool checkLogin; if (string.IsNullOrEmpty(objPinUser.ProxyPort)) { objPinUser.ProxyPort = "80"; } try { checkLogin = ObjAccountManager.LoginPinterestAccount1forlee(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName); if (!checkLogin) { GlobusLogHelper.log.Info(" => [ Logging UnSuccessfull : " + objPinUser.Username + " ]"); return; } string checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); //GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]"); //StartActionMultithreadFollowByKeyword(ref objPinUser); if (checklogin.Contains("profileName")) { } else { } } catch { }; } if(objPinUser.isloggedin == true) { try { GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]"); StartActionMultithreadFollowByKeyword(ref objPinUser); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } #endregion } } } } catch(Exception ex) { //GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); //GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------"); } } } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } finally { try { if (countThreadControllerFollowByKeyword > Nothread_FollowByKeyword) { lock (FollowByKeywordObjThread) { Monitor.Pulse(FollowByKeywordObjThread); } FollowByKeyworddata_count--; } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } //GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); //GlobusLogHelper.log.Info("----------------------------------------------------------------------------------------------------"); } }
public string GetFollowingCount(string screen_Name, ref PinInterestUser objPinUser) { string following = string.Empty; try { string followingsource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://pinterest.com/" + screen_Name), "", "", ""); int StartFollowing = followingsource.IndexOf("/following/"); string _following = followingsource.Substring(StartFollowing).Replace("/following/", "").Trim(); int endFollowing = _following.IndexOf("</a>"); //_following = _following.Substring(0, endFollowing).Replace("\\n", string.Empty).Replace("\" >", string.Empty).Replace("Following", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim(); _following = Utils.Utils.getBetween(followingsource, "following_count\":", ",\""); following = _following; return following; } catch (Exception ex) { GlobusLogHelper.log.Error("Error :" + ex.StackTrace); } return following; }
public void StartActionMultithreadBoards(ref PinInterestUser objPinInUser) { PinInterestUser objPinUser = objPinInUser; try { try { lstThreadsBoards.Add(Thread.CurrentThread); lstThreadsBoards.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; //TemplstListOfBoardNames.AddRange(ClGlobul.lstListOfBoardNames); foreach (var item_TemplstListOfBoardNames in ClGlobul.lstListOfBoardNames) { try { lock (this) { string[] url = Regex.Split(item_TemplstListOfBoardNames, "::"); if (url[0] == objPinUser.Niches) { string boardurl = url[2].ToString(); string Boardname = string.Empty; string niche = string.Empty; niche = url[0]; Boardname = url[1]; Thread thread = new Thread(() => BoardMethod(Boardname, boardurl, ref objPinUser)); thread.Start(); Thread.Sleep(10 * 1000); } } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } Thread.Sleep(10 * 1000); } #region old code comment //foreach (var itemBoardName in ClGlobul.lstListOfBoardNames)//lstBoardNameswithUserNames //{ // string[] arrBoard = null; // if (itemBoardName.Contains("::")) //"::" // { // arrBoard = Regex.Split(itemBoardName, "::"); //"::" // } // else if (itemBoardName.Contains(":")) // { // arrBoard = Regex.Split(itemBoardName, ":"); // } // //string[] arrBoard = Regex.Split(itemBoardName, "::"); // string[] arrBoard = Regex.Split(itemBoardName, ":"); // if (arrBoard[0] == objPinUser.Niches) // { // if (arrBoard[1].Contains(":")) //if (arrBoard[1].Contains(",")) // { // try // { // string[] arrBoardName = Regex.Split(arrBoard[1], ","); // foreach (var itemBoard in arrBoardName) // { // if (itemBoard.Contains(",")) // { // string[] MatchBoardwithUrl = Regex.Split(itemBoard, ","); // foreach (var item_TemplstListOfBoardNames in TemplstListOfBoardNames) // { // string[] url = Regex.Split(item_TemplstListOfBoardNames, "::"); // if (MatchBoardwithUrl[0] == url[0]) // { // string boardurl = url[1].ToString(); // Thread thread = new Thread(() => BoardMethod(MatchBoardwithUrl[1], boardurl, ref objPinUser)); // thread.Start(); // Thread.Sleep(10 * 1000); // } // else // { // } // } // } // } // } // catch (Exception ex) // { // GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); // } // } // else if (arrBoard[1].Contains(",")) // { // foreach (var itemBoardName1 in ClGlobul.lstBoardNameswithUserNames) // { // string[] url = Regex.Split(BoardUrl, "::"); // string boardurl = url[1].ToString(); // string[] arrBoard1 = null; // if (itemBoardName1.Contains("::")) // { // arrBoard1 = Regex.Split(itemBoardName, "::"); // } // else // { // arrBoard1 = Regex.Split(itemBoardName, ":"); // } // if (arrBoard1[0] == objPinUser.Niches) // { // if (arrBoard1[1].Contains(",")) // { // string[] arrBoardName = Regex.Split(arrBoard1[1], ","); // foreach (var itemBoard in arrBoardName) // { // Thread thread = new Thread(() => BoardMethod(itemBoard, boardurl, ref objPinUser)); // thread.Start(); // Thread.Sleep(10 * 1000); // } // } // else // { // Thread thread = new Thread(() => BoardMethod(arrBoard1[1], BoardUrl, ref objPinUser)); // thread.Start(); // Thread.Sleep(10 * 1000); // } // } // } // } // else // { // try // { // //foreach (var item_TemplstListOfBoardNames in TemplstListOfBoardNames) // //{ // // try // // { // // string[] url = Regex.Split(item_TemplstListOfBoardNames, "::"); // // string boardurl = url[1].ToString(); // // if (!arrBoard[1].Contains(":")) // // { // // string Boardname = string.Empty; // // try // // { // // string[] board = null; // // if (!arrBoard[1].Contains(",")) // if (arrBoard[1].Contains(",")) // // { // // Boardname = arrBoard[1]; // // } // // else if (arrBoard[1].Contains(",")) // // { // // board = Regex.Split(arrBoard[1], ","); // // Boardname = board[1]; // // } // // if (url[0] == Boardname) // // { // // try // // { // // Thread thread = new Thread(() => BoardMethod(Boardname, boardurl, ref objPinUser)); // // thread.Start(); // // Thread.Sleep(10 * 1000); // // } // // catch(Exception ex) // // { }; // // } // // } // // catch (Exception ex) // // { }; // // } // // } // // catch (Exception ex) // // { }; // //} // } // catch (Exception ex) // { }; // } // } //} #endregion } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } finally { try { if (countThreadControllerBoards > Nothread_Boards) { lock (BoardsObjThread) { Monitor.Pulse(BoardsObjThread); } } Boardsdata_count--; } catch (Exception Ex) { GlobusLogHelper.log.Error(" Error :" + Ex.StackTrace); } countThreadControllerBoards--; } }