public void StartAddUsersToBoard() { try { countThreadControllerAddUserToBoard = 0; int numberOfAccountPatchAddUserToBoard = 25; if (numberOfAccountPatchAddUserToBoard > 0) { numberOfAccountPatchAddUserToBoard = NoOfThreadsAddUserToBoard; } AddUserToBoarddata_count = PDGlobals.loadedAccountsDictionary.Count(); List <List <string> > list_listAccounts = new List <List <string> >(); if (PDGlobals.listAccounts.Count >= 1) { list_listAccounts = Utils.Utils.Split(PDGlobals.listAccounts, numberOfAccountPatchAddUserToBoard); foreach (List <string> listAccounts in list_listAccounts) { foreach (string account in listAccounts) { if (countThreadControllerAddUserToBoard > Nothread_AddUserToBoard) { try { lock (AddUserToBoardObjThread) { Monitor.Wait(AddUserToBoardObjThread); } } catch (Exception Ex) { } } string acc = account.Split(':')[0]; PinInterestUser objPinInterestUser = null; PDGlobals.loadedAccountsDictionary.TryGetValue(acc, out objPinInterestUser); if (objPinInterestUser != null) { Thread profilerThread = new Thread(StartAddUserToBoardMultiThreaded); profilerThread.Name = "workerThread_Profiler_" + acc; profilerThread.IsBackground = true; profilerThread.Start(new object[] { objPinInterestUser }); countThreadControllerAddUserToBoard++; } } } } } catch (Exception ex) { //GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
public string Follow(ref PinInterestUser objPinUser, string UserUrl) { try { if (!UserUrl.Contains("pinterest.com")) { UserUrl = "http://pinterest.com/" + UserUrl + "/"; } UserUrl = UserUrl + "follow/"; string UserName = UserUrl.Replace("http://pinterest.com/", string.Empty).Replace("follow", string.Empty).Replace("/", string.Empty); string Referer = "http://pinterest.com/search/people/?q=" + UserName; string FollowPageSource = string.Empty; try { FollowPageSource = objPinUser.globusHttpHelper.postFormData(new Uri(UserUrl), "", Referer, objPinUser.Token, objPinUser.UserAgent); if (FollowPageSource.Contains(">Unfollow</span>")) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " => [ Successfully Follow this User " + UserName + " ]"); return("Followed"); } else if (FollowPageSource.Contains("exceeded the maximum")) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " => [ You have exceeded the maximum rate of users followed " + UserName + " ]"); return("NotFollowed"); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " => [ Follow Process Failed this User " + UserName + " ]"); return("NotFollowed"); } } catch (Exception ex) { }; } catch (Exception ex) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " => [ UnFollow Process Failed For this User " + objPinUser.Username + " ]"); return("NotFollowed"); } return("Followed"); }
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) { Console.Write(ex.Message); } //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); } } 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--; } }
public List<string> GetAllPinsNewCode(ref PinInterestUser objPinUser) { try { foreach (var itemBoardUrls in lstBoardUrlsPin) { try { UserPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(itemBoardUrls), "http://pinterest.com/", string.Empty, objPinUser.UserAgent); } catch (Exception ex) { } if (!string.IsNullOrEmpty(UserPageSource)) { if (UserPageSource.Contains("<a href=")) { string[] arrPin = Regex.Split(UserPageSource, "/pin/"); foreach (var itemPin in arrPin) { if (itemPin.Contains("pinImageWrapper")) { string a = Utils.Utils.getBetween(itemPin, "", "class=").Replace("\\", "").Replace("\"", "").Replace("/", "").Trim(); if (!lstEditPins.Contains(a) && !string.IsNullOrEmpty(a)) { lstEditPins.Add(a); } } } } } } } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } return lstEditPins; }
public void EditPins(ref PinInterestUser objPinUser) { try { List<string> lstOfBoardURLs = GetAllBoardNames_new1(objPinUser.ScreenName, ref objPinUser); foreach (var itemBoardUrl in ClGlobul.lstBoardUrls) { string url = "https://www.pinterest.com" + itemBoardUrl; lstBoardUrlsPin.Add(url); } List<string> lstPinsfromBoards = new List<string>(); foreach (var itemBoardUrl in lstBoardUrlsPin) { string pageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(itemBoardUrl), "", "", objPinUser.UserAgent); if (!string.IsNullOrEmpty(pageSource) && pageSource.Contains("/pin/")) { string data = Utils.Utils.getBetween(pageSource, "/pin/", "class=").Replace("\\", "").Replace("\"", "").Replace("/", ""); if (!string.IsNullOrEmpty(data) && !lstPinsfromBoards.Contains(data)) { lstPinsfromBoards.Add(data); } } } int count = 0; GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Extarcting User Pins For Edit ]"); List<string> lstAllPins = GetAllPinsNewCode(ref objPinUser); Random Pinrnd = new Random(); List<string> lstPins = new List<string>(); try { lstPins = lstAllPins.OrderBy(X => Pinrnd.Next()).ToList(); } catch { }; lstPins.Reverse(); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + lstPins.Count + " Pins From " + objPinUser.Username + " ]"); foreach (string Pin in lstPins) { clsSettingDB DB = new clsSettingDB(); DataTable dt = DB.SelectPinDesc(Pin, objPinUser.Username); if (dt.Rows.Count <= 0) { string pageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("http://pinterest.com/pin/" + Pin + "/edit/"), "", "", objPinUser.UserAgent); string PinDesc = string.Empty; string csrfmiddlewaretoken = string.Empty; string link = string.Empty; string board = string.Empty; try { int startindex = pageSource.IndexOf("description_html"); string start = pageSource.Substring(startindex).Replace("description_html", ""); int endIndex = start.IndexOf(","); //string end = start.Substring(0, endIndex).Replace("\"", "").Replace(":", "").Replace("","+"); string end = Utils.Utils.getBetween(start, "\": \"", "</a>"); PinDesc = end; } catch (Exception ex) { } if (string.IsNullOrEmpty(PinDesc)) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ No Desc In Pin :" + Pin + " ]"); } else { PinCommnet = CommentList[RandomNumberGenerator.GenerateRandom(0, CommentList.Count)]; PinDesc = PinCommnet; try { int startindex = pageSource.IndexOf("\"board_id\":"); string start = pageSource.Substring(startindex).Replace("\"board_id\":", "").Replace("boardRepSubtitle", ""); int endIndex = start.IndexOf(","); string end = start.Substring(0, endIndex); board = end.Replace("\"", "").Replace(">", ""); board = board.Trim(); } catch (Exception ex) { } try { int startindex = pageSource.IndexOf("link\": \"http:"); string start = pageSource.Substring(startindex).Replace("link\":", ""); int endIndex = start.IndexOf(","); string end = start.Substring(0, endIndex).Replace("value=", "").Replace("\"", ""); string Link = Utils.Utils.getBetween(start, "Link=", ""); link = end.Trim().Replace(":", "%3A").Replace("/", "%2F").Replace("?", "%3F").Replace("=", "%3D"); } catch (Exception ex) { } Thread.Sleep(1 * 1000); try { string postdata = "board_id=" + board + "&description=" + PinDesc + "&link=" + link + "&id=" + Pin; #region PostData string pinUrl = "https://www.pinterest.com/pin/" + Pin + "/"; string BoardId = string.Empty; string getPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(pinUrl), "", "", ""); if (getPinPageSource.Contains("\"price_currency\"")) { link = Utils.Utils.getBetween(getPinPageSource, "serving_link\":", ", \"is_promoted").Replace("\"", "").Trim(); link = link.Replace(":", "%3A").Replace("/", "%2F").Replace("?", "%3F").Replace("=", "%3D").Replace("&", "%26"); } if (getPinPageSource.Contains("board")) //("board_id") { // BoardId = Utils.Utils.getBetween(getPinPageSource, "board\", \"id\":", ",").Replace("\"", "").Trim(); BoardId = Utils.Utils.getBetween(getPinPageSource, "board\", \"id\":", "\",").Replace("\"", "").Trim();//"board", "id": } #endregion string postPageSOurce = string.Empty; 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"; postdata = "source_url=%2Fpin%2F" + Pin + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22description%22%3A%22" + PinDesc + "%22%2C%22link%22%3A%22" + link + "%22%2C%22place%22%3A0%2C%22id%22%3A%22" + Pin + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3ECloseup%3EPinActionBar%3EShowModalButton(module%3DPinEdit)%23App%3EModalManager%3EModal(state_isVisible%3Dtrue%2C+showCloseModal%3Dtrue%2C+state_mouseDownInModal%3Dfalse%2C+state_showModalMask%3Dtrue%2C+state_showContainer%3Dfalse%2C+state_showPositionElement%3Dtrue)"; string postUrl = redirectDomain + ".pinterest.com/resource/PinResource/update/"; try { postPageSOurce = objPinUser.globusHttpHelper.postFormDataProxywithCSRFToken(new Uri(postUrl), postdata, newHomePageUrl, "", 0, "", ""); } catch { Thread.Sleep(1 * 1000); postPageSOurce = objPinUser.globusHttpHelper.postFormDataProxywithCSRFToken(new Uri(postUrl), postdata, newHomePageUrl, "", 0, "", "");//"Go0h31yGfnvXLZCw0B06nbmbxnqLj5Wj"); } if (postPageSOurce.Contains(PinDesc)) //PinDesc { try { GlobusFileHelper.AppendStringToTextfileNewLine(Pin + ": Desc -> " + PinDesc, PDGlobals.path_PinDescription); DB.InsertPinDesc(Pin, PinDesc, objPinUser.Username); #region AccountReport // string module = "EditPinDiscription"; // string status = "Edited"; // objQm.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + Pin, "", "", PinDesc, "", "", status, "", "", DateTime.Now); // objEditPinDescriptionDelegate(); #endregion GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + Pin + " >>> " + PinDesc + " for " + objPinUser.Username + " ]"); try { string CSV_Header = "Date" + "," + "UserName" + "," + "Pin Description" + "," + "Pin"; string CSV_Data = System.DateTime.Now.ToString() + "," + objPinUser.Username + "," + PinDesc.Replace(",", "") + "," + Pin; string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "EditPin"); PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\EditPinDescription.csv"); } catch (Exception ex) { } } catch(Exception ex) { } } else { GlobusFileHelper.AppendStringToTextfileNewLine(Pin + ": Not Edited Description", PDGlobals.path_PinDescription); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Description Not Edited " + Pin + ">>>>" + objPinUser.Username + " ]"); } } catch(Exception ex) { }; } int Delay = RandomNumberGenerator.GenerateRandom(minDelayEditPinDisc, maxDelayEditPinDisc); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + Delay + " ]"); Thread.Sleep(Delay * 1000); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Already Edited " + Pin + " From " + objPinUser.Username + " ]"); } if (NoOfPagesEditPinDisc == count) { break; } } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
public void StartEditPinDiscMultiThreaded(object objParameters) { PinInterestUser objPinUser = new PinInterestUser(); try { if (!isStopEditPinDisc) { try { lstThreadsEditPinDisc.Add(Thread.CurrentThread); lstThreadsEditPinDisc.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("[ " + DateTime.Now + " ] => [ 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("[ " + DateTime.Now + " ] => [ Logging UnSuccessfull : " + objPinUser.Username + " ]"); return; } string checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Logged In With : " + objPinUser.Username + " ]"); StartActionMultithreadEditPinDisc(ref objPinUser); } catch { }; } else if(objPinUser.isloggedin == true) { try { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Logged In With : " + objPinUser.Username + " ]"); StartActionMultithreadEditPinDisc(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 (countThreadControllerEditPinDisc > Nothread_EditPinDisc) { lock (EditPinDiscObjThread) { Monitor.Pulse(EditPinDiscObjThread); } EditPinDiscdata_count--; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } countThreadControllerEditPinDisc--; GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------"); } }
public List<string> CategoryPins(string CategoryName, int PageCount, ref PinInterestUser objPinUser) { List<string> lstPopularPins = new List<string>(); try { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Start Getting Popular Pins For this User " + objPinUser.Username + " ]"); string BaseCategoryUrl = "http://pinterest.com/all/?category=" + CategoryName; for (int i = 1; i < PageCount; i++) { string CategoryUrl = "http://pinterest.com/all/?category=" + CategoryName + "&page=" + i; string PopularPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(CategoryUrl), BaseCategoryUrl, string.Empty, objPinUser.UserAgent); List<string> lst = globusRegex.GetHrefUrlTags(PopularPinPageSource); foreach (string item in lst) { if (item.Contains("/pin/") && !item.Contains("edit")) { try { int FirstPinPoint = item.IndexOf("/pin/"); int SecondPinPoint = item.IndexOf("class="); string PinUrl = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\"", string.Empty).Replace("pin", string.Empty).Replace("/", string.Empty).Trim(); lstPopularPins.Add(PinUrl); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } } } } lstPopularPins = lstPopularPins.Distinct().ToList(); lstPopularPins.Reverse(); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total Pin Urls Collected " + lstPopularPins.Count + " ]"); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } return lstPopularPins; }
public List<string> PopularPins(int PageCount, ref PinInterestUser objPinUser) { List<string> lstPopularPins = new List<string>(); string Name = string.Empty; string PopularPinPageSource = string.Empty; try { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Start Getting Popular Pins For this User " + objPinUser.Username + " ]"); string bookmark = string.Empty; for (int i = 0; i < PageCount; i++) { string LikeUrl = string.Empty; if (i == 0) LikeUrl = "http://pinterest.com/popular/"; else LikeUrl = "http://pinterest.com/resource/CategoryFeedResource/get/?source_url=%2Fpopular%2F&data=%7B%22options%22%3A%7B%22feed%22%3A%22popular%22%2C%22bookmarks%22%3A%5B%22" + Uri.EscapeDataString(bookmark) + "%22%5D%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%2C%22show_via%22%3Afalse%7D%2C%22layout%22%3A%22variable_height%22%7D%7D%2C%22append%22%3Atrue%2C%22error_strategy%22%3A" + i + "%7D&module_path=App()%3EHeader()%3EDropdownButton()%3EDropdown()%3ECategoriesMenu(resource%3D%5Bobject+Object%5D%2C+name%3DCategoriesMenu%2C+resource%3DCategoriesResource(browsable%3Dtrue))&_=" + DateTime.Now.Ticks; try { PopularPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri(LikeUrl), "http://pinterest.com/", string.Empty, 80, "", "", objPinUser.UserAgent); } catch (Exception ex) { PopularPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri(LikeUrl), objPinUser.ProxyAddress, Convert.ToInt32(objPinUser.ProxyPort), objPinUser.ProxyUsername, objPinUser.ProxyPassword); } ///get bookmarks value from page /// if (PopularPinPageSource.Contains("bookmarks")) { string[] bookmarksDataArr = System.Text.RegularExpressions.Regex.Split(PopularPinPageSource, "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(PopularPinPageSource, "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("uid\": \"Pin-"))// && item.Contains("/repins/")) { //templst.Add(item); 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 (!lstPopularPins.Any(pid => pid == Pinid)) { lstPopularPins.Add(Pinid); } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } } } lstPopularPins = lstPopularPins.Distinct().ToList(); lstPopularPins.Reverse(); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total Pin Urls Collected " + lstPopularPins.Count + " ]"); } } catch (Exception ex) { GlobusLogHelper.log.Error(" => Error : " + ex.StackTrace); } return lstPopularPins; }
public void StartActionMultithreadAddUserToBoard(ref PinInterestUser objPinUser) { try { try { lstThreadsAddUserToBoard.Add(Thread.CurrentThread); lstThreadsAddUserToBoard.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; string UserName = string.Empty; foreach (string item_lstAddToBoardUserNames in ClGlobul.lstAddToBoardUserNames) { string[] array1 = Regex.Split(item_lstAddToBoardUserNames, ":"); try { if (array1.Length == 3) { if (array1[0] == objPinUser.Niches) { try { UserName = array1[2]; if (!UserName.Contains("@")) { string IsFollowed = Follow(ref objPinUser, array1[2]); } bool IsAdded = AddUserToBoard(array1[1], array1[2], ref objPinUser); // if (IsAdded == true) // { // counter++; // } // Thread.Sleep(1 * 1000); // if (counter == PerUserBoard) // { // break; // } } catch (Exception ex) { Console.Write(ex.Message); } } } } catch (Exception ex) { //GlobusLogHelper.log.Info("Add To Board Failed For This UserName " + UserName); Console.Write(ex.Message); } int DelayTime = RandomNumberGenerator.GenerateRandom(minDelayAddUserToBoard, maxDelayAddUserToBoard); GlobusLogHelper.log.Info("[ " + DateTime.Now + "=> [ Delay For " + DelayTime + " Seconds ]"); Thread.Sleep(DelayTime); } } catch (Exception ex) { Console.Write(ex.Message); } finally { try { countThreadControllerAddUserToBoard--; if (countThreadControllerAddUserToBoard > Nothread_AddUserToBoard) { lock (AddUserToBoardObjThread) { Monitor.Pulse(AddUserToBoardObjThread); } AddUserToBoarddata_count--; } } catch (Exception ex) { //GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } GlobusLogHelper.log.Info("[ " + DateTime.Now + " => [ ADDING USER TO BOARD PROCESS COMPLETED ]"); GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------"); } }
public void StartRePinMultiThreaded(object objParameters) { PinInterestUser objPinUser = new PinInterestUser(); try { if (!isStopRePin) { try { lstThreadsRePin.Add(Thread.CurrentThread); lstThreadsRePin.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; try { Array paramsArray = new object[1]; paramsArray = (Array)objParameters; objPinUser = (PinInterestUser)paramsArray.GetValue(0); try { if (chkDivideData_RePin == true) { list_lstTargetRePin_item = list_lstTargetRePin[LstCounter]; } else { list_lstTargetRePin_item = ClGlobul.lstRepinUrl; } } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } #region Login if (!objPinUser.isloggedin) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ 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("[ " + DateTime.Now + "] => [ Logging UnSuccessfull : " + objPinUser.Username + " ]"); return; } string checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); } catch { }; } if (objPinUser.isloggedin == true) { try { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Logged In With : " + objPinUser.Username + " ]"); StartActionMultithreadRePin(ref objPinUser, list_lstTargetRePin_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); } }
public bool RepinwithMessage(string PinId, string myMessage, string Board, string NumberOfPage, ref PinInterestUser objPinUser) { try { string getPinPageSource = string.Empty; string pinUrl = string.Empty; string url = "https://www.pinterest.com/pin/" + PinId; string CheckPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(url), "", string.Empty, ""); if (!CheckPinPageSource.Contains("<div>Something went wrong!</div>") && !CheckPinPageSource.Contains("<div>Sorry. We've let our engineers know.</div>") && !CheckPinPageSource.Contains("<div>Whoops! We couldn't find that page.</div>") && !CheckPinPageSource.Contains("<div class=\"suggestionText\">How about these instead?</div>")) { pinUrl = "https://www.pinterest.com/pin/" + PinId + "/"; } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Pin " + PinId + " Is InCorrect ]"); } try { if (!string.IsNullOrEmpty(Globals.ItemSelect)) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + "In" + Globals.ItemSelect + " ]"); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " ]"); } } catch { }; try { GlobusHttpHelper objhttp = new GlobusHttpHelper(); getPinPageSource = objhttp.getHtmlfromUrl(new Uri(pinUrl), "", "", ""); } catch { }; string description = string.Empty; string link = string.Empty; string boardId = string.Empty; string RepinPagesource = string.Empty; string appVersion = string.Empty; try { if (getPinPageSource.Contains("description_html")) { description = Utils.Utils.getBetween(getPinPageSource, "description_html\":", ", \"title\":").Replace("\"", "").Replace("&", "%26").Trim(); description = description.Replace(" ", "+").Replace(",", "%2C").Replace("amp;", ""); } if (getPinPageSource.Contains("serving_link")) { link = Utils.Utils.getBetween(getPinPageSource, "serving_link\":", ", \"is_promoted").Replace("\"", "").Trim(); link = link.Replace(":", "%3A").Replace("/", "%2F").Replace("?", "%3F").Replace("=", "%3D").Replace("&", "%26"); } if (getPinPageSource.Contains("board_id")) { try { if (string.IsNullOrEmpty(Board)) { Random rnd = new Random(); int BoardNum = rnd.Next(0, objPinUser.Boards.Count - 1); boardId = objPinUser.Boards[BoardNum]; } else { boardId = Board; } if (string.IsNullOrEmpty(boardId.ToString())) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [Board is not present in your account , can't repin]"); return false; } } catch (Exception) { } } else if (getPinPageSource.Contains("board")) { boardId = Board; } lock (Lock_RepinonBoard) { string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); if (Checking.Contains("profileName")) { if (Checking.Contains("profileName")) { appVersion = Utils.Utils.getBetween(Checking, "\"app_version\": \"", "\", \""); } } else { ObjAccountManager.LoginPinterestAccount(ref objPinUser); } string RedirectUrl = GlobusHttpHelper.valueURl.Split('.')[0]; string newHomePage = RedirectUrl + ".pinterest.com"; string linkurl = string.Empty; string RepinpostData = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22pin_id%22%3A%22" + PinId + "%22%2C%22description%22%3A%22" + myMessage + "%22%2C%22link%22%3A%22" + link + "%22%2C%22is_video%22%3Afalse%2C%22board_id%22%3A%22" + Board + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=Modal()%3EPinCreate3(resource%3DPinResource(id%3D" + PinId + "))%3EBoardPicker(resource%3DBoardPickerBoardsResource(filter%3Dall))%3ESelectList(view_type%3DpinCreate3%2C+selected_section_index%3Dundefined%2C+selected_item_index%3Dundefined%2C+highlight_matched_text%3Dtrue%2C+suppress_hover_events%3Dundefined%2C+item_module%3D%5Bobject+Object%5D)"; string PostPageUrl = RedirectUrl + ".pinterest.com/resource/RepinResource/create/"; try { RepinPagesource = objPinUser.globusHttpHelper.postFormDataProxyREPin(new Uri(PostPageUrl), RepinpostData, newHomePage, objPinUser.App_version); } catch (Exception ex) { } if (string.IsNullOrEmpty(RepinPagesource)) { try { if (getPinPageSource.Contains("class=\"sourceFlagWrapper")) { try { BaseLib.GlobusRegex rgx = new GlobusRegex(); string urldata = System.Text.RegularExpressions.Regex.Split(System.Text.RegularExpressions.Regex.Split(getPinPageSource, "sourceFlagWrapper")[1], "</a>")[0]; linkurl = rgx.GetHrefUrlTag(urldata).Replace("href=\"", string.Empty); } catch (Exception ex) { } } else if (string.IsNullOrEmpty(linkurl)) { try { string urldata = System.Text.RegularExpressions.Regex.Split(System.Text.RegularExpressions.Regex.Split(getPinPageSource, "sourceFlagWrapper")[1], "</a>")[0]; string Datavalue = urldata.Substring(urldata.IndexOf("href=\\\"")); int startindex = Datavalue.IndexOf("href=\\\""); string start = Datavalue.Substring(startindex).Replace("href=\\\"", ""); int endindex = start.IndexOf("\\\""); string end = start.Substring(0, endindex); linkurl = end;// Datavalue.Substring(0, Datavalue.IndexOf("\\\">")).Replace("\\", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("href=\"", string.Empty); } catch { }; } try { string postdata1 = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + Board + "%22%2C%22description%22%3A%22" + myMessage + "%22%2C%22link%22%3A%22" + Uri.EscapeDataString(linkurl) + "%22%2C%22is_video%22%3Afalse%2C%22pin_id%22%3A%22" + PinId + "%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22" + objPinUser.App_version + "%22%2C%22https_exp%22%3Afalse%7D%7D&module_path=App()%3ECloseup(resource%3DPinResource(id%3D" + PinId + "))%3EPinActionBar(resource%3DPinResource(id%3D" + PinId + "))%3EShowModalButton(module%3DPinCreate)%23Modal(module%3DPinCreate(resource%3DPinResource(id%3D" + PinId + ")))"; string afterposting = objPinUser.globusHttpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/RepinResource/create/"), postdata1, "http://www.pinterest.com/pin/" + PinId + "/", "", 0, "", ""); if (!afterposting.Contains("<div>Uh oh! Something went wrong.")) { return true; } return false; } catch (Exception ex) { }; } catch (Exception ex) { } } if (!string.IsNullOrEmpty(RepinPagesource)) { try { if (!string.IsNullOrEmpty(Globals.ItemSelect)) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " In " + Globals.ItemSelect + " is Done. ]"); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " is Done. ]"); } } catch { }; return true; } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " is Failed. ]"); return false; } } } catch { }; return false; } catch (Exception Ex) { return false; } }
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 bool AddUserToBoard(string BoardName, string UserName, ref PinInterestUser pinterestAccountManager) { try { GlobusLogHelper.log.Info("[ " + DateTime.Now + " => [ Start Adding " + UserName + " to " + BoardName + " ]"); string checklogin = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); string redirectDomain = GlobusHttpHelper.valueURl.Split('.')[0]; string newHomePageUrl = redirectDomain + "." + "pinterest.com"; string screen_Name = pinterestAccountManager.ScreenName; //ObjAccountManager.Getscreen_Name(ref pinterestAccountManager); pinterestAccountManager.globusHttpHelper = new GlobusHttpHelper(); BoardName = BoardName.Replace(" ", "-"); string AfterInvitePageSourceData = string.Empty; string userid = string.Empty; if (BoardName.Contains("pinterest.com")) { BoardName = BoardName.Replace("https://pinterest.com/", string.Empty).Replace(pinterestAccountManager.Name, string.Empty).Trim('/'); } string BoardUrl = "https://pinterest.com/" + pinterestAccountManager.ScreenName + "/" + BoardName + "/"; string SettingsUrl = BoardUrl + "settings/"; string Collabrator = BoardUrl; string InvitePostData1 = "collaborator_name=&collaborator_username="******"-", "+"); string invited_userid = string.Empty; string invited = "https://pinterest.com/" + UserName.Replace(" ", "").Replace("%20", ""); string pagesourceinvited = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(invited)); try { invited_userid = Utils.Utils.getBetween(pagesourceinvited, "options\": {\"user_id\"", "}"); invited_userid = Utils.Utils.getBetween(invited_userid, "\"", "\""); } catch { }; string MainPageSource = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(BoardUrl), "https://pinterest.com/", string.Empty, pinterestAccountManager.UserAgent); try { int startindex = MainPageSource.IndexOf("\"user_id\":"); string start = MainPageSource.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 screen_Name = ObjAccountManager.Getscreen_Name(ref pinterestAccountManager); string BoardId = Utils.Utils.getBetween(MainPageSource, "board\", \"id", ",").Replace("\"", "").Replace(":", "").Trim(); string InviteToBoardPostData = string.Empty; // if (ObjAccountManager.LoginPinterestAccount(ref pinterestAccountManager)) if (objAccountManager.LoginPinterestAccount(ref pinterestAccountManager)) { string Url = "https://www.pinterest.com/resource/BoardInviteResource/get/?source_url=%2F" + screen_Name + "%2Fhealth%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22invited_user_id%22%3A%22" + invited_userid + "%22%2C%22field_set_key%22%3A%22boardEdit%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=Modal()%3EBoardCollaboratorInviter(resource%3DBoardResource(board_id%3D" + BoardId + "))%3EBoardInviteForm()%3ESocialTypeaheadField()%3ETypeahead(bypass_maxheight%3Dtrue%2C+tags%3Dpinners_and_contacts%2C+template%3Duser_circle_avatar%2C+view_type%3DuserCircleSelect)&_=1431320928412"; string getResponce = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(Url)); if (UserName.Contains("@")) { UserName = UserName.Replace("@", "%40"); //InviteToBoardPostData = "source_url=%2F" + screen_Name + "%2F" + BoardName + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22emails%22%3A%5B%22" + UserName + "%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EBoardPage%3EBoardHeader%3EBoardInfoBar%3EShowModalButton(module%3DBoardCollaboratorInviter)%23App%3EModalManager%3EModal()"; InviteToBoardPostData = "source_url=%2F" + screen_Name + "%2Fas%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22emails%22%3A%5B%22" + UserName + "%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EModalManager%3EModal%3EBoardCollaboratorInviter%3EBoardInviteForm%3EButton(class_name%3DinviteButton%2C+text%3DInvite%2C+color%3Ddefault%2C+state_badgeValue%3D%22%22%2C+state_accessibilityText%3D%22%22%2C+state_disabled%3Dundefined)"; try { string postInviteEmail = redirectDomain + ".pinterest.com/resource/BoardEmailInviteResource/create/"; AfterInvitePageSourceData = pinterestAccountManager.globusHttpHelper.postFormDataProxyPin(new Uri(postInviteEmail), InviteToBoardPostData, newHomePageUrl); } catch (Exception ex) { }; } else { InviteToBoardPostData = "source_url=%2F" + screen_Name + "%2F" + BoardName + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22invited_user_id%22%3A%22" + invited_userid + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EBoardPage%3EBoardHeader%3EBoardInfoBar%3EShowModalButton(module%3DBoardCollaboratorInviter)%23App%3EModalManager%3EModal(state_isVisible%3Dtrue%2C+showCloseModal%3Dtrue%2C+state_mouseDownInModal%3Dtrue%2C+state_showModalMask%3Dtrue%2C+state_showContainer%3Dfalse%2C+state_showPositionElement%3Dtrue)"; try { string postUrlInviteBoard = redirectDomain + ".pinterest.com/resource/BoardInviteResource/create/"; AfterInvitePageSourceData = pinterestAccountManager.globusHttpHelper.postFormDataProxyPin(new Uri(postUrlInviteBoard), InviteToBoardPostData, newHomePageUrl); } catch (Exception ex) { }; } if (!string.IsNullOrEmpty(AfterInvitePageSourceData)) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " => [ Invitation sent to " + UserName + " for Board " + BoardName + " ]"); return(true); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " => [ Not Added to Board " + BoardName + " ]"); return(true); } } else { } } catch (Exception ex) { //GlobusLogHelper.log.Info(" => [ " + UserName + " Not Added to Board " + BoardName + " ]"); Console.Write(ex.Message); return(true); } return(false); }
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 StartActionMultithreadRePin(ref PinInterestUser objPinUserRepin, List<string> Usercount) { try { try { lstThreadsRePin.Add(Thread.CurrentThread); lstThreadsRePin.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; PinInterestUser objPinUser = (PinInterestUser)objPinUserRepin; string screen_Name = objPinUser.ScreenName; clsSettingDB db = new clsSettingDB(); if (ObjAccountManager.Boards.Count <= 0) { try { GetBoardsForRepinUpdated(ref objPinUser, screen_Name); //new Thread(() => GetBoardsForRepinUpdated(ref objPinUser, screen_Name)).Start(); // Not returning only Board but Pics also //GetBoardsForRepinUpdated(ref objPinUser, screen_Name); } catch (Exception Ex) { } } if (objPinUser.Boards.Count > 0 || objPinUser.Boards.Count == 0) { Random Boardrnd = new Random(); int BoardNum = 0; try { BoardNum = Boardrnd.Next(0, objPinUser.Boards.Count - 1); } catch (Exception ex) { // GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 1--> " + ex.Message, ApplicationData.ErrorLogFile); } string BoardNumber = string.Empty; try { BoardNum = Boardrnd.Next(0, objPinUser.Boards.Count - 1); BoardNumber = objPinUser.Boards[BoardNum]; } catch (Exception ex) { //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 1--> " + ex.Message, ApplicationData.ErrorLogFile); } int RepinCount = 0; if (!rdbUsePinNo) { try { if (rdbRepinNormalType == true) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Getting Normal Pins From Account ]"); lstAllPins = objLikeManager.GetPins(ref objPinUser, maxNoOfRePinCount); Random Pinrnd = new Random(); ClGlobul.lstPins = lstAllPins.OrderBy(x => Pinrnd.Next()).ToList(); } else { try { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Getting Random Users Pins From Account ]"); string userName = objPinUser.ScreenName; userName = screen_Name; //lstFollowings = objScrape.GetUserFollowing_new(userName, 1, maxNoOfRePinCount);//GetUserFollowing lstFollowings = GetUserFollowing(userName, 1, maxNoOfRePinCount); foreach (string FollowName in lstFollowings) { try { Random rnd = new Random(); int FollowingNum = rnd.Next(0, lstFollowings.Count - 1); FollowingName = lstFollowings[FollowingNum]; ClGlobul.lstPins.Clear(); List<string> lstRepinPin = UserPins_Repin(FollowingName, ref objPinUser); ClGlobul.lstPins.AddRange(lstRepinPin); ClGlobul.lstPins = ClGlobul.lstPins.Distinct().ToList(); if (maxNoOfRePinCount < ClGlobul.lstPins.Count) { break; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } // ClGlobul.lstPins = UserPins_Repin(FollowingName, ref objPinUser); //ClGlobul.lstPins = objLikeManager.GetPins(ref objPinUser, maxNoOfRePinCount); //checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } string Message = string.Empty; string[] lstPinsArray = ClGlobul.lstPins.ToArray(); foreach (string Pin in lstPinsArray) { try { if (NumberHelper.ValidateNumber(Pin)) { try { if (maxNoOfRePinCount == RepinCount) { break; } if (maxNoOfRePinCount >= RepinCount) { Random Messagernd = new Random(); int MessageNum = 0; if (ClGlobul.RepinMessagesList.Count == 2) { try { foreach (var itemMsg in ClGlobul.RepinMessagesList) { if (Message == itemMsg) { continue; } else { Message = itemMsg; break; } } GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Message :" + Message + " ]"); } catch (Exception ex) { } } else if (ClGlobul.RepinMessagesList.Count > 0) { try { MessageNum = Messagernd.Next(0, ClGlobul.RepinMessagesList.Count - 1); Message = ClGlobul.RepinMessagesList[MessageNum].Trim(); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Message :" + Message + " ]"); } catch (Exception ex) { //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 2--> " + ex.Message, ApplicationData.ErrorLogFile); } } try { string NoOfPages = "0";//No use as far as I know try { int index = ClGlobul.lstPins.Where(x => x == Pin).Select(x => ClGlobul.lstPins.IndexOf(x)).Single<int>(); NoOfPages = Convert.ToString(index / 25); } catch { } try { Random rndBoard = new Random(); int NumBoard = rndBoard.Next(0, objPinUser.Boards.Count - 1); BoardNumber = objPinUser.Boards[NumBoard]; } catch (Exception ex) { } string Url = "https://www.pinterest.com/" + objPinUser.ScreenName; if (string.IsNullOrEmpty(oneTimePagesource)) { try { GlobusHttpHelper objHttp = new GlobusHttpHelper(); oneTimePagesource = objHttp.getHtmlfromUrl(new Uri(Url), "", "", ""); } catch { }; } if (arrBoardName == null) { try { arrBoardName = Regex.Split(oneTimePagesource, "board\", \"id\""); } catch { }; } foreach (var itemBoardName in arrBoardName) { try { if (itemBoardName.Contains(BoardNumber))//&&itemBoardName.Contains("board\", \"id\"")) { BoardName = Utils.Utils.getBetween(itemBoardName, "name", "}").Replace(":", "").Replace("\"", "").Trim(); } } catch (Exception ex) { } } BoardName = BoardName.Replace(" ", "-").ToLower().Replace("(", "").Replace(")", "").Replace("!", "").Trim(); bool IsRePined = RepinwithMessage(Pin, Message, BoardNumber, NoOfPages, ref objPinUser); if (IsRePined) { #region AccountReport // string module = "RePin"; // string status = "Repined"; // Qm.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + Pin, "", "", Message, "", "", status, "", "", DateTime.Now); // objRepinDelegate(); #endregion db.insertRePinRecord(objPinUser.Username, objPinUser.Niches, Pin); RepinCount++; try { string CSV_Header = "UserName" + "," + "Pin" + "," + "Message" + "," + "Board Number" + "," + "BoardUrl" + "," + "Date"; string CSV_Data = objPinUser.Username + "," + "https://www.pinterest.com/pin/" + Pin + "," + Message + "," + "Board No. : " + BoardNumber + "," + Url + "/" + BoardName + "," + System.DateTime.Now.ToString(); string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Repin"); PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\Repin.csv"); } catch (Exception ex) { } } else { RepinCount++; } if (rdbDivideGivenByUser_RePin == true) { CountGivenByUser_RePin--; if (CountGivenByUser_RePin < 0) { break; } } int delay = RandomNumberGenerator.GenerateRandom(minDelayRePin, maxDelayRePin); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Delay For " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } catch (Exception ex) { //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 3--> " + ex.Message, ApplicationData.ErrorLogFile); } } } catch (Exception ex) { // GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 4--> " + ex.Message, ApplicationData.ErrorLogFile); } } } catch (Exception ex) { } } } catch (Exception ex) { } } else if (rdbUsePinNo == true) { try { if (ClGlobul.lstRepinUrl.Count < maxNoOfRePinCount) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [Repin Count can't be greater than uploaded Pins.]"); return; } GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining Uploaded Pins ]"); int RepinCount_ListRepin_New = maxNoOfRePinCount; foreach (string RepinUrl in Usercount) { try { if (RepinCount_ListRepin_New <= 0) { break; } //} } catch { }; string NoOfPages = "0"; try { int index = ClGlobul.lstRepinUrl.Where(x => x == RepinUrl).Select(x => ClGlobul.lstRepinUrl.IndexOf(x)).Single<int>(); NoOfPages = Convert.ToString(index / 25); } catch { }; string Message = string.Empty; if (ClGlobul.RepinMessagesList.Count > 1) { Message = ClGlobul.RepinMessagesList[RandomNumberGenerator.GenerateRandom(0, ClGlobul.RepinMessagesList.Count - 1)]; } else if (ClGlobul.RepinMessagesList.Count == 1) { Message = ClGlobul.RepinMessagesList[0]; } else { Message = ""; } Thread.Sleep(1000); bool IsRepinned = RepinwithMessage(RepinUrl.Replace(" ", ""), Message, BoardNumber, NoOfPages, ref objPinUser); if (IsRepinned) { #region AccountReport // string module = "RePin"; // string status = "Repined"; // Qm.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + RepinUrl, "", "", Message, "", "", status, "", "", DateTime.Now); // objRepinDelegate(); #endregion GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repin Pin : " + RepinUrl + " ]"); db.insertRePinRecord(objPinUser.Username, objPinUser.Niches, RepinUrl); RepinCount++; RepinCount_ListRepin_New--; try { string CSV_Header = "UserName" + "," + "RepinUrl" + "," + "Message" + "," + "Board Number" + "," + "Date"; string CSV_Data = objPinUser.Username + "," + "https://www.pinterest.com/pin/" + RepinUrl + "," + Message + "," + "Board No. : " + BoardNumber + "," + System.DateTime.Now.ToString(); string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Repin"); PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\UsePin.csv"); } catch (Exception ex) { } } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Not Repin Pin : " + RepinUrl + " ]"); } int Delay = RandomNumberGenerator.GenerateRandom(minDelayRePin, maxDelayRePin); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Delay for " + Delay + " Seconds ]"); Thread.Sleep(Delay * 1000); } } catch (Exception ex) { }; } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ No Boards Found in Account :" + objPinUser.Username + " ]"); } } } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } finally { RePindata_count--; try { if (countThreadControllerRePin >= NoOfThreadsRePin) { lock (RePinObjThread) { Monitor.Pulse(RePinObjThread); } } } catch (Exception Ex) { } countThreadControllerRePin--; if (RePindata_count == 0 || CountGivenByUser_RePin < 0) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ PROCESS COMPLETED ]"); GlobusLogHelper.log.Info("-------------------------------------------------------------------------------------"); } } }
private void LoadAccUsingThreadPool(object Acc) { try { if (lstUploadAccount.Count > 0) { PDGlobals.loadedAccountsDictionary.Clear(); PDGlobals.listAccounts.Clear(); } if (Globals.IsBasicVersion) { try { string selectQuery = "select count(UserName) from tb_emails"; DataSet DS = DataBaseHandler.SelectQueryNew(selectQuery, "tb_emails"); int countLoadedAccounts = Convert.ToInt32(DS.Tables[0].Rows[0].ItemArray[0].ToString()); if (countLoadedAccounts >= 5) { AccounLoad(); MessageDialog md = new MessageDialog (this, DialogFlags.Modal, MessageType.Info, ButtonsType.Close, "You Are Using PD Basic Version 5 Accounts allready loaded.."); ResponseType response = (ResponseType)md.Run (); md.Destroy (); //MessageBox.Show("You Are Using PD Basic Version 5 Accounts allready loaded.."); return; } else { int RemainingAccount = 5 - countLoadedAccounts; lstUploadAccount.RemoveRange(RemainingAccount, lstUploadAccount.Count - RemainingAccount); } } catch { } } if (Globals.IsProVersion) { try { string selectQuery = "select count(UserName) from tb_emails"; DataSet DS = DataBaseHandler.SelectQueryNew(selectQuery, "tb_emails"); int countLoadedAccounts = Convert.ToInt32(DS.Tables[0].Rows[0].ItemArray[0].ToString()); if (countLoadedAccounts >= 15) { AccounLoad(); MessageDialog md = new MessageDialog (this, DialogFlags.Modal, MessageType.Info, ButtonsType.Close, "You Are Using PD Pro Version 15 Accounts allready loaded.."); ResponseType response = (ResponseType)md.Run (); md.Destroy (); return; //MessageBox.Show("You Are Using PD Pro Version 15 Accounts allready loaded.."); } else { int RemainingAccount = 15 - countLoadedAccounts; lstUploadAccount.RemoveRange(RemainingAccount, lstUploadAccount.Count - RemainingAccount); } } catch { } } Array paramArray = new Gtk.Object[0]; paramArray = (Array)Acc; string account = Convert.ToString (((object[])(paramArray)) [0]); string accountUser = account.Split(':')[0]; string accountPass = account.Split(':')[1]; string niches = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; string Followers = string.Empty; string Following = string.Empty; string BoardsName = string.Empty; string ScreenName = string.Empty; string LoginStatus = string.Empty; int DataCount = account.Split(':').Length; if (DataCount == 3) { niches = account.Split(':')[2]; } else if (DataCount == 5) { niches = account.Split(':')[2]; proxyAddress = account.Split(':')[3]; proxyPort = account.Split(':')[4]; } else if (DataCount == 7) { niches = account.Split(':')[2]; proxyAddress = account.Split(':')[3]; proxyPort = account.Split(':')[4]; proxyUserName = account.Split(':')[5]; proxyPassword = account.Split(':')[6]; } LoginStatus = "NotChecked"; try { QM.AddAccountInDataBase(accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, LoginStatus); } catch(Exception ex) {} //DataBaseHandler.InsertQuery("INSERT INTO tb_emails (Username, Password, Niches, proxyAddress, proxyPort, proxyUsername, proxyPassword, UserAgent, Follower, Following , BOARDS, BoardsName, ScreenName, LoginStatus) VALUES ('" + accountUser + "','" + accountPass + "', '" + niches + "' ,'" + proxyAddress + "','" + proxyPort + "', '" + proxyUserName + "','" + proxyPassword + "','" + " " + "','" + " " + "','" + " " + "','" + " ," + "','" + "," + "," + " " + "','" + ScreenName + "','" + LoginStatus + "' )","tb_emails"); try { PinInterestUser objPinUser = new PinInterestUser (); objPinUser.Username = accountUser; objPinUser.Password = accountPass; objPinUser.Niches = niches; objPinUser.ProxyAddress = proxyAddress; objPinUser.ProxyPort = proxyPort; objPinUser.ProxyUsername = proxyUserName; objPinUser.ProxyPassword = proxyPassword; objPinUser.BoardsName = BoardsName; objPinUser.ScreenName = ScreenName; objPinUser.LoginStatus = LoginStatus; try { //PDGlobals.loadedAccountsDictionary.Add(objPinUser.Username, objPinUser); PDGlobals.listAccounts.Add(objPinUser.Username + ":" + objPinUser.Password + ":" + objPinUser.Niches + ":" + objPinUser.ProxyAddress + ":" + objPinUser.ProxyPort + ":" + objPinUser.ProxyUsername + ":" + objPinUser.ProxyPassword); //AddDataInGridView (accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, Followers, Following, LoginStatus); } catch (Exception ex) { Console.Write (ex.Message); } //Addtologger(objFacebookAccountManager.username + ":"+ objFacebookAccountManager.password); } catch (Exception ex) { Console.Write (ex.Message); } } catch(Exception ex) { Console.Write (ex.Message); } finally { countAccountUploaded--; if (countAccountUploaded == 0) { Addtologger ("Account Uploaded process complete"); } } }
public void GetBoardsForRepinUpdated(ref PinInterestUser objPinUser, string Username) { try { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Start Getting Boards For User " + Username + " ]"); try { if (string.IsNullOrEmpty(Globals.ItemSelect)) { UserUrl = "http://pinterest.com/" + Username; } else { UserUrl = "http://pinterest.com/" + Username + "/" + Globals.ItemSelect; } GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); string aa = objGlobusHttpHelper.getHtmlfromUrl(new Uri(UserUrl), "", "", objPinUser.UserAgent); string[] Items = Regex.Split(aa, Username); Items = Items.Skip(1).ToArray(); foreach (string item in Items) { try { if (item.Contains("board_id")) { string[] Data = System.Text.RegularExpressions.Regex.Split(item, "board_id");//{"board_id": foreach (string Dataitem in Data) { try { if (Dataitem.Contains("-end-")) { continue; } if (Dataitem.Contains("_1399706961_75.jpg")) { continue; } if (Dataitem.Contains("board_name") || Dataitem.Contains("name\": \"Board") || Dataitem.Contains("anchored\": true")) //"board_name": { try { int LastPoint = Dataitem.IndexOf("board_name");//board_name //Board if (LastPoint <= 0) { LastPoint = Dataitem.IndexOf(","); ac = Dataitem.Substring(0, LastPoint).Replace("\": \"", string.Empty).Replace("\"", "").Replace(", ", string.Empty).Replace("field_set_keygrid_item}}name", string.Empty).Trim(); } else { ac = Dataitem.Substring(0, LastPoint).Replace("\": \"", string.Empty).Replace("\"", "").Replace(", ", string.Empty).Replace("field_set_keygrid_item}}name", string.Empty).Trim(); } if (!objPinUser.Boards.Contains(ac)) { //I have to validate here so that only BoardId gets through if (NumberHelper.ValidateNumber(ac)) { objPinUser.Boards.Add(ac); } } } catch (Exception ex) { } } } catch(Exception ex) { }; }//end of Foreach loop } } catch (Exception ex) { } } objPinUser.Boards.Count(); //objPinUser.Boards.AddRange(Boards); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Get All Boards for User " + objPinUser.Name + " ]"); } catch (Exception ex) { }; } catch (Exception ex) { GlobusLogHelper.log.Error(" => [ Boards Getting Process Failed ]"); } }
public bool Comment_new(ref PinInterestUser objPinUser, string PinId, string Message) { try { string full_name = string.Empty; string img = string.Empty; string CommentPagesource = string.Empty; string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); if (Checking.Contains("true, \"full_name\":")) { full_name = Utils.Utils.getBetween(Checking, "true, \"full_name\": \"", "\", \""); } if (Checking.Contains("profileName")) { } else { ObjAccountManager.LoginPinterestAccount(ref objPinUser); } string redirectDomain = GlobusHttpHelper.valueURl.Split('.')[0]; string newHomePageUrl = redirectDomain + "." + "pinterest.com"; Thread.Sleep(10 * 1000); string CommentPostData = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22pin_id%22%3A%22" + PinId + "%22%2C%22text%22%3A%22" + (Message.Replace(" ", "+")) + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3ECloseup%3ECloseupContent%3EPin%3EPinCommentsPage%3EPinDescriptionComment(username%3D" + objPinUser.ScreenName + "%2C+show_comment_form%3Dtrue%2C+subtitle%3DThat's+you!%2C+view_type%3Ddetailed%2C+pin_id%3D" + PinId + "%2C+is_description%3Dfalse%2C+content%3Dnull%2C+full_name%3D" + full_name.Replace(" ", "+") + "%2C+image_src%3Dhttps%3A%2F%2Fs-media-cache-ak0.pinimg.com%2Favatars%2F" + objPinUser.ScreenName + ")"; try { string PostComment = redirectDomain + ".pinterest.com/resource/PinCommentResource/create/"; CommentPagesource = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri(PostComment), CommentPostData, newHomePageUrl); } catch { }; string Checking1 = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(newHomePageUrl)); if (CommentPagesource.Contains(" Turn on Javascript ")) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Please Turn on the JavaScript "); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Comment Process Failed For this User " + objPinUser.Username + " ]"); return false; } else if(!CommentPagesource.Contains("<div>Something went wrong!</div>")) { try { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Successfully Commented On Url http://pinterest.com/pin/" + PinId + " From " + objPinUser.Username + " ]"); } catch (Exception) { } if (CommentPagesource.Contains("comment\", \"id\":")) { string CommentId = Utils.Utils.getBetween(CommentPagesource, "comment\", \"id\":", "}").Replace("\"", "").Trim(); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Comment Id : " + CommentId + " ]"); } return true; } } catch (Exception ex) { GlobusLogHelper.log.Debug(" Debug : " + ex.StackTrace); } return false; }
public List<string> UserPins_Repin(string UserName, ref PinInterestUser objPinUser) { List<string> lstUsernamePin = new List<string>(); try { GlobusRegex objGlobusRegex = new GlobusRegex(); GlobusHttpHelper objglobusHttpHelper = new GlobusHttpHelper(); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Start Getting Pins For this User " + UserName + " ]"); string UserPins = string.Empty; if (UserName.Contains("pinterest.com")) { UserUrl = UserName; UserPins = UserName + "pins/"; } else { UserUrl = "https://pinterest.com/" + UserName + "/"; UserPins = "https://pinterest.com/" + UserName + "/pins/"; } try { UserPageSource = objglobusHttpHelper.getHtmlfromUrl(new Uri(UserUrl), "http://pinterest.com/", string.Empty, objPinUser.UserAgent); UserPinPageSource = objglobusHttpHelper.getHtmlfromUrl(new Uri(UserPins), UserUrl, string.Empty, objPinUser.UserAgent); } catch (Exception ex) { } List<string> lst = objGlobusRegex.GetHrefUrlTagsForPinDescription(UserPinPageSource); lst = lst.Distinct().ToList(); string PinUrl = string.Empty; foreach (string item in lst) { try { if (item.Contains("/pin/")) { if (!item.Contains("/pin/A")) { try { int FirstPinPoint = item.IndexOf("/pins/"); int SecondPinPoint = item.IndexOf("class="); PinUrl = Utils.Utils.getBetween(item, "/pin/", "/\" class="); if (!string.IsNullOrEmpty(PinUrl)) { lstUsernamePin.Add(PinUrl); } } catch (Exception ex) { PinUrl = item.Replace("/pins/", ""); lstUsernamePin.Add(PinUrl); } } } } catch (Exception ex) { } } lstUsernamePin = lstUsernamePin.Distinct().ToList(); lstUsernamePin.Reverse(); GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Total Pin Urls Collected " + lstUsernamePin.Count + " ]"); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } return lstUsernamePin; }
public List<string> NormalPins(ref PinInterestUser objPinUser) { List<string> lstPopularPins = new List<string>(); try { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Start Getting Pins For this User " + objPinUser.Username + " ]"); string NormalPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("http://pinterest.com/"), "http://pinterest.com/", string.Empty, objPinUser.UserAgent); //List<string> lst = globusRegex.GetHrefUrlTags(NormalPinPageSource); List<string> lst = System.Text.RegularExpressions.Regex.Split(NormalPinPageSource, "pin_id").ToList(); List<string> templst = new List<string>(); foreach (string item in lst) { try { 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 (!lstPopularPins.Any(pid => pid == Pinid)) { lstPopularPins.Add(Pinid); } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } } } catch(Exception ex) { } } lstPopularPins = lstPopularPins.Distinct().ToList(); lstPopularPins.Reverse(); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total Pin Urls Collected " + lstPopularPins.Count + " ]"); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } return lstPopularPins; }
public bool LoginPinterestAccount1forlee(ref PinInterestUser objPinUser, string Username, string Password, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string ss) { try { lock (this) { objPinUser.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 = objPinUser.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 = objPinUser.globusHttpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/UserSessionResource/create/"), PostData1, referer, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); } catch (Exception ex) { } try { AfterLoginPageSource = objPinUser.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 { 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 = Utils.Utils.getBetween(following, "value'>", "</span>"); string BOARDS = string.Empty; string BoardsName = string.Empty; List<string> BOARDSNAMES = new List<string>(); if (inviteStart) { BOARDSNAMES = GetAllBoardNames_new1(objPinUser.ScreenName); foreach (var itemBoardNames in BOARDSNAMES) { lstBoardNames.Add(itemBoardNames.ToLower().Replace(" ", "-")); } } 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 static string getUserNameFromPinId(string Pinid, ref PinInterestUser objPinUser) { string Username = string.Empty; try { string pagesource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://pinterest.com/pin/" + Pinid), "http://pinterest.com/", "", objPinUser.UserAgent); string[] DataArr = System.Text.RegularExpressions.Regex.Split(pagesource, "commentDescriptionCreator"); if (DataArr.Count() < 1) { return Username; } try { foreach (string item in DataArr)//DataArr { if (item.Contains("!DOCTYPE html")) { continue; } string ValueStaring = item; if (item.Contains("{\"username\":")) { Username = Utils.Utils.getBetween(item, "{\"username\": \"", "\","); } } } catch (Exception ex) { } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } return Username; }
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 void StartActionMultithreadEditPinDisc(ref PinInterestUser objPinUser) { try { foreach (string comment in ClGlobul.CommentNicheMessageList) { string[] array = Regex.Split(comment, "::"); if (array.Length == 2) { if (array[0] == objPinUser.Niches) { CommentList.Add(array[1]); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Editing Pin Description For " + objPinUser.Username + " ]"); EditPins(ref objPinUser); } } } } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
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, "2\": \"", " followers\","); 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 List<string> GetAllBoardNames_new1(string screenName, ref PinInterestUser objPinUser) { try { BaseLib.GlobusRegex rgx = new GlobusRegex(); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Getting All Board Names ]"); Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper(); 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) { string boardUrl = Utils.Utils.getBetween(itemdata, ", \"url\":", ",").Replace("\"", "").Trim(); if (!ClGlobul.lstBoardUrls.Contains(boardUrl) && !string.IsNullOrEmpty(boardUrl)) { ClGlobul.lstBoardUrls.Add(boardUrl); } if (itemdata.Contains("board_id")) { string boardId = Utils.Utils.getBetween(itemdata, "board_id\":", ",").Replace("\"", "").Trim(); if (!ClGlobul.lstBoardId.Contains(boardId)) { ClGlobul.lstBoardId.Add(boardId); } } } string[] Items = Regex.Split(BoardPage, "item"); int counter = 0; foreach (string item in Items) { try { if (item.Contains("id=\\\"Board") && item.Contains("boardLinkWrapper")) { 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", ""); BoardUrl = rgx.StripTagsRegex(Board); try { Board = Utils.Utils.getBetween(BoardUrl, ">>", "<"); //modified done if (Board == "") { Board = Utils.Utils.getBetween(BoardUrl, "title=", ">").Replace("\\", "").Trim(); } } catch { } if (!ClGlobul.BoardNames.Contains(Board)) { ClGlobul.BoardNames.Add(Board); } } } counter++; } } catch (Exception ex) { } } } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } return ClGlobul.BoardNames; }
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 = _following; return following; } catch (Exception ex) { GlobusLogHelper.log.Error("Error :" + ex.StackTrace); } return following; }
public void StartBoardsMultiThreaded(object objParameters) { PinInterestUser objPinUser = new PinInterestUser(); try { if (!isStopBoards) { try { lstThreadsBoards.Add(Thread.CurrentThread); lstThreadsBoards.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { Console.Write(ex.Message); } try { Array paramsArray = new object[1]; paramsArray = (Array)objParameters; objPinUser = (PinInterestUser)paramsArray.GetValue(0); #region Login if (!objPinUser.isloggedin) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ 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("[ " + DateTime.Now + " ] => [ Logging UnSuccessfull : " + objPinUser.Username + " ]"); DeadAccCount++; objDelegateNoOfDeadAcc(DeadAccCount); return; } string checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } if (objPinUser.isloggedin == true) { try { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Logged In With : " + objPinUser.Username + " ]"); ActiveAccCount++; objDelegateNoOfActiveAcc(ActiveAccCount); StartActionMultithreadBoards(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 Getscreen_NameRepin(ref PinInterestUser objPinUser) { string djfsdf = string.Empty; 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(); 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 void BoardMethod(string BoardName, string BoardUrl, ref PinInterestUser objPinInUser) { try { try { lstThreadsBoards.Add(Thread.CurrentThread); lstThreadsBoards.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; lock (this) { string BoardId = string.Empty; AddNewPinManager objaddnewPin = new AddNewPinManager(); RePinManager objRepin = new RePinManager(); try { boardinput.Add(Thread.CurrentThread); boardinput.Distinct(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; if (string.IsNullOrEmpty(BoardName)) { try { List<string> baordnames = GetAllBoardNames_new(ref objPinInUser); BoardName = baordnames[RandomNumberGenerator.GenerateRandom(0, baordnames.Count - 1)]; BoardId = objaddnewPin.GetBoardId(BoardName, ref objPinInUser); } catch (Exception ex) { }; } else { //testing GlobusHttpHelper objHttp = new GlobusHttpHelper(); try { BoardId = objaddnewPin.GetBoardId_Board(BoardName, ref objPinInUser); } catch (Exception ex) { Console.Write(ex.Message); } } if (string.IsNullOrEmpty(BoardId)) { BoardId = objaddnewPin.GetBoardId(BoardName, ref objPinInUser); } int counter = 0; int RepinCounter = 0; if (!BoardId.Contains("failure")) { if (!string.IsNullOrEmpty(BoardId)) { if (PDGlobals.ValidateNumber(BoardId)) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Adding Pins From Board :" + BoardUrl + " ]"); clsSettingDB db = new clsSettingDB(); List<string> lstPins = new List<string>(); lstPins = GetBoardPinsNew(BoardId, BoardUrl, 10, ref objPinInUser); lstPins.Distinct(); List<string> lstOfRepin = new List<string>(); lstOfRepin.AddRange(lstPins); string[] lstPinNo = null; lstPinNo = lstPins.ToArray(); //getting lstPins length int lenOFlstPins = lstOfRepin.Count; foreach (string Pins in lstPinNo) { if (MaxRePinCount > RepinCounter) { string Message = string.Empty; if (ClGlobul.lstBoardRepinMessage.Count > 0) { if (counter < ClGlobul.lstBoardRepinMessage.Count) { Message = ClGlobul.lstBoardRepinMessage[counter]; } else { counter = 0; Message = ClGlobul.lstBoardRepinMessage[counter]; } } bool IsReppined = false; if (!Pins.Contains("n")) { try { int index = lstOfRepin.Where(x => x == Pins).Select(x => lstOfRepin.IndexOf(x)).Single<int>(); string NoOfPages = Convert.ToString(index / lenOFlstPins); IsReppined = objRepin.RepinwithMessage(Pins, Message, BoardId, NoOfPages, ref objPinInUser); } catch { } if (IsReppined) { //GlobusLogHelper.log.Info("[ => [ Repin Id : " + Pins + " ]"); #region AccountReport string module = "Boards"; string status = "Repined"; Qm.insertAccRePort(objPinInUser.Username, module, "https://www.pinterest.com/pin/" + Pins, BoardName, "", "", "", "", status, "", "", DateTime.Now); objBoardDelegate(); #endregion GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Repin Pin : " + Pins + " to Account : " + objPinInUser.Username + " In " + BoardName + " ]"); try { string CSV_Header = "Date" + "," + "UserName" + "," + "Message" + "," + "Pin" + "Board Id"; string CSV_Data = System.DateTime.Now.ToString() + "," + objPinInUser.Username + "," + Message + "," + "https://www.pinterest.com/pin/" + Pins + "," + BoardId; PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, Boardpath + "\\Board.csv"); RepinCounter++; } catch (Exception ex) { Console.Write(ex.Message); } //kept here int delay = RandomNumberGenerator.GenerateRandom(minDelayBoards, maxDelayBoards); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay for " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } else { } counter++; } } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED " + " For " + objPinInUser.Username + " In " + BoardName + "]"); GlobusLogHelper.log.Info("-----------------------------------------------------------------------------"); break; } } } } } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ You already have a board with that name. " + objPinInUser.Username + " ]"); } } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
public void StartCommentMultiThreaded(object objparameters) { PinInterestUser objPinUser = new PinInterestUser(); try { if (!isStopComment) { try { lstThreadsComment.Add(Thread.CurrentThread); lstThreadsComment.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); #region Login if (!objPinUser.isloggedin) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ 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("[ " + DateTime.Now + " ] => [ Logging UnSuccessfull : " + objPinUser.Username + " ]"); DeadAccCount++; objDelegateNoOfDeadAcc(DeadAccCount); return; } string checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); } catch (Exception ex) { GlobusLogHelper.log.Debug(" Debug : " + ex.StackTrace); } } if (objPinUser.isloggedin == true) { try { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Logged In With : " + objPinUser.Username + " ]"); ActiveAccCount++; objDelegateNoOfActiveAcc(ActiveAccCount); StartActionMultiThreadedComment(ref objPinUser); } catch (Exception ex) { GlobusLogHelper.log.Debug(" Debug : " + ex.StackTrace); } } #endregion } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } finally { try { if (NoOfThreadsRunningForCommentobject > Nothread_Comment) { lock (CommentObjThread) { Monitor.Pulse(CommentObjThread); } Commentdata_count--; } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } NoOfThreadsRunningForCommentobject--; GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]"); GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------"); } }
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("[ " + DateTime.Now + " ] => [ Total Pin Urls Collected " + lstPopularPins.Count + " ]"); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } return lstPopularPins; }
public void StartActionMultiThreadedComment(ref PinInterestUser objPinUser) { try { try { lstThreadsComment.Add(Thread.CurrentThread); lstThreadsComment.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } List<string> lstPinComment = new List<string>(); //List<string> lstAllPins = objLikeManagers.GetPins(ref objPinUser, MaxComment); string userName = objPinUser.ScreenName; // userName = screen_Name; List<string> lstAllPins = GetUserFollowing_newComment(userName, 1, MaxComment); string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); List<string> followinglstAllPins = lstAllPins; foreach (string FollowName in followinglstAllPins) { try { Random rnd = new Random(); int FollowingNum = rnd.Next(0, followinglstAllPins.Count - 1); string FollowingName = followinglstAllPins[FollowingNum].Trim(); List<string> lstRepinPin = objRepin_Comments_UserPins_Repin(FollowingName, ref objPinUser); //checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); lstPinComment.AddRange(lstRepinPin); lstPinComment = lstPinComment.Distinct().ToList(); if (MaxComment < lstPinComment.Count) { break; } } catch(Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } } //Random Pinrnd = new Random(); // ClGlobul.lstPins = lstPinComment.OrderBy(X => Pinrnd.Next()).ToList(); List<string> TempCommentMessageList = new List<string>(); TempCommentMessageList.AddRange(ClGlobul.CommentMessagesList); int Count = 0; #region foreach foreach (string Pin in lstPinComment) { try { if (MaxComment > Count) { string[] arrCommentList = ClGlobul.CommentMessagesList.ToArray(); string Message = string.Empty; foreach (string items in TempCommentMessageList) { int rndNo = RandomNumberGenerator.GenerateRandom(0, ClGlobul.CommentMessagesList.Count); Message = arrCommentList[rndNo]; GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message : " + Message + " ]"); break; } try { //bool IsCommented = pinterestComment.Comment(Pin, Message, ref accountManager); bool IsCommented = Comment_new(ref objPinUser, Pin, Message); if (IsCommented) { #region AccountReport string module = "Comment"; string status = "Commented"; Qm.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + Pin, "", "", Message, "", "", status, "", "", DateTime.Now); objCommentDelegate(); #endregion GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Commented on Pin : " + Pin + " From " + objPinUser.Username + " ]"); string user = PinterestPins.getUserNameFromPinId(Pin, ref objPinUser); clsSettingDB Databse = new clsSettingDB(); Databse.insertMessageDate(objPinUser.Username, user, Pin.Replace("/", ""), "", Message); try { string CSV_Header = "Date" + "," + "UserName" + "," + "Comment" + "," + "PinUrl"; string CSV_Data = System.DateTime.Now.ToString() + "," + objPinUser.Username + "," + Message + "," + "https://www.pinterest.com/pin/" + Pin; string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Comment"); PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\Comment.csv"); } catch (Exception ex) { } Count++; } else if (!IsCommented) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Not Commented on Pin : " + Pin + " From " + objPinUser.Username + " ]"); } int Delay = RandomNumberGenerator.GenerateRandom(minDelayComment, maxDelayComment); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + Delay + " Seconds ]"); Thread.Sleep(Delay * 1000); } catch (Exception ex) { GlobusLogHelper.log.Error(" => Error : " + ex.StackTrace); } } else if (MaxComment == Count) { ///Count = CommentCount; break; } } catch (Exception ex) { } } #endregion } catch(Exception ex) { GlobusLogHelper.log.Error(" Error : " + ex.StackTrace); } }
public void AccounLoad() { try { string accountUser = string.Empty; string accountPass = string.Empty; string niches = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; string BoardsName = string.Empty; string ScreenName = string.Empty; string LoginStatus = string.Empty; string Followers = string.Empty; string Following = string.Empty; QueryExecuter QME = new QueryExecuter(); DataSet ds = QME.getAccount(); accountData.Clear(); //DataTable dt = QME.getAccount (module); if (ds.Tables[0].Rows.Count != 0) { PDGlobals.listAccounts.Clear(); for (int noRow = 0; noRow < ds.Tables[0].Rows.Count; noRow++) { string account = ds.Tables[0].Rows[noRow].ItemArray[0].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[1].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[2].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[3].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[4].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[5].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[6].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[7].ToString(); PDGlobals.listAccounts.Add(account); // dv.AllowNew = false; accountUser = ds.Tables[0].Rows[noRow].ItemArray[0].ToString(); accountPass = ds.Tables[0].Rows[noRow].ItemArray[1].ToString(); niches = ds.Tables[0].Rows[noRow].ItemArray[2].ToString(); proxyAddress = ds.Tables[0].Rows[noRow].ItemArray[3].ToString(); proxyPort = ds.Tables[0].Rows[noRow].ItemArray[4].ToString(); proxyUserName = ds.Tables[0].Rows[noRow].ItemArray[5].ToString(); proxyPassword = ds.Tables[0].Rows[noRow].ItemArray[6].ToString(); ScreenName = ds.Tables[0].Rows[noRow].ItemArray[9].ToString(); Followers = ds.Tables[0].Rows[noRow].ItemArray[7].ToString(); Following = ds.Tables[0].Rows[noRow].ItemArray[8].ToString(); LoginStatus = ds.Tables[0].Rows[noRow].ItemArray[10].ToString(); // Accounts objPinInterestUser = new Accounts(); PinInterestUser objPinInterestUser = new PinInterestUser("", "", "", ""); objPinInterestUser.Username = accountUser; objPinInterestUser.Password = accountPass; objPinInterestUser.Niches = niches; objPinInterestUser.ProxyAddress = proxyAddress; objPinInterestUser.ProxyPort = proxyPort; objPinInterestUser.ProxyUsername = proxyUserName; objPinInterestUser.ProxyPassword = proxyPassword; try { PDGlobals.loadedAccountsDictionary.Add(objPinInterestUser.Username, objPinInterestUser); AddDataInGridView (accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, Followers, Following, LoginStatus); } catch (Exception ex) { AddDataInGridView (accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, Followers, Following, LoginStatus); }; } Addtologger ("[ " + DateTime.Now + " ] => [ " + PDGlobals.listAccounts.Count + " Accounts Loaded ]"); } else { AddDataInGridView (accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, Followers, Following, LoginStatus); Addtologger ("[ " + DateTime.Now + " ] => [ No Accounts Loaded ]"); } } catch(Exception ex) { Console.Write (ex.Message); } }
public void StartAddUserToBoardMultiThreaded(object objParameters) { PinInterestUser objPinUser = new PinInterestUser(); try { if (!isStopAddUserToBoard) { try { lstThreadsAddUserToBoard.Add(Thread.CurrentThread); lstThreadsAddUserToBoard.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { }; try { Array paramsArray = new object[1]; paramsArray = (Array)objParameters; objPinUser = (PinInterestUser)paramsArray.GetValue(0); if (!objPinUser.isloggedin) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " => [ 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("[ " + DateTime.Now + " => [ Logging UnSuccessfull : " + objPinUser.Username + " ]"); return; } string checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); } catch (Exception ex) { }; } if (objPinUser.isloggedin == true) { try { GlobusLogHelper.log.Info("[ " + DateTime.Now + " => [ Logged In With : " + objPinUser.Username + " ]"); StartActionMultithreadAddUserToBoard(ref objPinUser); } catch (Exception ex) { //GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } } catch (Exception ex) { } } } catch (Exception ex) { //GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }