public string NewPin(string Board, string Message, string BlogUrl, ref PinInterestUser objPinUser) { try { string[] arrPinId = Regex.Split(BlogUrl, "/"); foreach (var itemPinId in arrPinId) { if (PDGlobals.ValidateNumber(itemPinId)) { PinId = itemPinId; } } string getPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(BlogUrl), "", "", ""); 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")) { if (string.IsNullOrEmpty(Board)) { Random rnd = new Random(); int BoardNum = rnd.Next(0, objPinUser.lstBoardId.Count - 1); boardId = objPinUser.lstBoardId[BoardNum]; } else { boardId = Board; } GlobusLogHelper.log.Info(" => [ Repining " + boardId + " For " + objPinUser.Username + " ]"); } else { boardId = Board; } string BlogUrl1 = BlogUrl.Replace(":", "%253A").Replace("/", "%252F").Replace("?", "%3F").Replace("=", "%3D").Replace("&", "%26"); string BlogUrl2 = BlogUrl.Replace(":", "%3A").Replace("/", "%2F").Replace("?", "%3F").Replace("=", "%3D").Replace("&", "%26"); 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"; if (Checking.Contains("profileName")) { string RepinpostData = "source_url=%2Fpin%2Ffind%2F%3Furl%3D" + BlogUrl1 + "&data=%7B%22options%22%3A%7B%22method%22%3A%22scraped%22%2C%22description%22%3A%22" + Message.Replace(" ", "+") + "%22%2C%22link%22%3A%22" + BlogUrl2 + "%22%2C%22image_url%22%3A%22" + BlogUrl2 + "%22%2C%22board_id%22%3A%22" + Board + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EModalManager%3EModal%3EPinCreate%3EBoardPicker%3ESelectList(view_type%3DpinCreate%2C+selected_section_index%3Dundefined%2C+selected_item_index%3Dundefined%2C+highlight_matched_text%3Dtrue%2C+suppress_hover_events%3Dundefined%2C+scroll_selected_item_into_view%3Dtrue%2C+select_first_item_after_update%3Dfalse%2C+item_module%3D%5Bobject+Object%5D)"; string PostUrl = redirectDomain + ".pinterest.com/resource/PinResource/create/"; try { Thread.Sleep(2 * 1000); RepinPagesource = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri(PostUrl), RepinpostData, newHomePageUrl); } catch (Exception ex) { Thread.Sleep(1 * 30 * 1000); try { RepinPagesource = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri(PostUrl), RepinpostData, newHomePageUrl); } catch (Exception) { Thread.Sleep(1 * 1000); RepinPagesource = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri(PostUrl), RepinpostData, newHomePageUrl); } } if (!string.IsNullOrEmpty(RepinPagesource)) { GlobusLogHelper.log.Info(" => [ Repining " + PinId + " For " + objPinUser.Username + " is Done. ]"); return "true"; } else { GlobusLogHelper.log.Info(" => [ Repining " + PinId + " For " + objPinUser.Username + " is Failed. ]"); return "false"; } GlobusLogHelper.log.Info(" => [ Repining " + PinId + " For " + objPinUser.Username + " ]"); if (getPinPageSource.Contains("class=\"sourceFlagWrapper")) { 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); } 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; } 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" + Message + "%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, "", ""); return "true"; } catch (Exception ex) { }; } else { GlobusLogHelper.log.Info(" => [ Login Issue " + " For " + objPinUser.Username + " ]"); } } catch(Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } return "false"; }
public bool RepinwithMessage(string PinId, string myMessage, string Board, string NumberOfPage, ref PinInterestUser objPinUser) { try { string getPinPageSource = string.Empty; string pinUrl = string.Empty; string url = "https://www.pinterest.com/pin/" + PinId; string CheckPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(url), "", string.Empty, ""); if (!CheckPinPageSource.Contains("<div>Something went wrong!</div>") && !CheckPinPageSource.Contains("<div>Sorry. We've let our engineers know.</div>") && !CheckPinPageSource.Contains("<div>Whoops! We couldn't find that page.</div>") && !CheckPinPageSource.Contains("<div class=\"suggestionText\">How about these instead?</div>")) { pinUrl = "https://www.pinterest.com/pin/" + PinId + "/"; } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Pin " + PinId + " Is InCorrect ]"); } try { if (!string.IsNullOrEmpty(Globals.ItemSelect)) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + "In" + Globals.ItemSelect + " ]"); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " ]"); } } catch { }; try { GlobusHttpHelper objhttp = new GlobusHttpHelper(); getPinPageSource = objhttp.getHtmlfromUrl(new Uri(pinUrl), "", "", ""); } catch { }; string description = string.Empty; string link = string.Empty; string boardId = string.Empty; string RepinPagesource = string.Empty; string appVersion = string.Empty; try { if (getPinPageSource.Contains("description_html")) { description = Utils.Utils.getBetween(getPinPageSource, "description_html\":", ", \"title\":").Replace("\"", "").Replace("&", "%26").Trim(); description = description.Replace(" ", "+").Replace(",", "%2C").Replace("amp;", ""); } if (getPinPageSource.Contains("serving_link")) { link = Utils.Utils.getBetween(getPinPageSource, "serving_link\":", ", \"is_promoted").Replace("\"", "").Trim(); link = link.Replace(":", "%3A").Replace("/", "%2F").Replace("?", "%3F").Replace("=", "%3D").Replace("&", "%26"); } if (getPinPageSource.Contains("board_id")) { try { if (string.IsNullOrEmpty(Board)) { Random rnd = new Random(); int BoardNum = rnd.Next(0, objPinUser.Boards.Count - 1); boardId = objPinUser.Boards[BoardNum]; } else { boardId = Board; } if (string.IsNullOrEmpty(boardId.ToString())) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [Board is not present in your account , can't repin]"); return false; } } catch (Exception) { } } else if (getPinPageSource.Contains("board")) { boardId = Board; } lock (Lock_RepinonBoard) { string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); if (Checking.Contains("profileName")) { if (Checking.Contains("profileName")) { appVersion = Utils.Utils.getBetween(Checking, "\"app_version\": \"", "\", \""); } } else { ObjAccountManager.LoginPinterestAccount(ref objPinUser); } string RedirectUrl = GlobusHttpHelper.valueURl.Split('.')[0]; string newHomePage = RedirectUrl + ".pinterest.com"; string linkurl = string.Empty; string RepinpostData = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22pin_id%22%3A%22" + PinId + "%22%2C%22description%22%3A%22" + myMessage + "%22%2C%22link%22%3A%22" + link + "%22%2C%22is_video%22%3Afalse%2C%22board_id%22%3A%22" + Board + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=Modal()%3EPinCreate3(resource%3DPinResource(id%3D" + PinId + "))%3EBoardPicker(resource%3DBoardPickerBoardsResource(filter%3Dall))%3ESelectList(view_type%3DpinCreate3%2C+selected_section_index%3Dundefined%2C+selected_item_index%3Dundefined%2C+highlight_matched_text%3Dtrue%2C+suppress_hover_events%3Dundefined%2C+item_module%3D%5Bobject+Object%5D)"; string PostPageUrl = RedirectUrl + ".pinterest.com/resource/RepinResource/create/"; try { RepinPagesource = objPinUser.globusHttpHelper.postFormDataProxyREPin(new Uri(PostPageUrl), RepinpostData, newHomePage, objPinUser.App_version); } catch (Exception ex) { } if (string.IsNullOrEmpty(RepinPagesource)) { try { if (getPinPageSource.Contains("class=\"sourceFlagWrapper")) { try { BaseLib.GlobusRegex rgx = new GlobusRegex(); string urldata = System.Text.RegularExpressions.Regex.Split(System.Text.RegularExpressions.Regex.Split(getPinPageSource, "sourceFlagWrapper")[1], "</a>")[0]; linkurl = rgx.GetHrefUrlTag(urldata).Replace("href=\"", string.Empty); } catch (Exception ex) { } } else if (string.IsNullOrEmpty(linkurl)) { try { string urldata = System.Text.RegularExpressions.Regex.Split(System.Text.RegularExpressions.Regex.Split(getPinPageSource, "sourceFlagWrapper")[1], "</a>")[0]; string Datavalue = urldata.Substring(urldata.IndexOf("href=\\\"")); int startindex = Datavalue.IndexOf("href=\\\""); string start = Datavalue.Substring(startindex).Replace("href=\\\"", ""); int endindex = start.IndexOf("\\\""); string end = start.Substring(0, endindex); linkurl = end;// Datavalue.Substring(0, Datavalue.IndexOf("\\\">")).Replace("\\", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("href=\"", string.Empty); } catch { }; } try { string postdata1 = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + Board + "%22%2C%22description%22%3A%22" + myMessage + "%22%2C%22link%22%3A%22" + Uri.EscapeDataString(linkurl) + "%22%2C%22is_video%22%3Afalse%2C%22pin_id%22%3A%22" + PinId + "%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22" + objPinUser.App_version + "%22%2C%22https_exp%22%3Afalse%7D%7D&module_path=App()%3ECloseup(resource%3DPinResource(id%3D" + PinId + "))%3EPinActionBar(resource%3DPinResource(id%3D" + PinId + "))%3EShowModalButton(module%3DPinCreate)%23Modal(module%3DPinCreate(resource%3DPinResource(id%3D" + PinId + ")))"; string afterposting = objPinUser.globusHttpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/RepinResource/create/"), postdata1, "http://www.pinterest.com/pin/" + PinId + "/", "", 0, "", ""); if (!afterposting.Contains("<div>Uh oh! Something went wrong.")) { return true; } return false; } catch (Exception ex) { }; } catch (Exception ex) { } } if (!string.IsNullOrEmpty(RepinPagesource)) { try { if (!string.IsNullOrEmpty(Globals.ItemSelect)) { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " In " + Globals.ItemSelect + " is Done. ]"); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " is Done. ]"); } } catch { }; return true; } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " is Failed. ]"); return false; } } } catch { }; return false; } catch (Exception Ex) { return false; } }
//public bool RepinwithMessage(string PinId, string myMessage, string Board, string NumberOfPage, ref PinInterestUser objPinUser) //{ // try // { // string CsrfMiddleToken = string.Empty; // string pinUrl = string.Empty; // string url = "https://www.pinterest.com/pin/" + PinId; // string CheckPinPageSource123 = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); // 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>")) // { // // lstRePinPin.Add(lstRepinUrl_item); // 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(" => [ Repining " + PinId + " For " + objPinUser.Username + "In" + Globals.ItemSelect + " ]"); // } // else // { // GlobusLogHelper.log.Info(" => [ Repining " + PinId + " For " + objPinUser.Username + " In " + BoardName + "]"); // } // } // catch { }; // try // { // getPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(pinUrl), "", "", ""); // } // catch { }; // 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]; // //objPinUser.Boards // } // else // { // boardId = Board; // } // if (string.IsNullOrEmpty(boardId.ToString())) // { // GlobusLogHelper.log.Info(" => [Board is not present in your account , can't repin]"); // return false; // } // // Log("[ " + DateTime.Now + " ] => [ Repining " + boardId + " For " + pinterestAccountManager.Username + " ]"); // } // catch (Exception) // { }; // } // //objPinUser.globusHttpHelper = new GlobusHttpHelper(); // lock (Lock_RepinonBoard) // { // string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); // CsrfMiddleToken = Utils.Utils.getBetween(Checking, "\"csrftoken\": \"", "\", \""); // if (Checking.Contains("profileName")) // { // } // else // { // ObjAccountManager.LoginPinterestAccount(ref objPinUser); // } // 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" + boardId + "%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)"; // RepinpostData = "source_url=%2F" + objPinUser.ScreenName + "%2Fpins%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" + boardId + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EModalManager%3EModal%3EPinCreate%3EBoardPicker%3ESelectList(view_type%3DpinCreate%2C+selected_section_index%3Dundefined%2C+selected_item_index%3Dundefined%2C+highlight_matched_text%3Dtrue%2C+suppress_hover_events%3Dundefined%2C+scroll_selected_item_into_view%3Dtrue%2C+select_first_item_after_update%3Dfalse%2C+item_module%3D%5Bobject+Object%5D)"; // try // { // RepinPagesource = objPinUser.globusHttpHelper.postFormDataProxyPincsrftoken(new Uri("https://www.pinterest.com/resource/RepinResource/create/"), RepinpostData, "https://www.pinterest.com/", CsrfMiddleToken); // } // 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 // { // //objPinUser.globusHttpHelper.gCookies = new System.Net.CookieCollection(); // //string CookieList = "_b=\"ARdBmc3sRRBC1b7mWyRRCA3QBovSmWHWonr/rL5WVoV3ABT+imiaVF1UnHkaoTAnSzE=\"; sessionFunnelEventLogged=1; __utmt=1; logged_out=True; fba=True; csrftoken=w4YapCH4AAPIlfxhvZR3Mb9XIXVYzMXA; _pinterest_sess=\"TWc9PSZlZU1LQU1EL1pIY3UxbjlhWGYrUGtMSkRwYzc5TFFJS3d4dTU0VEthUVlHK1VhT2NOQkQzcUtkekYzaWNYN212U2lyRlRxd2dYejhoSldadGw5M0ZzK2NyS3Q5ODhSemhUMG5HVlVVOEx6R1RWdkh0aWdFalNuSkxJZmo0ZE9jMG44b2RXZzZOeU83ZVdJWVVNdWZKZFRhOWEwK0ZDckc0NVIwdi8xdytjcDBtVHZtTjZOUUdtQk5acko0ODVaakEwS3dEN0taU2NrQkE3YlZMU3I2Q0VicDRoWTl3RHJpaDVzUnJ3YmlLNmhYbFpMbFp6K2FKTlIyZUNWUDRKN3I3dFNMejQyUVRhb0JtMTk0ajBtcVhUVzlrRVlVQzZwTjRwY3UzdG1tWFpxQ3FGV0ZOeXBNV0FMeURUL0crMmZvVzVNWWlPbjZyUnh2UXN3R3pOT2c2RVNoZFVxZG9lUnlDaHJpS0dORFoydHhZMFgxR0hWWE02OUZDQmdlSkhzRDdjREszcjdvWDBTaFJXM1BFM01VUnRpYjB4U3l6alQ2eWxmQTdrWVdYcWFpOFhETDRWSGlQazR0L2xUNTdiUGdhbG9WUUtLZHdrSVFMN1VaWHk2LytNeWkzcUJJbStUejVMYkljczY1Sk5GQT0mblE0ZXFxTDVyeGk5NVJ2Mmp1SEZVakNxcGNjPQ==\"; c_dpr=1; cm_sub=none; __utma=229774877.1623437774.1450182939.1450182939.1450249426.2; __utmb=229774877.15.9.1450261114039; __utmc=229774877; __utmz=229774877.1450182939.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)"; // //string[] CookieList1234 = Regex.Split(CookieList, ";"); // //foreach (string str in CookieList1234) // //{ // // string Cokkiename = Regex.Split(str, "=")[0].Replace(" ",""); // // string CokkieValue = Regex.Split(str, "=")[1].Replace(" ", ""); // // System.Net.Cookie cookie = new System.Net.Cookie(); // // cookie.Name = Cokkiename; // // cookie.Value = CokkieValue; // // cookie.Domain = "pinterest.com"; // // objPinUser.globusHttpHelper.gCookies.Add(cookie); // //} // 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 + ")))"; // // postdata1 = "source_url=%2F" + objPinUser.ScreenName + "%2Fpins%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=App%3EModalManager%3EModal%3EPinCreate%3EBoardPicker%3ESelectList(view_type%3DpinCreate%2C+selected_section_index%3Dundefined%2C+selected_item_index%3Dundefined%2C+highlight_matched_text%3Dtrue%2C+suppress_hover_events%3Dundefined%2C+scroll_selected_item_into_view%3Dtrue%2C+select_first_item_after_update%3Dfalse%2C+item_module%3D%5Bobject+Object%5D)"; // // "source_url=%2FPrashant123456%2Fdeveloper%2F&data=%7B%22options%22%3A%7B%22pin_id%22%3A%22350295677243761444%22%2C%22description%22%3A%22%22%2C%22link%22%3Anull%2C%22is_video%22%3Afalse%2C%22board_id%22%3A%22350295745955657898%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EModalManager%3EModal%3EPinCreate%3EBoardPicker%3ESelectList(view_type%3DpinCreate%2C+selected_section_index%3Dundefined%2C+selected_item_index%3Dundefined%2C+highlight_matched_text%3Dtrue%2C+suppress_hover_events%3Dundefined%2C+scroll_selected_item_into_view%3Dtrue%2C+select_first_item_after_update%3Dfalse%2C+item_module%3D%5Bobject+Object%5D)"; // postdata1 = "source_url=%2FPrashant123456%2Flovely2%2F&data=%7B%22options%22%3A%7B%22pin_id%22%3A%22350295677245529486%22%2C%22description%22%3A%22Hii%22%2C%22link%22%3A%22http%3A%2F%2Fwebsta.me%2Fp%2F945717296717057301_1591089306%22%2C%22is_video%22%3Afalse%2C%22board_id%22%3A%22350295745955657875%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EModalManager%3EModal%3EPinCreate%3EBoardPicker%3ESelectList(view_type%3DpinCreate%2C+selected_section_index%3Dundefined%2C+selected_item_index%3Dundefined%2C+highlight_matched_text%3Dtrue%2C+suppress_hover_events%3Dundefined%2C+scroll_selected_item_into_view%3Dtrue%2C+select_first_item_after_update%3Dfalse%2C+item_module%3D%5Bobject+Object%5D)"; // string afterposting = objPinUser.globusHttpHelper.postFormDataProxywithCSRFToken(new Uri("https://www.pinterest.com/resource/RepinResource/create/"), postdata1, "http://www.pinterest.com/", "", 0, "", "", "CsrfMiddleToken"); // //string afterposting = objPinUser.globusHttpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/RepinResource/create/"), postdata1, "http://www.pinterest.com/pin/" + PinId + "/", "", 0, "", "", CsrfMiddleToken); // if (!afterposting.Contains("<div>Uh oh! Something went wrong.")) // { // return true; // } // else // { // return false; // } // } // catch (Exception ex) // { // }; // } // catch (Exception ex) // { // } // } // if (!string.IsNullOrEmpty(RepinPagesource)) // { // try // { // if (!string.IsNullOrEmpty(Globals.ItemSelect)) // { // GlobusLogHelper.log.Info(" => [ Repining " + PinId + " For " + objPinUser.Username + " In " + Globals.ItemSelect + " is Done. ]"); // } // else // { // GlobusLogHelper.log.Info(" => [ Repining " + PinId + " For " + objPinUser.Username + " is Done. ]"); // } // //string RepinDetails =pinterestAccountManager.Username + "," + PinId.Replace(",","") + "," + boardId.Replace(",","") + "," + myMessage.Replace(",",""); // //GlobusFileHelper.AppendStringToTextfileNewLine(RepinDetails, ApplicationData.path_Repin); // } // catch { }; // return true; // } // else // { // GlobusLogHelper.log.Info(" => [ Repining " + PinId + " For " + objPinUser.Username + " is Failed. ]"); // return false; // } // } // } // catch { }; // return false; // } // catch (Exception Ex) // { // return false; // } //} #region NEW_REPIN_WITH_MESSAGE 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>")) { // lstRePinPin.Add(lstRepinUrl_item); pinUrl = "https://www.pinterest.com/pin/" + PinId + "/"; } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Pin " + PinId + " Is InCorrect ]"); } // Thread.Sleep(10 * 1000); //pinUrl = "https://www.pinterest.com/pin/" + PinId + "/"; //string checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); try { if (!string.IsNullOrEmpty(Globals.ItemSelect)) { GlobusLogHelper.log.Info(" => [ Repining " + PinId + " For " + objPinUser.Username + "In" + Globals.ItemSelect + " ]"); } else { GlobusLogHelper.log.Info(" => [ 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(" => [Board is not present in your account , can't repin]"); return false; } // Log("[ " + DateTime.Now + " ] => [ Repining " + boardId + " For " + pinterestAccountManager.Username + " ]"); } 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 { #region comment //Message = Message.Replace(" ", "+"); //string PostData = "source_url=%2Fpopular%2F%3Fpage%3D" + NumberOfPage + "&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + Board + "%22%2C%22description%22%3A%22" + (Message.Replace(" ", "+")) + "%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" + pinterestAccountManager.App_version + "%22%7D%7D&module_path=App()%3EFeedPage()%3EGrid(resource%3DCategoryFeedResource(feed%3Dpopular))%3EGridItems(resource%3DCategoryFeedResource(feed%3Dpopular))%3EPin(resource%3DPinResource(id%3D" + PinId + "))%3EShowModalButton(submodule%3D%5Bobject+Object%5D%2C+color%3Dprimary%2C+text%3DPin+it%2C+primary_on_hover%3Dtrue%2C+extra_options%3D%5Bobject+Object%5D%2C+tagName%3Dbutton%2C+has_icon%3Dtrue%2C+show_text%3Dfalse%2C+ga_category%3Drepin_create%2C+class_name%3DrepinSmall%2C+require_auth%3Dtrue)%23Modal(module%3DPinCreate(resource%3DPinResource(id%3D" + PinId + "%2C+view_type%3Drepin)))"; //string PostData = "source_url=%2Fpopular%2F%3Fpage%3D" + "1" + "&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + Board + "%22%2C%22description%22%3A%22" + (Message.Replace(" ", "+").Replace("\t", "+")) + "%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" + pinterestAccountManager.App_version + "%22%7D%7D&module_path=App()%3EFeedPage()%3EGrid(resource%3DCategoryFeedResource(feed%3Dpopular))%3EGridItems(resource%3DCategoryFeedResource(feed%3Dpopular))%3EPin(resource%3DPinResource(id%3D" + PinId + "))%3EShowModalButton(submodule%3D%5Bobject+Object%5D%2C+color%3Dprimary%2C+text%3DPin+it%2C+primary_on_hover%3Dtrue%2C+extra_options%3D%5Bobject+Object%5D%2C+tagName%3Dbutton%2C+has_icon%3Dtrue%2C+show_text%3Dfalse%2C+ga_category%3Drepin_create%2C+class_name%3DrepinSmall%2C+require_auth%3Dtrue)%23Modal(module%3DPinCreate(resource%3DPinResource(id%3D" + PinId + "%2C+view_type%3Drepin)))"; //string PostData = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + Board + "%22%2C%22description%22%3A%22" + AddDesc + "%22%2C%22link%22%3A%22"+ linkurl +"%2F2011%2F11%2F01%2Fcaribbean-sangria%2F%22%2C%22is_video%22%3Afalse%2C%22pin_id%22%3A%22520306563170537867%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%227d82d10%22%2C%22https_exp%22%3Afalse%7D%7D&module_path=App()%3ECloseup(resource%3DPinResource(id%3D520306563170537867))%3EPinActionBar(resource%3DPinResource(id%3D520306563170537867))%3EShowModalButton(module%3DPinCreate)%23Modal(module%3DPinCreate(resource%3DPinResource(id%3D520306563170537867)))"; //string postdata = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + Board + "%22%2C%22description%22%3A%22" + Message.Replace(" ","+") + "%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" + pinterestAccountManager.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 postdata = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + Board + "%22%2C%22description%22%3A%22" + (Message.Replace(" ", "+")) + "%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" + pinterestAccountManager.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 + ")))"; //My Commented //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%22Message%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" + pinterestAccountManager.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 + ")))"; // Have to add Message below here //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" + pinterestAccountManager.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 + ")))"; //source_url=%2Fpin%2F347410558725937380%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%2297460848125134285%22%2C%22description%22%3A%22Butterfly+tattoo%22%2C%22link%22%3A%22http%3A%2F%2Fwww.ruthtattooideas.com%2F2013%2F07%2F23%2Fbutterfly-tattoo%2F%22%2C%22is_video%22%3Afalse%2C%22pin_id%22%3A%22347410558725937380%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%228c9869b%22%2C%22https_exp%22%3Afalse%7D%7D&module_path=App()%3ECloseup(resource%3DPinResource(id%3D347410558725937380))%3EPinActionBar(resource%3DPinResource(id%3D347410558725937380))%3EShowModalButton(module%3DPinCreate)%23Modal(module%3DPinCreate(resource%3DPinResource(id%3D347410558725937380))) // string postdataa = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + Board + "%22description%22%3A%22" + (Message.Replace(" ", "+")) + "%22%2C%22link%22%3A%22" + SourceUrl + "%22%2C%22id%22%3A%22" + PinId + "%22%7D%2C%22context%22%3A%7B%22app_version%22" + pinterestAccountManager.App_version + "%3A%226bbb94a%22%2C%22https_exp%22%3Afalse%7D%7D&module_path=App()%3ECloseup(resource%3DPinResource(id%3D" + PinId + "))%3ECloseupContent(resource%3DPinResource(id%3D381539399653733768))%3EPin(resource%3DPinResource(id%3D" + PinId + "))%3EShowModalButton(module%3DPinEdit)%23Modal(module%3DPinEdit(resource%3DPinResource(id%3D" + PinId + ")))"; //string afterposting = pinterestAccountManager.httpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/RepinResource/create/"), postdata1, "http://www.pinterest.com/pin/" + PinId + "/", "", 0, "", ""); #endregion 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(" => [ Repining " + PinId + " For " + objPinUser.Username + " In " + Globals.ItemSelect + " is Done. ]"); } else { GlobusLogHelper.log.Info(" => [ Repining " + PinId + " For " + objPinUser.Username + " is Done. ]"); } //string RepinDetails =pinterestAccountManager.Username + "," + PinId.Replace(",","") + "," + boardId.Replace(",","") + "," + myMessage.Replace(",",""); //GlobusFileHelper.AppendStringToTextfileNewLine(RepinDetails, ApplicationData.path_Repin); } catch { }; return true; } else { GlobusLogHelper.log.Info(" => [ Repining " + PinId + " For " + objPinUser.Username + " is Failed. ]"); return false; } // Log("[ " + DateTime.Now + " ] => [ Repining " + PinId + " For " + pinterestAccountManager.Username + " ]"); //string getPinPageSource = pinterestAccountManager.httpHelper.getHtmlfromUrl(new Uri("http://www.pinterest.com/" + PinId + "/"), "", "", "");//(new Uri("http://www.pinterest.com/pin/" + PinId + "/"), "", "", ""); //string getPinPageSource = pinterestAccountManager.httpHelper.getHtmlfromUrl(new Uri(PinId), "", "", ""); } } catch { }; return false; } catch (Exception Ex) { return false; } }