public static string DecodeGetCharector(string PageString) { GlobusHttpHelper obj_http = new GlobusHttpHelper(); string GetOrginalString = string.Empty; try { string[] Arr = System.Text.RegularExpressions.Regex.Split(PageString, "&#"); foreach (var item_Arr in Arr) { try { string ss = string.Empty; ss = "&#" + Uri.EscapeDataString(Utils.getBetween("&#" + item_Arr, "&#", ";")) + ";"; string Url = "http://chars.suikawiki.org/string?s=" + Uri.EscapeDataString(ss); string PageSource = obj_http.getHtmlfromUrl(new Uri(Url)); string[] Arr11 = System.Text.RegularExpressions.Regex.Split(PageSource, "escapes"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } return(GetOrginalString); }
public static string DecodeGetCharector(string PageString) { GlobusHttpHelper obj_http = new GlobusHttpHelper(); string GetOrginalString = string.Empty; try { string[] Arr = System.Text.RegularExpressions.Regex.Split(PageString, "&#"); foreach (var item_Arr in Arr) { try { string ss = string.Empty; ss = "&#" + Uri.EscapeDataString(Utils.getBetween("&#" + item_Arr, "&#", ";")) + ";"; string Url = "http://chars.suikawiki.org/string?s=" +Uri.EscapeDataString(ss); string PageSource = obj_http.getHtmlfromUrl(new Uri(Url)); string[] Arr11 = System.Text.RegularExpressions.Regex.Split(PageSource, "escapes"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } return GetOrginalString; }
public void CheckLDAccount(string item) { GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); try { _Email = item; string Username = string.Empty; string Password = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; string account = item; string[] AccArr = account.Split(':'); if (AccArr.Count() > 1) { Username = account.Split(':')[0]; Password = account.Split(':')[1]; int DataCount = account.Split(':').Length; if (DataCount == 4) { proxyAddress = account.Split(':')[2]; proxyPort = account.Split(':')[3]; } else if (DataCount == 6) { proxyAddress = account.Split(':')[2]; proxyPort = account.Split(':')[3]; proxyUserName = account.Split(':')[4]; proxyPassword = account.Split(':')[5]; } } LinkedinLogin Login = new LinkedinLogin(); //For Sign Out +9+ Login.LoginHttpHelper(ref objGlobusHttpHelper); //bool isLogin = LoginAccount(Username, Password, proxyAddress, proxyPort, proxyUserName, proxyPassword); } catch { } finally { Counter++; if (TotalEmails <= Counter) { Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED For Account Checking ]"); Log("------------------------------------------------------------------------------------------------------------------------------------"); } } }
public bool HotmailWithoutReference(string Email, string Password) { GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); bool activate = false; Chilkat.Http http = new Chilkat.Http(); #region Hotmail try { if (Email.Contains("@hotmail")) { if (popClient.Connected) { popClient.Disconnect(); } popClient.Connect("pop3.live.com", int.Parse("995"), true); popClient.Authenticate(Email, Password); int Count = popClient.GetMessageCount(); for (int i = Count; i >= 1; i--) { OpenPOP.MIME.Message Message = popClient.GetMessage(i); string subject = string.Empty; subject = Message.Headers.Subject; if (Message.Headers.Subject.Contains("[WordPress] Activate") && Message.Headers.Subject.Contains("wordpress.com")) { foreach (string href in GetUrlsFromStringHotmail(Message.MessageBody[0])) { try { string staticUrl = string.Empty; staticUrl = href; string res = HttpHelper.getHtmlfromUrl1(new Uri(staticUrl)); responce = http.QuickGetStr(staticUrl); if (responce.Contains("Your account is now active")) { Log("Account activated"); activate = true; } } catch (Exception ex) { } } } } } } catch { }; #endregion return(activate); }
public string GetProfileId(ref GlobusHttpHelper httpHelper, string loggedInPageSource) { string profileId = string.Empty; try { //profileId = httpHelper.GetUniqueKeyBasedValue(loggedInPageSource, "user_id:"); profileId = httpHelper.GetUniqueKeyBasedValue(loggedInPageSource, "<li class=\"nav-item account-settings-tab\">"); } catch { } return profileId; }
public bool CheckProxy() { try { int Working = 0; string LoggedInIp = string.Empty; //BaseLib.ChilkatHttpHelpr HttpHelper = new BaseLib.ChilkatHttpHelpr(); //string pageSource = HttpHelper.GetHtmlProxy("http://www.linkedin.com/", proxyAddress, proxyPort, proxyUsername, proxyPassword); GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); string pageSource = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/"), proxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword); if (string.IsNullOrEmpty(pageSource))//(string.IsNullOrEmpty(pageSource) && string.IsNullOrEmpty(PgSrcHome)) { Thread.Sleep(500); pageSource = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/"), proxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword); if (string.IsNullOrEmpty(pageSource)) { return(false); } } ///Logic to check... if (pageSource.Contains("LinkedIn") && (pageSource.Contains("Sign Up"))) { try { using (SQLiteConnection con = new SQLiteConnection(DataBaseHandler.CONstr)) { using (SQLiteDataAdapter ad = new SQLiteDataAdapter()) { Working = 1; string InsertQuery = "Insert into tb_Proxies values('" + proxyAddress + "','" + proxyPort + "','" + proxyUsername + "','" + proxyPassword + "', " + Working + "," + IsPublic + " , '" + LoggedInIp + "')"; DataBaseHandler.InsertQuery(InsertQuery, "tb_Proxies"); GlobusFileHelper.AppendStringToTextfileNewLine(proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.Path_ExsistingProxies); } } } catch { } return(true); } return(false); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(false); } }
public bool CheckProxy() { try { int Working = 0; string LoggedInIp = string.Empty; //BaseLib.ChilkatHttpHelpr HttpHelper = new BaseLib.ChilkatHttpHelpr(); //string pageSource = HttpHelper.GetHtmlProxy("http://www.linkedin.com/", proxyAddress, proxyPort, proxyUsername, proxyPassword); GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); string pageSource = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/"), proxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword); if (string.IsNullOrEmpty(pageSource))//(string.IsNullOrEmpty(pageSource) && string.IsNullOrEmpty(PgSrcHome)) { Thread.Sleep(500); pageSource = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/"), proxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword); if (string.IsNullOrEmpty(pageSource)) { return false; } } ///Logic to check... if (pageSource.Contains("LinkedIn") && (pageSource.Contains("Sign Up"))) { try { using (SQLiteConnection con = new SQLiteConnection(DataBaseHandler.CONstr)) { using (SQLiteDataAdapter ad = new SQLiteDataAdapter()) { Working = 1; string InsertQuery = "Insert into tb_Proxies values('" + proxyAddress + "','" + proxyPort + "','" + proxyUsername + "','" + proxyPassword + "', " + Working + "," + IsPublic + " , '" + LoggedInIp + "')"; DataBaseHandler.InsertQuery(InsertQuery, "tb_Proxies"); GlobusFileHelper.AppendStringToTextfileNewLine(proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.Path_ExsistingProxies); } } } catch { } return true; } return false; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return false; } }
public void SetProfilePic(ref GlobusHttpHelper httpHelper) { try { string homePageSource = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com")); string ProfileID = GetProfileId(ref httpHelper, homePageSource); string Url = "http://www.linkedin.com/profile/view?id=" + ProfileID + "&trk=tab_pro"; string ProfilePageSource = httpHelper.getHtmlfromUrl1(new Uri(Url)); if (!string.IsNullOrEmpty(homePageSource)) { try { if (ProfilePageSource.Contains("link__nprofileEdit")) { try { string link__nprofileEdit = httpHelper.GetUniqueKeyBasedValue(ProfilePageSource, "link__nprofileEdit"); } catch { } } if (ProfilePageSource.Contains("link__editPictureInfo")) { try { string link__editPictureInfo = httpHelper.GetUniqueKeyBasedValue(ProfilePageSource, "link__editPictureInfo"); } catch { } } string refere = string.Empty; try { UploadPic(ref httpHelper, ProfilePageSource, refere); } catch { } } catch { } } } catch { } finally { Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); Log("--------------------------------------------------------------------------------------------------------------------------------------------"); } }
public Dictionary<string, string> getAllMembers(ref GlobusHttpHelper HttpHelper, string userName) { Dictionary<string, string> details = new Dictionary<string, string>(); try { string url = "https://www.linkedin.com/people/invites?trk=connect_hub_manage_invitations_sent"; string src = HttpHelper.getHtmlfromUrl(new Uri(url)); if (src.Contains("{\"lastName\"")) { string[] arr = Regex.Split(src, "{\"lastName\""); foreach (string item in arr) { try { if (!item.Contains("<!DOCTYPE")) { string invitationId=string.Empty; string Id=string.Empty; string fullName = Utils.getBetween(item, "i18n_check_to_remove\":\"","\","); fullName = Utils.getBetween(fullName + "###", "to remove", "###"); fullName= fullName.Trim(); if (item.Contains("")) { invitationId = Utils.getBetween(item, "\"invitationId\":\"", "\",\""); } if (item.Contains("memberId\":")) { Id = Utils.getBetween(item, "memberId\":", "}"); } Id = userName + ":" + Id; details.Add(Id, fullName + ":" + invitationId); } } catch { } } } } catch { } return details; }
public bool LogoutHttpHelper(ref GlobusHttpHelper HttpHelper) { try { //string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/")); string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/")); if (pageSource1.Contains("\"h\"") && pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg")) { string h = string.Empty; string post_form_id = string.Empty; string fb_dtsg = string.Empty; if (pageSource1.Contains("\"h\"")) { string strTemp = pageSource1.Substring(pageSource1.IndexOf("\"h\""), 200); string[] ArrTemp = strTemp.Split('"'); h = ArrTemp[3]; } if (pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg")) { string strTemp = pageSource1.Substring(pageSource1.IndexOf("post_form_id"), 200); string[] ArrTemp = strTemp.Split('"'); post_form_id = ArrTemp[2]; fb_dtsg = ArrTemp[6]; } string ResponseLogout = HttpHelper.postFormData(new Uri("http://www.facebook.com/logout.php"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&ref=mb&h=" + h); return(true); } return(false); } catch (Exception ex) { return(false); Console.WriteLine(ex.Message); } }
public bool LogoutHttpHelper(ref GlobusHttpHelper HttpHelper) { try { //string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/")); string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/")); if (pageSource1.Contains("\"h\"") && pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg")) { string h = string.Empty; string post_form_id = string.Empty; string fb_dtsg = string.Empty; if (pageSource1.Contains("\"h\"")) { string strTemp = pageSource1.Substring(pageSource1.IndexOf("\"h\""), 200); string[] ArrTemp = strTemp.Split('"'); h = ArrTemp[3]; } if (pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg")) { string strTemp = pageSource1.Substring(pageSource1.IndexOf("post_form_id"), 200); string[] ArrTemp = strTemp.Split('"'); post_form_id = ArrTemp[2]; fb_dtsg = ArrTemp[6]; } string ResponseLogout = HttpHelper.postFormData(new Uri("http://www.facebook.com/logout.php"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&ref=mb&h=" + h); return true; } return false; } catch (Exception ex) { return false; Console.WriteLine(ex.Message); } }
public string UploadprofilePicOnInstagram(ref GlobusHttpHelper HttpHelper, string url, string CSRFToken, string contentType, string localImagePath, NameValueCollection nvc, string referer, string proxyAddress, int proxyPort, string proxyUsername, string proxyPassword) { bool isAddaCover = false; string responseStr = string.Empty; string AllDataWriten = string.Empty; try { ////log.Debug(string.Format("Uploading {0} to {1}", file, url)); //string boundary = "---------------------------" + DateTime.Now.Ticks.ToString(""); string boundary = "------WebKitFormBoundary" + DateTime.Now.Ticks.ToString("x"); byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n"); byte[] boundarybytes_First = System.Text.Encoding.ASCII.GetBytes(boundary + "\r\n"); gRequest = (HttpWebRequest)WebRequest.Create(url); gRequest.ContentType = "multipart/form-data; boundary=" + boundary.Replace("------","----"); gRequest.Referer = referer;// gRequest.Method = "POST"; gRequest.KeepAlive = true; gRequest.Credentials = System.Net.CredentialCache.DefaultCredentials; gRequest.Accept = "*/*"; if (!string.IsNullOrEmpty(CSRFToken)) { gRequest.Headers.Add("X-CSRFToken", CSRFToken); } gRequest.Headers.Add("X-Instagram-AJAX", "1"); gRequest.Headers.Add("X-Requested-With", "XMLHttpRequest"); gRequest.Headers.Add("Accept-Encoding", "gzip, deflate"); gRequest.Headers.Add("Accept-Language", "en-US,en;q=0.8"); gRequest.Headers.Add("Origin", "https://www.instagram.com"); gRequest.UserAgent = UserAgent; gRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; gRequest.CookieContainer = new CookieContainer(); //gCookiesContainer; ChangeProxy(proxyAddress, proxyPort, proxyUsername, proxyPassword); #region CookieManagment if (this.gCookies != null && this.gCookies.Count > 0) { gRequest.CookieContainer.Add(gCookies); } #endregion string file = string.Empty; string ContentType = string.Empty; using (Stream rs = gRequest.GetRequestStream()) { string formdataTemplate1 = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}"; string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n"; rs.Write(boundarybytes_First, 0, boundarybytes_First.Length); AllDataWriten += Encoding.UTF8.GetString(boundarybytes_First); foreach (string key in nvc.Keys) { ContentType = Regex.Split(nvc[key], "<:><:><:>")[1]; file = Regex.Split(nvc[key], "<:><:><:>")[0]; string[] filename = Regex.Split(file, "\\\\"); string header = string.Format(formdataTemplate, key, filename[filename.Length - 1], ContentType); byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(header); rs.Write(formitembytes, 0, formitembytes.Length); AllDataWriten += Encoding.UTF8.GetString(formitembytes); using (FileStream fileStream = new FileStream(localImagePath, FileMode.Open, FileAccess.Read)) { byte[] buffer = new byte[4096]; int bytesRead = 0; while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0) { rs.Write(buffer, 0, bytesRead); } } AllDataWriten += localImagePath; // rs.Write(boundarybytes, 0, boundarybytes.Length); // string formitem = string.Format(formdataTemplate, key, nvc[key]); // byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem); } // rs.Write(boundarybytes, 0, boundarybytes.Length); byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n" + boundary + "--\r\n"); rs.Write(trailer, 0, trailer.Length); AllDataWriten += Encoding.UTF8.GetString(trailer); } #region CookieManagment if (this.gCookies != null && this.gCookies.Count > 0) { gRequest.CookieContainer.Add(gCookies); } #endregion try { WebResponse wresp=null; wresp = gRequest.GetResponse(); Stream stream2 = wresp.GetResponseStream(); using (StreamReader reader2 = new StreamReader(stream2)) { responseStr = reader2.ReadToEnd(); } return responseStr; //using (WebResponse wresp = gRequest.GetResponse()) //{ // //wresp = gRequest.GetResponse(); // using (Stream stream2 = wresp.GetResponseStream()) // { // using (StreamReader reader2 = new StreamReader(stream2)) // { // response_ImageUpload = reader2.ReadToEnd(); // } // } // //log.Debug(string.Format("File uploaded, server response is: {0}", reader2.ReadToEnd())); // return response_ImageUpload; //} } catch (Exception ex) { //log.Error("Error uploading file", ex); error_ImageUpload = ex.Message; } finally { gRequest = null; } return response_ImageUpload; } catch { } return responseStr; }
public string HttpUploadFile_UploadPic_temp(ref GlobusHttpHelper HttpHelper, string userid, string url, string paramName, string contentType, string localImagePath, NameValueCollection nvc, string referer, string proxyAddress, int proxyPort, string proxyUsername, string proxyPassword) { bool isAddaCover = false; string responseStr = string.Empty; try { ////log.Debug(string.Format("Uploading {0} to {1}", file, url)); //string boundary = "---------------------------" + DateTime.Now.Ticks.ToString(""); string boundary = "---------------------------" + DateTime.Now.Ticks.ToString();//"-----------------------------" + DateTime.Now.Ticks.ToString(); byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n"); gRequest = (HttpWebRequest)WebRequest.Create(url); gRequest.ContentType = "multipart/form-data; boundary=" + boundary; //gRequest.Referer = "Referer: https://www.facebook.com/profile.php?id=" + userid + "&ref=tn_tnmn"; gRequest.Referer = referer;// "http://www.facebook.com/?sk=welcome"; gRequest.Method = "POST"; gRequest.KeepAlive = true; gRequest.Credentials = System.Net.CredentialCache.DefaultCredentials; ChangeProxy(proxyAddress, proxyPort, proxyUsername, proxyPassword); gRequest.Headers.Add("X-SVN-Rev", "827944"); gRequest.UserAgent = UserAgent; gRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; gRequest.CookieContainer = new CookieContainer(); //gCookiesContainer; #region CookieManagment if (this.gCookies != null && this.gCookies.Count > 0) { gRequest.CookieContainer.Add(gCookies); } #endregion using (Stream rs = gRequest.GetRequestStream()) { string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}"; foreach (string key in nvc.Keys) { rs.Write(boundarybytes, 0, boundarybytes.Length); string formitem = string.Format(formdataTemplate, key, nvc[key]); byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem); rs.Write(formitembytes, 0, formitembytes.Length); } rs.Write(boundarybytes, 0, boundarybytes.Length); string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n"; string header = string.Format(headerTemplate, paramName, localImagePath, contentType); byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header); rs.Write(headerbytes, 0, headerbytes.Length); using (FileStream fileStream = new FileStream(localImagePath, FileMode.Open, FileAccess.Read)) { byte[] buffer = new byte[4096]; int bytesRead = 0; while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0) { rs.Write(buffer, 0, bytesRead); } } byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n"); rs.Write(trailer, 0, trailer.Length); } #region CookieManagment if (this.gCookies != null && this.gCookies.Count > 0) { gRequest.CookieContainer.Add(gCookies); } #endregion WebResponse wresp = null; try { wresp = gRequest.GetResponse(); Stream stream2 = wresp.GetResponseStream(); using (StreamReader reader2 = new StreamReader(stream2)) { responseStr = reader2.ReadToEnd(); } return responseStr; //log.Debug(string.Format("File uploaded, server response is: {0}", reader2.ReadToEnd())); //return true; } catch (Exception ex) { //log.Error("Error uploading file", ex); if (wresp != null) { wresp.Close(); wresp = null; } // return false; } finally { gRequest = null; } return responseStr; } catch { } return responseStr; }
public bool AddaPicture(ref GlobusHttpHelper HttpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string targeturl, string message, ref string status, string pageSource_Home, string xhpc_targetid, string xhpc_composerid, string message_text, string fb_dtsg, string UsreId) { string pageSource = HttpHelper.getHtmlfromUrl(new Uri(targeturl)); bool isSentPicMessage = false; //string fb_dtsg = string.Empty; string photo_id = string.Empty; //string UsreId = string.Empty; //xhpc_composerid = string.Empty; //xhpc_targetid = string.Empty; //message_text = string.Empty; try { #region commentedCode //string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php")); //UsreId = GlobusHttpHelper.GetParamValue(pageSource_Home, "user"); //if (string.IsNullOrEmpty(UsreId)) //{ // UsreId = GlobusHttpHelper.ParseJson(pageSource_Home, "user"); //} //fb_dtsg = GlobusHttpHelper.GetParamValue(pageSource_Home, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8); //if (string.IsNullOrEmpty(fb_dtsg)) //{ // fb_dtsg = GlobusHttpHelper.ParseJson(pageSource_Home, "fb_dtsg"); //} //string pageSource_HomeData = HttpHelper.getHtmlfromUrl(new Uri(targeturl)); //xhpc_composerid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "composerid"); //xhpc_targetid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "xhpc_targetid"); #endregion string composer_session_id = ""; string tempresponse1 = ""; ///temp post { string source = ""; string profile_id = ""; string gridID = ""; string qn = string.Empty; try { string Url = "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=139180732957326&__user=100007423262870&__a=1&__dyn=7n88Oq9ccmqDxl2u5Fa8HzCqm5Aqbx2mbAKGiBAGm&__req=1t&fb_dtsg=AQCehhQg&__rev=1062230"; string posturl1 = "fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&loaded_components[0]=maininput&loaded_components[1]=cameraicon&loaded_components[2]=withtaggericon&loaded_components[3]=placetaggericon&loaded_components[4]=mainprivacywidget&loaded_components[5]=cameraicon&loaded_components[6]=mainprivacywidget&loaded_components[7]=withtaggericon&loaded_components[8]=placetaggericon&loaded_components[9]=maininput&nctr[_mod]=pagelet_group_composer&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=i&phstamp=16581688688747595501"; //"fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&istimeline=1&timelinelocation=composer&loaded_components[0]=maininput&loaded_components[1]=mainprivacywidget&loaded_components[2]=mainprivacywidget&loaded_components[3]=maininput&loaded_components[4]=explicitplaceinput&loaded_components[5]=hiddenplaceinput&loaded_components[6]=placenameinput&loaded_components[7]=hiddensessionid&loaded_components[8]=withtagger&loaded_components[9]=backdatepicker&loaded_components[10]=placetagger&loaded_components[11]=withtaggericon&loaded_components[12]=backdateicon&loaded_components[13]=citysharericon&nctr[_mod]=pagelet_timeline_recent&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=18&phstamp=1658168111112559866679"; // string PostUrl = "city_id=" + CityIDS1 + "&city_page_id=" + city_page_id + "&city_name=" + CityName1 + "&is_default=false&session_id=1362404125&__user="******"&__a=1&__dyn=798aD5z5ynU&__req=z&fb_dtsg=" + fb_dtsg + "&phstamp=1658168111112559866165"; string res11 = pageSource_Home;//HttpHelper.postFormData(new Uri(Url), posturl1); try { source = res11.Substring(res11.IndexOf("source\":"), (res11.IndexOf(",", res11.IndexOf("source\":")) - res11.IndexOf("source\":"))).Replace("source\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim(); } catch { } try { profile_id = res11.Substring(res11.IndexOf("profile_id\":"), (res11.IndexOf("}", res11.IndexOf("profile_id\":")) - res11.IndexOf("profile_id\":"))).Replace("profile_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim(); if (profile_id.Contains(",")) { profile_id = ParseEncodedJson(res11, "profile_id"); } //"gridID": } catch { } try { gridID = res11.Substring(res11.IndexOf("gridID\":"), (res11.IndexOf(",", res11.IndexOf("gridID\":")) - res11.IndexOf("gridID\":"))).Replace("gridID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim(); } catch { } try { composer_session_id = res11.Substring(res11.IndexOf("composer_session_id\":"), (res11.IndexOf("}", res11.IndexOf("composer_session_id\":")) - res11.IndexOf("composer_session_id\":"))).Replace("composer_session_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim(); } catch { } try { if (string.IsNullOrEmpty(composer_session_id)) { composer_session_id = res11.Substring(res11.IndexOf("composerID\":"), (res11.IndexOf("}", res11.IndexOf("composerID\":")) - res11.IndexOf("composerID\":"))).Replace("composerID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim(); } } catch { } try { qn = getBetween(res11, "qn\\\" value=\\\"", "\\\" \\/>"); } catch { } } catch { } NameValueCollection nvc1 = new NameValueCollection(); try { //message = Uri.EscapeDataString(message); } catch { } //xhpc_composerid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "composerid"); //xhpc_targetid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "xhpc_targetid"); //------------------------------- //nvc1.Add("fb_dtsg", fb_dtsg); //nvc1.Add("source", source); //nvc1.Add("profile_id", profile_id); //nvc1.Add("grid_id", gridID); //nvc1.Add("upload_id", "1024"); //----------------------------------- nvc1.Add("fb_dtsg", fb_dtsg); nvc1.Add("source", source); nvc1.Add("profile_id", profile_id); nvc1.Add("grid_id", gridID); nvc1.Add("upload_id", "1024"); nvc1.Add("qn", qn); //nvc1.Add("fb_dtsg", fb_dtsg); //nvc1.Add("source", source); //nvc1.Add("profile_id", profile_id); //nvc1.Add("grid_id", gridID); //nvc1.Add("upload_id", "1024"); //nvc1.Add("qn", qn); string _rev = getBetween(pageSource, "svn_rev", ","); _rev = _rev.Replace("\":", string.Empty); string uploadURL = "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=139180732957326&__user=100007423262870&__a=1&__dyn=7n88Oq9ccmqDxl2u5Fa8HzCqm5Aqbx2mbAKGiBAGm&__req=1t&fb_dtsg=AQCehhQg&__rev=1062230"; tempresponse1 = HttpUploadFile_UploadPic_temp(ref HttpHelper, UsreId, uploadURL, "composer_unpublished_photo[]", "image/jpeg", localImagePath, nvc1, "", proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword); //string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword); //string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword); tempresponse1 = HttpUploadFile_UploadPic_temp(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=" + xhpc_targetid + "&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=l&fb_dtsg=" + fb_dtsg + "", "composer_unpublished_photo[]", "image/jpeg", localImagePath, nvc1, "", proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword); } NameValueCollection nvc = new NameValueCollection(); try { //message = Uri.EscapeDataString(message); } catch { } nvc.Add("fb_dtsg", fb_dtsg); nvc.Add("xhpc_targetid", xhpc_targetid); nvc.Add("xhpc_context", "profile"); nvc.Add("xhpc_ismeta", "1"); nvc.Add("xhpc_fbx", "1"); nvc.Add("xhpc_timeline", ""); nvc.Add("xhpc_composerid", xhpc_composerid); nvc.Add("xhpc_message_text", message); nvc.Add("xhpc_message", message); //nvc.Add("name", "file1"); //nvc.Add("Content-Type:", "image/jpeg"); //nvc.Add("filename=", ""); string composer_unpublished_photo = ""; string start_composer_unpublished_photo = Regex.Split(tempresponse1, "},\"")[1];// int startIndex_composer_unpublished_photo = start_composer_unpublished_photo.IndexOf(",\"") + ",\"".Length; int endIndex_composer_unpublished_photo = start_composer_unpublished_photo.IndexOf("\"", startIndex_composer_unpublished_photo + 1); composer_unpublished_photo = start_composer_unpublished_photo.Substring(startIndex_composer_unpublished_photo, endIndex_composer_unpublished_photo - startIndex_composer_unpublished_photo); ///New test upload pic post string waterfallid = GlobusHttpHelper.ParseJson(pageSource_Home, "waterfallID"); string newpostURL = "https://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=r&fb_dtsg=" + fb_dtsg + ""; string newPostData = ""; NameValueCollection newnvc = new NameValueCollection(); try { //message = Uri.EscapeDataString(message); } catch { } newnvc.Add("fb_dtsg", fb_dtsg); newnvc.Add("xhpc_targetid", xhpc_targetid); newnvc.Add("xhpc_context", "profile"); newnvc.Add("xhpc_ismeta", "1"); newnvc.Add("xhpc_fbx", "1"); newnvc.Add("xhpc_timeline", ""); newnvc.Add("xhpc_composerid", xhpc_composerid); newnvc.Add("xhpc_message_text", message); newnvc.Add("xhpc_message", message); newnvc.Add("composer_unpublished_photo[]", composer_unpublished_photo); newnvc.Add("album_type", "128"); newnvc.Add("is_file_form", "1"); newnvc.Add("oid", ""); newnvc.Add("qn", waterfallid); newnvc.Add("application", "composer"); newnvc.Add("is_explicit_place", ""); newnvc.Add("composertags_place", ""); newnvc.Add("composertags_place_name", ""); newnvc.Add("composer_session_id", composer_session_id); newnvc.Add("composertags_city", ""); newnvc.Add("vzdisable_location_sharing", "false"); newnvc.Add("composer_predicted_city", ""); // string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword); // string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword); string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, newpostURL, "file1", "image/jpeg", localImagePath, newnvc, targeturl, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);//HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88O49ccm9o-2Ki&__req=1c&fb_dtsg=" + fb_dtsg + "", "file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword); //http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user=100004608395129 if (string.IsNullOrEmpty(response)) { try { //response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword); response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88O49ccm9o-2Ki&__req=1c&fb_dtsg=" + fb_dtsg + "", "file1", "image/jpeg", localImagePath, nvc, targeturl, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword); } catch { } } string posturl = "https://www.facebook.com/ajax/places/city_sharer_reset.php"; string postdata = "__user="******"&__a=1&fb_dtsg=" + fb_dtsg + "&phstamp=1658167761111108210145"; string responsestring = HttpHelper.postFormData(new Uri(posturl), postdata); try { string okay = HttpHelper.getHtmlfromUrl(new Uri("https://3-pct.channel.facebook.com/pull?channel=p_" + UsreId + "&seq=3&partition=69&clientid=70e140db&cb=8p7w&idle=8&state=active&mode=stream&format=json")); } catch { } if (!string.IsNullOrEmpty(response) && response.Contains("photo.php?fbid=")) { #region PostData_ForCoverPhotoSelect //fb_dtsg=AQCLSjCH&photo_id=130869487061841&profile_id=100004163701035&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user=100004163701035&__a=1&phstamp=165816776831066772182 #endregion try { if (!response.Contains("errorSummary") || !response.Contains("error")) { isSentPicMessage = true; } if (response.Contains("Your post has been submitted and is pending approval by an admin")) { GlobusLogHelper.log.Debug("Your post has been submitted and is pending approval by an admin." + "GroupUrl >>>" + targeturl); GlobusLogHelper.log.Info("Your post has been submitted and is pending approval by an admin." + "GroupUrl >>>" + targeturl); } } catch { } #region CodeCommented // string photo_idValue = response.Substring(response.IndexOf("photo.php?fbid="), response.IndexOf(";", response.IndexOf("photo.php?fbid=")) - response.IndexOf("photo.php?fbid=")).Replace("photo.php?fbid=", string.Empty).Trim(); // string[] arrphoto_idValue = Regex.Split(photo_idValue, "[^0-9]"); // foreach (string item in arrphoto_idValue) // { // try // { // if (item.Length > 6) // { // photo_id = item; // break; // } // } // catch // { // } // } // // string postData = "fb_dtsg=" + fb_dtsg + "&photo_id=" + photo_id + "&profile_id=" + UsreId + "&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user="******"&__a=1&phstamp=165816776831066772182 "; // // string postResponse = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/timeline/cover_photo_select.php"), postData); // //if (!postResponse.Contains("error")) // //{ // // //string ok = "ok"; // // isSentPicMessage = true; // //} // //if (string.IsNullOrEmpty(postResponse) || string.IsNullOrWhiteSpace(postResponse)) // //{ // // status = "Response Is Null !"; // //} // //if (postResponse.Contains("errorSummary")) // //{ // // string summary = GlobusHttpHelper.ParseJson(postResponse, "errorSummary"); // // string errorDescription = GlobusHttpHelper.ParseJson(postResponse, "errorDescription"); // // status = "Posting Error: " + summary + " | Error Description: " + errorDescription; // // //FanPagePosterLogger("Posting Error: " + summary + " | Error Description: " + errorDescription); // //} //} //catch //{ //} #endregion } } catch { } return isSentPicMessage; }
public bool EmailVerification(string Email, string Password, ref GlobusHttpHelper globushttpHelper) { bool IsActivated = false; try { Log("[ " + DateTime.Now + " ] => [ Please Wait Account Verification Start... ]"); System.Windows.Forms.Application.DoEvents(); Chilkat.Http http = new Chilkat.Http(); if (Email.Contains("@yahoo")) { #region Yahoo Verification Steps GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); bool activate = false; try { bool emaildata = false; //Chilkat.Http http = new Chilkat.Http(); ///Chilkat Http Request to be used in Http Post... Chilkat.HttpRequest req = new Chilkat.HttpRequest(); bool success; // Any string unlocks the component for the 1st 30-days. success = http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06"); if (success != true) { Console.WriteLine(http.LastErrorText); return(false); } http.CookieDir = "memory"; http.SendCookies = true; http.SaveCookies = true; //http.ProxyDomain = "127.0.0.1"; //http.ProxyPort = 8888; http.SetRequestHeader("Accept-Encoding", "gzip,deflate"); Chilkat.Imap iMap = new Imap(); string Username = Email; iMap.UnlockComponent("THEBACIMAPMAILQ_OtWKOHoF1R0Q"); //iMap. //iMap.HttpProxyHostname = "127.0.0.1"; //iMap.HttpProxyPort = 8888; iMap.Port = 993; iMap.Connect("imap.n.mail.yahoo.com"); iMap.Login(Email, Password); iMap.SelectMailbox("Inbox"); // Get a message set containing all the message IDs // in the selected mailbox. Chilkat.MessageSet msgSet; //msgSet = iMap.Search("FROM \"facebookmail.com\"", true); msgSet = iMap.GetAllUids(); if (msgSet.Count <= 0) { msgSet = iMap.GetAllUids(); } // Fetch all the mail into a bundle object. Chilkat.Email email = new Chilkat.Email(); //bundle = iMap.FetchBundle(msgSet); string strEmail = string.Empty; List <string> lstData = new List <string>(); if (msgSet != null) { for (int i = 0; i < msgSet.Count; i++) { try { email = iMap.FetchSingle(msgSet.GetId(i), true); strEmail = email.Subject; string emailHtml = email.GetHtmlBody(); lstData.Add(strEmail); string from = email.From.ToString().ToLower(); if (from.Contains("@linkedin.com")) { foreach (string href in GetUrlsFromString(email.Body)) { try { if (href.Contains("http://www.linkedin.com/e/csrf") || href.Contains("http://www.linkedin.com/e/ato") || href.Contains("http://www.linkedin.com/e/v2?e")) { string EscapeEmail = Uri.EscapeDataString(Email).Replace(".", "%2E").Trim(); { string ConfirmationResponse = globushttpHelper.getHtmlfromUrl1(new Uri(href)); IsActivated = true; break; } } } catch (Exception ex) { Console.WriteLine("6 :" + ex.StackTrace); } } } if (IsActivated) { Log("[ " + DateTime.Now + " ] => [ Account : " + Email + " verified ]"); break; } } catch (Exception ex) { Console.WriteLine("Error >>> " + ex.StackTrace); } } } } catch (Exception ex) { Console.WriteLine("7 :" + ex.StackTrace); Log("[ " + DateTime.Now + " ] => [ Email Verification Exception : " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " with : " + Email + " ]"); Log("[ " + DateTime.Now + " ] => [ Please check your Login Id and Password ]"); } return(IsActivated); #endregion } else { string Host = string.Empty; int Port = 0; if (Email.Contains("@gmail")) { Host = "pop.gmail.com"; Port = 995; } else if (Email.Contains("@hotmail")) { Host = "pop3.live.com"; Port = 995; } else if (Email.Contains("@gmx")) { Host = "pop.gmx.com"; Port = 995; } if (!string.IsNullOrEmpty(Host)) { try { if (popClient.Connected) { popClient.Disconnect(); } popClient.Connect(Host, Port, true); popClient.Authenticate(Email, Password); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); //retry once System.Threading.Thread.Sleep(1000); if (popClient.Connected) { popClient.Disconnect(); } popClient.Connect(Host, Port, true); popClient.Authenticate(Email, Password); } //if (!) //{ //} int Count = popClient.GetMessageCount(); for (int i = Count; i >= 1; i--) { try { OpenPOP.MIME.Message Message = popClient.GetMessage(i); string subject = string.Empty; subject = Message.Headers.Subject; string frowwm = Message.Headers.From.ToString(); bool GoIntoEmail = false; if (string.IsNullOrEmpty(subject)) { string from = Message.Headers.From.ToString().ToLower(); if (from.Contains("linkedin.com")) { GoIntoEmail = true; } } try { if (frowwm.Contains("linkedin.com")) //if(GoIntoEmail) { string Messagebody = Message.MessageBody[0]; foreach (string href in GetUrlsFromStringGmail(Messagebody)) { try { if (href.Contains("http://www.linkedin.com/e/csrf") || href.Contains("http://www.linkedin.com/e/ato") || href.Contains("http://www.linkedin.com/e/v2?e")) { string href1 = href.Replace("amp;", string.Empty); string EscapeEmail = Uri.EscapeDataString(Email).Replace(".", "%2E").Trim(); { string ConfirmationResponse = globushttpHelper.getHtmlfromUrl1(new Uri(href1)); IsActivated = true; break; } } } catch (Exception ex) { Console.WriteLine("5 :" + ex.StackTrace); }; } } } catch (Exception ex) { Console.WriteLine("10 :" + ex.StackTrace); Log("[ " + DateTime.Now + " ] => [ Email Verification Exception : " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " with : " + Email + " ]"); } if (IsActivated) { break; } } catch (Exception ex) { { Log("[ " + DateTime.Now + " ] => [ Email Verification Exception : " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " with : " + Email + " ]"); Log("[ " + DateTime.Now + " ] => [ Please check your Login Id and Password ]"); } } } } } return(IsActivated); } catch (Exception ex) { Console.WriteLine("4 :" + ex.StackTrace); return(IsActivated); } }
public void PostAddGroupUrl(object parameter) { try { try { if (IsStop) { return; } if (!IsStop) { lstLinkedinJoinGroupUrlThraed.Add(Thread.CurrentThread); lstLinkedinJoinGroupUrlThraed.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } } catch { } if (!string.IsNullOrEmpty(txtNumberOfGroupsPerAccount.Text) && NumberHelper.ValidateNumber(txtNumberOfGroupsPerAccount.Text)) { Groups.JoinSearchGroup.CountPerAccount = Convert.ToInt32(txtNumberOfGroupsPerAccount.Text); } Array paramsArray = new object[1]; paramsArray = (Array)parameter; KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0); List<string> lstJoinGroupUrl = (List<string>)paramsArray.GetValue(1); GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); LinkedinLogin Login = new LinkedinLogin(); Login.accountUser = item.Key; Login.accountPass = item.Value._Password; Login.proxyAddress = item.Value._ProxyAddress; Login.proxyPort = item.Value._ProxyPort; Login.proxyUserName = item.Value._ProxyUsername; Login.proxyPassword = item.Value._ProxyPassword; Groups.JoinSearchGroup obj_JoinSearchGroup = new Groups.JoinSearchGroup(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword); Login.logger.addToLogger += new EventHandler(logger_SearchGroupaddToLogger); int minDelay = 20; int maxDelay = 25; if (!string.IsNullOrEmpty(txtSearchGroupMinDelay.Text) && NumberHelper.ValidateNumber(txtSearchGroupMinDelay.Text)) { minDelay = Convert.ToInt32(txtSearchGroupMinDelay.Text); } if (!string.IsNullOrEmpty(txtSearchGroupMaxDelay.Text) && NumberHelper.ValidateNumber(txtSearchGroupMaxDelay.Text)) { maxDelay = Convert.ToInt32(txtSearchGroupMaxDelay.Text); } //if (lstJoinGroupUrl.Count > 0) //{ // JoinSearchGroup.JoinSearchGroup.lstLinkedinGroupURL = lstJoinGroupUrl; //} if (!Login.IsLoggedIn) { Login.LoginHttpHelper(ref HttpHelper); } if (Login.IsLoggedIn) { GroupStatus dataScrape = new GroupStatus(); Dictionary<string, string> Result = obj_JoinSearchGroup.PostAddOpenGroupsUsingUrl(ref HttpHelper, Login.accountUser, minDelay, maxDelay, lstJoinGroupUrl, IsDevideData); LinkdInContacts.Add(Login.accountUser, Result); } //AddLoggerJoinGroupUrl("[ " + DateTime.Now + " ] => [ Now Joining Groups Process Running ]"); //string MessagePosted = obj_JoinSearchGroup.PostAddGroupUsingUrl(ref HttpHelper,LinkdInContacts, Login.accountUser, Login.accountPass, minDelay, maxDelay); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostAddSearchGroups() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostAddSearchGroups() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs); } finally { counter_JoinGroupUrlID--; if (counter_JoinGroupUrlID == 0) { btnJoinSearchGroup.Invoke(new MethodInvoker(delegate { AddLoggerJoinGroupUrl("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); AddLoggerJoinGroupUrl("----------------------------------------------------------------------------------------------------------"); btnJoinSearchGroup.Cursor = Cursors.Default; })); } } }
public bool SetProfilePic(ref GlobusHttpHelper HttpHelper, string profileId, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref string status, string UploadInfoData) { string FirstGetREsponse = string.Empty; try { FirstGetREsponse = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/edit-picture-info?trk=prof-ovw-edit-photo")); } catch { } if (string.IsNullOrEmpty(FirstGetREsponse)) { try { FirstGetREsponse = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/profile/edit-picture-info?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&trk=prof-ovw-edit-photo")); } catch { } } string[] upload_infoArr = Regex.Split(FirstGetREsponse, " name=\"upload_info"); string upload_infow = string.Empty; string upload_infowithjs = string.Empty; if (true) { try { upload_infow = upload_infoArr[1].Substring(upload_infoArr[1].IndexOf("value="), upload_infoArr[1].IndexOf(">") - upload_infoArr[1].IndexOf("value=")).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("/", string.Empty).Trim(); } catch { } try { upload_infowithjs = upload_infoArr[2].Substring(upload_infoArr[2].IndexOf("value="), upload_infoArr[2].IndexOf(">") - upload_infoArr[2].IndexOf("value=")).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("/", string.Empty).Trim(); } catch { } } else { //try //{ // string[] upload_infoArr1 = Regex.Split(FirstGetREsponse, "id\":\"upload_info"); // upload_infow = upload_infoArr1[1].Substring(upload_infoArr1[1].IndexOf("value\":"), upload_infoArr1[1].IndexOf("type") - upload_infoArr1[1].IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace(",", string.Empty).Trim(); //} //catch { } } string posturi = string.Empty; if (FirstGetREsponse.Contains("name=\"uploadMemberPicture")) { try { string[] MemberPicture = Regex.Split(FirstGetREsponse, "name=\"uploadMemberPicture"); posturi = MemberPicture[1].Substring(MemberPicture[1].IndexOf("action="), MemberPicture[1].IndexOf("method=") - MemberPicture[1].IndexOf("action=")).Replace("action=", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("/", string.Empty).Trim(); } catch { } } bool isSetProfilePic = false; try { string upload_info = ""; upload_info = upload_infow; string upload_info_with_js = ""; upload_info_with_js = upload_infowithjs; //upload_info = upload_info.Replace("&dsh;", "-"); ; //upload_info_with_js = upload_info; string callback = ""; callback = "profilePicture.processResponse"; NameValueCollection nvc = new NameValueCollection(); nvc.Add("upload_info", upload_info_with_js); nvc.Add("upload_info_with_js", upload_info_with_js); nvc.Add("callback", callback); //nvc.Add("Content-Type:", "image/jpeg"); posturi = posturi.Replace("mupld", string.Empty); //string response = HttpHelper.HttpUploadProfilePic(ref HttpHelper, profileId, "http://www.linkedin.com/mupld/" + posturi, "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); string response = string.Empty; try { response = HttpHelper.HttpUploadProfilePic(ref HttpHelper, profileId, "http://www.linkedin.com/mupld/upload", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); } catch { } if (string.IsNullOrEmpty(response)) { response = HttpHelper.HttpUploadProfilePic(ref HttpHelper, profileId, "https://www.linkedin.com/mupld/upload?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword); //http://www.linkedin.com/mupld/process?filter=car450&return_type=html&mid=%2Fp/6/005/025/1b7/34bf4a0.jpg&callback=profilePicture.savePhoto&filters_scale_h=397&filters_scale_w=600&filters_crop_x=101&filters_crop_y=0&filters_crop_h=396.99966&filters_crop_w=396.99966&filters_rotate_t= } string Images1 = string.Empty; if (response.Contains("SUCCESS")) { try { Images1 = response.Substring(response.IndexOf("value\":"), response.IndexOf("}") - response.IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim(); Images1 = Images1.Substring(1, (Images1.Length - 1)); Images1 = Images1.Remove(Images1.IndexOf(",")); Images1 = "/" + Images1; } catch { } } string csrfToken = string.Empty; string sourceAlias = string.Empty; if (FirstGetREsponse.Contains("csrfToken")) { try { int startindex = FirstGetREsponse.IndexOf("csrfToken"); if (startindex > 0) { string start = FirstGetREsponse.Substring(startindex); int endindex = start.IndexOf("\">"); string end = start.Substring(0, endindex); csrfToken = end.Replace("csrfToken=", "").Replace("\\", ""); } else { string[] Arr = csrfToken.Split('"'); csrfToken = Arr[2].Replace("\\", string.Empty); } } catch { try { csrfToken = FirstGetREsponse.Substring(FirstGetREsponse.IndexOf("csrfToken"), 100); if (csrfToken.Contains("&")) { string[] Arr = csrfToken.Split('&'); csrfToken = Arr[0]; } else if (csrfToken.Contains(",")) { string[] Arr = csrfToken.Split(','); csrfToken = Arr[0].Replace("\\", string.Empty); } else { string[] Arr = csrfToken.Split(','); csrfToken = Arr[0].Replace("\\", string.Empty).Replace("csrfToken=", "").Replace("\n", "").Replace("\">", ""); } } catch { } } } if (FirstGetREsponse.Contains("sourceAlias")) { try { sourceAlias = FirstGetREsponse.Substring(FirstGetREsponse.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2].Replace("\\", string.Empty); } catch { } } if (string.IsNullOrEmpty(sourceAlias)) { if (FirstGetREsponse.Contains("sourceAlias")) { try { sourceAlias = FirstGetREsponse.Substring(FirstGetREsponse.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2]; } catch { } } } string Images = string.Empty; string FirstGet = string.Empty; string setMaskWidth = string.Empty; string setMaskHeight = string.Empty; string setMaskTop = string.Empty; string setMaskLeft = string.Empty; string setCropFilter = string.Empty; if (FirstGetREsponse.Contains("profilePicture.setMaskWidth")) { try { string[] setMaskWidthArr = Regex.Split(FirstGetREsponse, "profilePicture.setMaskWidth"); Match match = Regex.Match(setMaskWidthArr[1], @"\((.*?)\)"); if (match.Groups.Count > 1) { setMaskWidth = match.Groups[1].Value; } } catch { } } if (FirstGetREsponse.Contains("profilePicture.setMaskHeight")) { try { string[] setMaskHeightArr = Regex.Split(FirstGetREsponse, "profilePicture.setMaskHeight"); Match match = Regex.Match(setMaskHeightArr[1], @"\((.*?)\)"); if (match.Groups.Count > 1) { setMaskHeight = match.Groups[1].Value; } } catch { } } if (FirstGetREsponse.Contains("profilePicture.setMaskTop")) { try { string[] setMaskTopArr = Regex.Split(FirstGetREsponse, "profilePicture.setMaskTop"); Match match = Regex.Match(setMaskTopArr[1], @"\((.*?)\)"); if (match.Groups.Count > 1) { setMaskTop = match.Groups[1].Value; } } catch { } } if (FirstGetREsponse.Contains("profilePicture.setMaskLeft")) { try { string[] setMaskLeftArr = Regex.Split(FirstGetREsponse, "profilePicture.setMaskLeft"); Match match = Regex.Match(setMaskLeftArr[1], @"\((.*?)\)"); if (match.Groups.Count > 1) { setMaskLeft = match.Groups[1].Value; } } catch { } } if (FirstGetREsponse.Contains("profilePicture.setCropFilter")) { try { string[] setCropFilterArr = Regex.Split(FirstGetREsponse, "profilePicture.setCropFilter"); Match match = Regex.Match(setCropFilterArr[1], @"\((.*?)\)"); if (match.Groups.Count > 1) { setCropFilter = match.Groups[1].Value; } } catch { } } //profilePicture.setCropFilter try { // string FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=car80&return_type=html&mid=%2Fp"+Images1+"&callback=profilePicture.savePhoto&filters_scale_h=80&filters_scale_w=335&filters_crop_x=0&filters_crop_y=0&filters_crop_h=335&filters_crop_w=335&filters_rotate_t=")); // string FirstGet = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=car80&return_type=html&mid=%2F" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=80&filters_scale_w=346&filters_crop_x=0&filters_crop_y=0&filters_crop_h=346&filters_crop_w=346&filters_rotate_t=")); #region Setting Image Parameters float w = 200, h = 200; try { //GetJpegDimension(localImagePath, out h, out w); System.Drawing.Size sz = ImageHelper.GetDimensions(localImagePath); w = sz.Width; h = sz.Height; } catch { } float filters_scale_h = RandomNumberGenerator.GenerateRandom(187, 187); float filters_scale_w = RandomNumberGenerator.GenerateRandom(187, 187); int filters_crop_h = RandomNumberGenerator.GenerateRandom(187, 187); int filters_crop_w = filters_crop_h; if (w >= 3000) { w = 3000; } if (h >= 800) { h = 800; } float heightwidthratio = h / w; filters_scale_w = w; filters_scale_h = w * heightwidthratio; if (filters_scale_w < filters_scale_h) { filters_crop_w = (int)filters_scale_w; } else { filters_crop_w = (int)filters_scale_h - 5; } if (filters_crop_w > 350) { filters_crop_w = RandomNumberGenerator.GenerateRandom(187,187); } #endregion //if (string.IsNullOrEmpty(setMaskHeight)) { try { FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?filter=" + "car450" + "&return_type=html&mid=" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=" + (int)filters_scale_h + "&filters_scale_w=" + (int)filters_scale_w + "&filters_crop_x=0&filters_crop_y=0&filters_crop_h=" + filters_scale_h + "&filters_crop_w=" + filters_scale_h + "&filters_rotate_t="));//filters_crop_h=135&filters_crop_w=135&filters_rotate_t=")); if (string.IsNullOrEmpty(FirstGet)) { System.Threading.Thread.Sleep(500); FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?filter=" + "car450" + "&return_type=html&mid=" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=" + (int)filters_scale_h + "&filters_scale_w=" + (int)filters_scale_w + "&filters_crop_x=0&filters_crop_y=0&filters_crop_h=" + filters_crop_w + "&filters_crop_w=" + filters_crop_w + "&filters_rotate_t="));//filters_crop_h=135&filters_crop_w=135&filters_rotate_t=")); } //FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?filter=" + "car450" + "&return_type=html&mid=" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=" + 180 + "&filters_scale_w=" + 180 + "&filters_crop_x=0&filters_crop_y=0&filters_crop_h=" + 145 + "&filters_crop_w=" + 145 + "&filters_rotate_t="));//filters_crop_h=135&filters_crop_w=135&filters_rotate_t=")); string mid = ""; if (FirstGet.Contains("SUCCESS")) { try { mid = FirstGet.Substring(FirstGet.IndexOf("value\":"), FirstGet.IndexOf("}") - FirstGet.IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim(); mid = mid.Substring(1, (mid.Length - 1)); //mid = mid.Remove(mid.IndexOf(",")); mid = "/" + mid; // Images = Uri.EscapeDataString(Images); } catch { } } string gup_savecroppic = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/save-crop-picture?csrfToken=" + csrfToken + "&masterTempID=" + Images1 + "&croppedTempID=" + mid + "&xParam=0&yParam=0&xSizeParam=" + filters_crop_w + "&ySizeParam=" + filters_crop_w + "&nsave=n"));//xSizeParam=292&ySizeParam=292&nsave=n")); //string gup_savecroppic = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/save-crop-picture?csrfToken=" + csrfToken + "&masterTempID=" + Images1 + "&croppedTempID=" + mid + "&xParam=0&yParam=0&xSizeParam=" + 135 + "&ySizeParam=" + 135 + "&nsave=n"));//xSizeParam=292&ySizeParam=292&nsave=n")); //http://www.linkedin.com/profile/edit-picture-info?trk=nprofile-save-picture-submit&report%2Esuccess=9dCbijuoBwCwpKulrwnkugn6gmZHePJOoeK5jlW7JYSHYSSp-w55jdor_TR6umL } catch { } #region Old code //if (string.IsNullOrEmpty(FirstGet)) //{ // try // { // FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=car80&return_type=html&mid=%2F" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=80&filters_scale_w=80&filters_crop_x=0&filters_crop_y=0&filters_crop_h=335&filters_crop_w=335&filters_rotate_t=")); // } // catch { } //} //if (FirstGet.Contains("SUCCESS")) //{ // try // { // Images = FirstGet.Substring(FirstGet.IndexOf("value\":"), FirstGet.IndexOf("}") - FirstGet.IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim(); // Images = Images.Substring(1, (Images.Length - 1)); // // Images = Uri.EscapeDataString(Images); // } // catch { } //} #endregion } #region Old Code //else //{ // try // { // FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=" + setCropFilter + "&return_type=html&mid=%2F" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=" + setMaskHeight + "&filters_scale_w=" + setMaskWidth + "&filters_crop_x=" + setMaskLeft + "&filters_crop_y=" + setMaskTop + "&filters_crop_h=" + setMaskHeight + "&filters_crop_w=" + setMaskWidth + "&filters_rotate_t=")); // } // catch { } // if (string.IsNullOrEmpty(FirstGet)) // { // FirstGet = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=" + setCropFilter + "&return_type=html&mid=%2F" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=80&filters_scale_w=80&filters_crop_x=" + setMaskLeft + "&filters_crop_y=" + setMaskTop + "&filters_crop_h=" + setMaskHeight + "&filters_crop_w=" + setMaskWidth + "&filters_rotate_t=")); // } // if (FirstGet.Contains("SUCCESS")) // { // try // { // Images = FirstGet.Substring(FirstGet.IndexOf("value\":"), FirstGet.IndexOf("}") - FirstGet.IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim(); // Images = Images.Substring(1, (Images.Length - 1)); // // Images = Uri.EscapeDataString(Images); // } // catch { } // } // if (string.IsNullOrEmpty(FirstGet)) // { // try // { // FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=car80&return_type=html&mid=%2F" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=80&filters_scale_w=80&filters_crop_x=0&filters_crop_y=0&filters_crop_h=335&filters_crop_w=335&filters_rotate_t=")); // } // catch { } // } //} #endregion } catch { } #region Old code //string thirdresponse = string.Empty; //try //{ // string secondGetResponsee = string.Empty; // try // { // secondGetResponsee = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/save-crop-picture?csrfToken=" + csrfToken + "&masterTempID=%2F" + Images + "&croppedTempID=%2F" + Images1 + "&xParam=0&yParam=0&xSizeParam=80&ySizeParam=80&nsave=n")); // } // catch { } // if (secondGetResponsee.Contains("name=\"currenturl")) // { // try // { // string[] currenturlArr = Regex.Split(secondGetResponsee, "name=\"currenturl"); // string currenturl = currenturlArr[1].Substring(currenturlArr[1].IndexOf("value=\""), currenturlArr[1].IndexOf(">") - currenturlArr[1].IndexOf("value=\"")).Replace("value=\"", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim(); // currenturl = Uri.UnescapeDataString(currenturl); // currenturl = Regex.Split(currenturl, "&urlhash")[0]; // // string thirdresponse = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/edit-picture-info?trk=nprofile-save-picture-submit&report%2Esuccess=9dCbijuoBwCwpKulrwnkugn6gmZHePJOoeK5jlW7JYSHYSSp-w55jdor_TR6umL")); // thirdresponse = HttpHelper.getHtmlfromUrl(new Uri(currenturl)); // } // catch { } // } //} //catch { } //try //{ // string postSavePictureData = "pictureVisibility=NETWORK&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "&goback=.npv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1.npe_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1"; // string PostSavePictureUrl = "http://www.linkedin.com/profile/edit-picture-visibility-submit"; // string responsess = HttpHelper.postFormData(new Uri(PostSavePictureUrl), postSavePictureData); // string GetResponse=HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/edit?goback=%2Enpv_"+profileId+"_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1%2Enpe_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&trk=nprofile-save-picture-settings-submit&report%2Esuccess=88GfZh25oYpGMv_ncXhqwkk2axsD1cOiNrQErX7HNxy7raoMejQEhfBsYJTYoZpJLJh9oM")); //} //catch { } //try //{ // //string secondpostUrl="https://www.linkedin.com/mupld/upload?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1%2Enpe_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1"; // //string posturl = "pkey=PAGEKEY_PLACEHOLDER&tcode=ntf_click_notifications_icon&plist=alert_count%3A0&prefix=false"; // //string secondres=HttpHelper.postFormData(new Uri(secondpostUrl), posturl); //} //catch { } ////name="sourceAlias" #endregion if (!string.IsNullOrEmpty(FirstGet) && !string.IsNullOrEmpty(response)) { if (FirstGet.Contains("SUCCESS") && response.Contains("SUCCESS")) // && !thirdresponse.Contains("error") && !string.IsNullOrEmpty(response) && !response.Contains("error")) { isSetProfilePic = true; } if (!string.IsNullOrEmpty(response) && !response.Contains("error")) { } } else { return isSetProfilePic; } } catch { } return isSetProfilePic; }
public string HttpUploadFile_AddaCover(ref GlobusHttpHelper HttpHelper, string userid, string url, string paramName, string contentType, string localImagePath, NameValueCollection nvc, string proxyAddress, int proxyPort, string proxyUsername, string proxyPassword) { #region PostData_ForUploadImage //-----------------------------68682554727644 //Content-Disposition: form-data; name="fb_dtsg" //AQCLSjCH // -----------------------------68682554727644 //Content-Disposition: form-data; name="pic"; filename="Hydrangeas.jpg" //Content-Type: image/jpeg //���� #endregion bool isAddaCover = false; string responseStr = string.Empty; try { ////log.Debug(string.Format("Uploading {0} to {1}", file, url)); //string boundary = "---------------------------" + DateTime.Now.Ticks.ToString(""); string boundary = "---------------------------" + DateTime.Now.Ticks.ToString(); byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n"); gRequest = (HttpWebRequest)WebRequest.Create(url); gRequest.ContentType = "multipart/form-data; boundary=" + boundary; gRequest.Referer = "Referer: https://www.facebook.com/profile.php?id=" + userid + "&ref=tn_tnmn"; gRequest.Method = "POST"; gRequest.KeepAlive = true; gRequest.Credentials = System.Net.CredentialCache.DefaultCredentials; ChangeProxy(proxyAddress, proxyPort, proxyUsername, proxyPassword); gRequest.CookieContainer = new CookieContainer(); //gCookiesContainer; #region CookieManagment if (this.gCookies != null && this.gCookies.Count > 0) { gRequest.CookieContainer.Add(gCookies); } #endregion Stream rs = gRequest.GetRequestStream(); int tempi = 0; string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}"; foreach (string key in nvc.Keys) { string formitem = string.Empty; if (tempi == 0) { byte[] firstboundarybytes = System.Text.Encoding.ASCII.GetBytes("--" + boundary + "\r\n"); rs.Write(firstboundarybytes, 0, firstboundarybytes.Length); formitem = string.Format(formdataTemplate, key, nvc[key]); byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem); rs.Write(formitembytes, 0, formitembytes.Length); tempi++; continue; } //rs.Write(boundarybytes, 0, boundarybytes.Length); //formitem = string.Format(formdataTemplate, key, nvc[key]); //byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem); //rs.Write(formitembytes, 0, formitembytes.Length); } rs.Write(boundarybytes, 0, boundarybytes.Length); string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n"; string header = string.Format(headerTemplate, paramName, localImagePath, contentType); byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header); rs.Write(headerbytes, 0, headerbytes.Length); FileStream fileStream = new FileStream(localImagePath, FileMode.Open, FileAccess.Read); byte[] buffer = new byte[4096]; int bytesRead = 0; while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0) { rs.Write(buffer, 0, bytesRead); } fileStream.Close(); byte[] trailer3 = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n"); rs.Write(trailer3, 0, trailer3.Length); string trailerTemplate1 = "Content-Disposition: form-data; name=\"profile_id\"\r\n\r\n{0}\r\n"; string trailer1 = string.Format(trailerTemplate1, userid); byte[] arrtrailer1 = System.Text.Encoding.UTF8.GetBytes(trailer1); rs.Write(arrtrailer1, 0, arrtrailer1.Length); byte[] trailer4 = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n"); rs.Write(trailer4, 0, trailer3.Length); string trailerTemplate2 = "Content-Disposition: form-data; name=\"source\"\r\n\r\n{0}\r\n"; string trailer2 = string.Format(trailerTemplate2, "10"); byte[] arrtrailer2 = System.Text.Encoding.UTF8.GetBytes(trailer2); rs.Write(arrtrailer2, 0, arrtrailer2.Length); byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n"); rs.Write(trailer, 0, trailer.Length); rs.Close(); #region CookieManagment if (this.gCookies != null && this.gCookies.Count > 0) { gRequest.CookieContainer.Add(gCookies); } #endregion WebResponse wresp = null; try { wresp = gRequest.GetResponse(); Stream stream2 = wresp.GetResponseStream(); StreamReader reader2 = new StreamReader(stream2); responseStr = reader2.ReadToEnd(); //log.Debug(string.Format("File uploaded, server response is: {0}", reader2.ReadToEnd())); return responseStr; } catch (Exception ex) { //log.Error("Error uploading file", ex); if (wresp != null) { wresp.Close(); wresp = null; } // return false; } } catch { } finally { gRequest = null; } return responseStr; }
public void PostFinalMsgGroupMember_1By1(ref GlobusHttpHelper HttpHelper, Dictionary<string, string> SlectedContacts,List<string> GrpMemSubjectlist,List<string> GrpMemMessagelist, string msg, string body, string UserName, string FromemailId, string FromEmailNam, string SelectedGrpName, string grpId,bool mesg_with_tag,bool msg_spintaxt, int mindelay, int maxdelay,bool preventMsgSameGroup,bool preventMsgWithoutGroup,bool preventMsgGlobal) { try { MsgGroupMemDbManager objMsgGroupMemDbMgr = new MsgGroupMemDbManager(); string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string sourceAlias = string.Empty; string ReturnString = string.Empty; string PostMsgSubject = string.Empty; string PostMsgBody = string.Empty; string FString = string.Empty; try { string MessageText = string.Empty; string PostedMessage = string.Empty; string senderEmail = string.Empty; string getComposeData = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/inbox/compose")); try { int startindex = getComposeData.IndexOf("\"senderEmail\" value=\""); if (startindex < 0) { startindex = getComposeData.IndexOf("\"senderEmail\",\"value\":\""); } string start = getComposeData.Substring(startindex).Replace("\"senderEmail\" value=\"", string.Empty).Replace("\"senderEmail\",\"value\":\"",string.Empty); int endindex = start.IndexOf("\"/>"); if (endindex < 0) { endindex = start.IndexOf("\",\""); } string end = start.Substring(0, endindex).Replace("\"/>", string.Empty).Replace("\",\"",string.Empty); senderEmail = end.Trim(); } catch {} string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top")); if (pageSource.Contains("csrfToken")) { try { csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50); string[] Arr = csrfToken.Split('<'); csrfToken = Arr[0]; csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n",string.Empty).Replace(">",string.Empty).Replace("<script typ",string.Empty); csrfToken = csrfToken.Trim(); } catch (Exception ex) { } } if (pageSource.Contains("sourceAlias")) { try { sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2]; } catch (Exception ex) { } } if (pageSource.Contains("goback=")) { try { } catch (Exception ex) { } } foreach (KeyValuePair<string, string> itemChecked in SlectedContacts) { try { DataSet ds = new DataSet(); DataSet ds_bList = new DataSet(); string ContactName = string.Empty; string Nstring = string.Empty; string connId = string.Empty; string FName = string.Empty; string Lname = string.Empty; string tempBody = string.Empty; string n_ame1 = string.Empty; //grpId = itemChecked.Key.ToString(); try { // FName = itemChecked.Value.Split(' ')[0]; // Lname = itemChecked.Value.Split(' ')[1]; try { n_ame1 = itemChecked.Value.Split(']')[1].Trim(); ; } catch { } if (string.IsNullOrEmpty(n_ame1)) { try { n_ame1 = itemChecked.Value; } catch { } } string[] n_ame = Regex.Split(n_ame1, " "); FName = " " + n_ame[0]; Lname = n_ame[1]; if (!string.IsNullOrEmpty(n_ame[2])) { Lname = Lname + n_ame[2]; } if (!string.IsNullOrEmpty(n_ame[3])) { Lname = Lname + n_ame[3]; } if (!string.IsNullOrEmpty(n_ame[4])) { Lname = Lname + n_ame[4]; } if (!string.IsNullOrEmpty(n_ame[5])) { Lname = Lname + n_ame[5]; } } catch (Exception ex) { } try { ContactName = FName + " " + Lname; ContactName = ContactName.Replace("%20", " "); } catch { } Log("[ " + DateTime.Now + " ] => [ Adding Contact : " + ContactName + " ]"); string ToCd = itemChecked.Key; List<string> AddAllString = new List<string>(); if (FString == string.Empty) { string CompString = "{" + "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}"; FString = CompString; } else { string CompString = "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}"; FString = CompString; } if (Nstring == string.Empty) { Nstring = FString; connId = ToCd; } else { Nstring += "," + FString; connId += " " + ToCd; } Nstring += "}"; try { string PostMessage = string.Empty; string ResponseStatusMsg = string.Empty; Log("[ " + DateTime.Now + " ] => [ Message Sending Process Running.. ]"); if (msg_spintaxt == true) { try { msg = GrpMemSubjectlist[RandomNumberGenerator.GenerateRandom(0, GrpMemSubjectlist.Count - 1)]; body = GrpMemMessagelist[RandomNumberGenerator.GenerateRandom(0, GrpMemMessagelist.Count - 1)]; } catch { } } if (mesg_with_tag == true) { if (string.IsNullOrEmpty(FName)) { tempBody = body.Replace("<Insert Name>", ContactName); } else { tempBody = body.Replace("<Insert Name>", FName); } } else { if (string.IsNullOrEmpty(FName)) { tempBody = body.Replace("<Insert Name>", ContactName); } else { tempBody = body.Replace("<Insert Name>", FName); } } if (SelectedGrpName.Contains(":")) { try { string[] arrSelectedGrpName = Regex.Split(SelectedGrpName, ":"); if (arrSelectedGrpName.Length > 1) { SelectedGrpName = arrSelectedGrpName[1]; } } catch (Exception ex) { } } if (mesg_with_tag == true) { tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName); tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam); tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty); } else { tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName); tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam); tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty); } //Check BlackListed Accounts try { string Querystring = "Select ProfileID From tb_BlackListAccount Where ProfileID ='" + grpId + "'"; ds_bList = DataBaseHandler.SelectQuery(Querystring, "tb_BlackListAccount"); } catch { } if (preventMsgSameGroup) { try { string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgGroupId = " + grpId + " and MsgToId = " + connId + ""; ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem"); } catch { } } if (preventMsgWithoutGroup) { try { string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgToId = " + connId + ""; ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem"); } catch { } } if (preventMsgGlobal) { try { string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgToId = " + connId + ""; ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem"); } catch { } } try { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { PostMessage = ""; ResponseStatusMsg = "Already Sent"; } else { if (ds_bList.Tables.Count > 0 && ds_bList.Tables[0].Rows.Count > 0) { Log("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]"); ResponseStatusMsg = "BlackListed"; } else { PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + ""; ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage); } } } else { if (ds_bList.Tables.Count > 0) { if (ds_bList.Tables[0].Rows.Count > 0) { Log("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]"); ResponseStatusMsg = "BlackListed"; } else { PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + ""; ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage); } } } } catch (Exception) { //PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeintsfromName=" + Uri.EscapeDataString(FromEmailNam) + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + ""; //ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage); } if ((!ResponseStatusMsg.Contains("Your message was successfully sent.") && !ResponseStatusMsg.Contains("Already Sent")) && (!ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") && !ResponseStatusMsg.Contains("Ya ha sido enviada") && !ResponseStatusMsg.Contains("Uw bericht is verzonden"))) { if (ResponseStatusMsg.Contains("Already Sent") || (ResponseStatusMsg.Contains("Ya ha sido enviada") || (ResponseStatusMsg.Contains("BlackListed")))) { continue; } try { pageSource = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groups?viewMembers=&gid=" + grpId)); if (pageSource.Contains("contentType=")) { try { string contentType = pageSource.Substring(pageSource.IndexOf("contentType="), pageSource.IndexOf("&", pageSource.IndexOf("contentType=")) - pageSource.IndexOf("contentType=")).Replace("contentType=", string.Empty).Replace("contentType=", string.Empty).Trim(); string pageSource2 = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groupMsg?displayCreate=&contentType=" + contentType + "&connId=" + connId + "&groupID=" + grpId + "")); PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeints&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Uri.EscapeUriString(Nstring) + "&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=" + contentType + "&groupID=" + grpId + ""; } catch (Exception ex) { } } ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage); } catch (Exception ex) { } } if ((ResponseStatusMsg.Contains("Your message was successfully sent.")) || (ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") || (ResponseStatusMsg.Contains("Uw bericht is verzonden")))) { Log("[ " + DateTime.Now + " ] => [ Subject Posted : " + msg + " ]"); Log("[ " + DateTime.Now + " ] => [ Body Text Posted : " + tempBody.ToString() + " ]"); Log("[ " + DateTime.Now + " ] => [ Message Posted To Account: " + ContactName + " ]"); ReturnString = "Your message was successfully sent."; #region CSV string bdy = string.Empty; try { bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " "); } catch { } if (string.IsNullOrEmpty(bdy)) { bdy = tempBody.ToString().Replace(",", ":"); } string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName"; string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageSentGroupMember); try { objMsgGroupMemDbMgr.InsertMsgGroupMemData(UserName, Convert.ToInt32(connId), ContactName, Convert.ToInt32(grpId), SelectedGrpName, msg, tempBody); } catch { } #endregion } else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request")) { Log("[ " + DateTime.Now + " ] => [ There was an unexpected problem that prevented us from completing your request ! ]"); GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember); } else if (ResponseStatusMsg.Contains("You are no longer authorized to message this")) { Log("[ " + DateTime.Now + " ] => [ You are no longer authorized to message this ! ]"); GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember); } else if ((ResponseStatusMsg.Contains("Already Sent")) || (ResponseStatusMsg.Contains("Ya ha sido enviada"))) { string bdy = string.Empty; try { bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " "); } catch { } if (string.IsNullOrEmpty(bdy)) { bdy = tempBody.ToString().Replace(",", ":"); } string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName"; string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageAlreadySentGroupMember); Log("[ " + DateTime.Now + " ] => [ Message Not Posted To Account: " + ContactName + " because it has sent the same message]"); } else { Log("[ " + DateTime.Now + " ] => [ Error In Message Posting ]"); GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember); } int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } catch (Exception ex) { //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember); } } catch (Exception ex) { //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace); GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember); } } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinComposeMessageErrorLogs); } }
public void GetMultipleRecords(ref GlobusHttpHelper HttpHelper) { try { string csrfToken = string.Empty; string LastName = string.Empty; string FirstName = string.Empty; string Industry = string.Empty; string Postalcode = string.Empty; string Distance = string.Empty; string contentSummary = string.Empty; string Title = string.Empty; string Company = string.Empty; string school = string.Empty; string Country = string.Empty; string countrycode = string.Empty; string industrycode = string.Empty; string rsid = string.Empty; string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top")); try { try { string[] Arr_Pst = Regex.Split(postalCode, "("); } catch { } try { Postalcode = postalCode.Substring(0, postalCode.IndexOf(" ")); Country = postalCode.Replace(Postalcode, string.Empty).Replace(")", string.Empty).Replace("(", string.Empty).Trim(); } catch { if (Postalcode == string.Empty) { Postalcode = postalCode; } } } catch { } if (pageSource.Contains("csrfToken")) { csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 100); string[] Arr = csrfToken.Split('&'); csrfToken = Arr[0]; csrfToken = csrfToken.Replace("csrfToken=", ""); csrfToken = csrfToken.Replace("%3A", ":"); } InBoardPro.GetIndustryCode objIndustry = new GetIndustryCode(); Dictionary<string, string> Dict_IndustryCode = new Dictionary<string, string>(); Dict_IndustryCode = objIndustry.getIndustry(); foreach (KeyValuePair<string, string> item in Dict_IndustryCode) { try { string toloweritem = item.Value.ToLower(); string tolowerindustrytype = industryType.ToLower(); if (toloweritem == tolowerindustrytype) { //SearchCriteria.Country = item.Key; industrycode = item.Key; break; } } catch { } } Dictionary<string, string> Dict_CountryCode = new Dictionary<string, string>(); Dict_CountryCode = objIndustry.getCountry(); foreach (KeyValuePair<string, string> item in Dict_CountryCode) { try { string toloweritem = item.Value.ToLower(); string tolowercountrytype = Country.ToLower(); if (toloweritem == tolowercountrytype) { countrycode = item.Key; break; } } catch { } } string Firstresponse = string.Empty; if (string.IsNullOrEmpty(countrycode)) { countrycode = "us"; } string FirstGetRequestUrl = string.Empty; string FirstGetResponse = string.Empty; { try { FirstGetRequestUrl = "http://www.linkedin.com/search/fpsearch?lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycode + "&postalCode=" + Postalcode + "&distance=" + distance + "&keepFacets=keepFacets&page_num=1&facet_I=" + industrycode + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&redir=redir"; FirstGetResponse = HttpHelper.getHtmlfromUrl1(new Uri(FirstGetRequestUrl)); } catch { } } int RecordCount = 0; try { RecordCount = objIndustry.GetPageNo(FirstGetResponse); if (RecordCount == 0) { string getAdvPagedata = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/vsearch/f?adv=true&trk=advsrch"), "http://www.linkedin.com/"); try { int startindex = getAdvPagedata.IndexOf("rsid="); string start = getAdvPagedata.Substring(startindex).Replace("rsid=", ""); int endindex = start.IndexOf("&"); string end = start.Substring(0, endindex); rsid = end; } catch (Exception ex) { } try { FirstGetRequestUrl = "http://www.linkedin.com/vsearch/p?lastName=" + lastName + "&postalCode=" + postalCode + "&openAdvancedForm=true&locationType=I&countryCode=" + countrycode + "&distance=" + distance + "&f_I=" + industrycode.Replace(" ", "") + "&rsid=" + rsid + "&orig=ADVS"; FirstGetResponse = HttpHelper.getHtmlfromUrl1(new Uri(FirstGetRequestUrl)); } catch { } } RecordCount = objIndustry.GetPageNo(FirstGetResponse); if (lastName != string.Empty && industryType == string.Empty) { Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Zip Code : " + postalCode.ToString() + " Distance : " + distance + " LastName : " + lastName + " ]"); } if (industryType != string.Empty && lastName == string.Empty) { Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Zip Code : " + postalCode.ToString() + " Distance : " + distance + " Industry : " + industryType + " ]"); } if (lastName == string.Empty && industryType == string.Empty) { Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Zip Code : " + postalCode.ToString() + " Distance : " + distance + " ]"); } } catch { } try { LinkedinScrappDbManager objLsManager = new LinkedinScrappDbManager(); objLsManager.InsertScarppRecordData(Postalcode, distance, industryType, lastName, RecordCount); } catch { } try { string prxyadress = string.Empty; try { if (!string.IsNullOrEmpty(proxyAddress) && !string.IsNullOrEmpty(proxyPort)) { prxyadress = proxyAddress + ":" + proxyPort; } } catch { } if (lastName != string.Empty && industryType == string.Empty) { string CSVHeader = "LastName" + "," + "CentralZipCode" + "," + "DistanceFromZipCode" + "," + "Number Of Result" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd "; string CSV_Content = lastName.ToString().Replace(",", ";") + "," + postalCode.ToString().Replace(",", ";") + "," + distance.ToString().Replace(",", ";") + "," + RecordCount.ToString().Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";"); CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCountLastNameWise); } if (industryType != string.Empty && lastName == string.Empty) { string CSVHeader = "IndustryZone" + "," + "CentralZipCode" + "," + "DistanceFromZipCode" + "," + "Number Of Result" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd "; string CSV_Content = industryType.ToString().Replace(",", ";") + "," + postalCode.ToString().Replace(",", ";") + "," + distance.ToString().Replace(",", ";") + "," + RecordCount.ToString().Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";"); CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCountIndustryZoneWise); } if (lastName == string.Empty && industryType == string.Empty) { string CSVHeader = "CentralZipCode" + "," + "DistanceFromZipCode" + "," + "Number Of Result" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd "; string CSV_Content = postalCode.ToString().Replace(",", ";") + "," + distance.ToString().Replace(",", ";") + "," + RecordCount.ToString().Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";"); CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCountZipCodeWise); } } catch { } } catch { } }
public static void RequestJSCSSIMG(string pageSource, ref GlobusHttpHelper HttpHelper) { ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; List <string> listURLs = new List <string>(); try { //CSS Request foreach (string item in GetHrefsFromString(pageSource)) { if (item.Contains(".css")) { string cssSource = item.Replace(" ", "").Trim(); try { //string res = HttpHelper.getHtmlfromUrl(new Uri(cssSource)); listURLs.Add(cssSource); } catch (Exception) { Thread.Sleep(500); try { string res = HttpHelper.getHtmlfromUrl(new Uri(cssSource)); } catch (Exception) { } } } } //JS Request string[] scriptArr = Regex.Split(pageSource, "/script>"); foreach (string item in scriptArr) { try { if (item.Contains("static.ak.") || item.Contains("profile.ak.")) { int startIndx = item.LastIndexOf("src=") + "src=".Length + 1; int endIndx = item.IndexOf(">", startIndx) - 1; string jsSource = item.Substring(startIndx, endIndx - startIndx); //if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.")) if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.") || jsSource.StartsWith("http://profile.ak.") || jsSource.StartsWith("https://profile.ak.") || jsSource.StartsWith("http://s-profile.ak.") || jsSource.StartsWith("https://s-profile.ak.")) { try { //string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource)); listURLs.Add(jsSource); } catch (Exception) { Thread.Sleep(500); try { string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource)); } catch (Exception) { } } } } } catch (Exception) { } } string[] moreScriptArray = Regex.Split(pageSource, "\"src\":"); foreach (string item in moreScriptArray) { try { int startIndx = 1; int endIndx = item.IndexOf("\"", startIndx); string jsSource = item.Substring(startIndx, endIndx - startIndx).Replace("\\", ""); if (jsSource.Contains(".js")) { //string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource)); listURLs.Add(jsSource); } } catch (Exception) { } } ///IMG Request string[] imageArr = Regex.Split(pageSource, "<img"); foreach (string item in imageArr) { try { if (item.Contains("static.ak.") || item.Contains("profile.ak.")) { int startIndx = item.IndexOf("src=") + "src=".Length + 1; int endIndx = item.IndexOf("\"", startIndx + 1); string jsSource = item.Substring(startIndx, endIndx - startIndx); //if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.")) if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.") || jsSource.StartsWith("http://profile.ak.") || jsSource.StartsWith("https://profile.ak.") || jsSource.StartsWith("http://s-profile.ak.") || jsSource.StartsWith("https://s-profile.ak.")) { if (jsSource.Contains(".png") || jsSource.Contains(".gif") || jsSource.Contains(".jpg") || jsSource.Contains(".jpeg")) { try { //string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource)); listURLs.Add(jsSource); } catch (Exception) { Thread.Sleep(500); try { string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource)); } catch (Exception) { } } } } } } catch (Exception) { } } listURLs = listURLs.Distinct().ToList(); foreach (string item in listURLs) { try { string res = HttpHelper.getHtmlfromUrl(new Uri(item)); } catch { }; } } catch { }; }
public void LoginHttpHelper(ref GlobusHttpHelper HttpHelper) { try { Log("[ " + DateTime.Now + " ] => [ Logging In With : " + _Username + " ]"); Log("[ " + DateTime.Now + " ] => [ Login Process is Running... ]"); //Check Login if (IsLoggedIn) { try { string homePage = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/home"), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword); if (homePage.Contains("Sign Out") && homePage.Contains("class=\"signout\"") && !homePage.Contains("Your LinkedIn account has been temporarily restricted")) { Log("[ " + DateTime.Now + " ] => [ Already Logged In With : " + _Username + " ]"); return; } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } string Url = "https://www.linkedin.com/"; ////string pageSrcLogin = HttpChilkat.GetHtmlProxy(Url, proxyAddress, proxyPort, proxyUserName, proxyPassword); string pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword); if (string.IsNullOrEmpty(pageSrcLogin)) { try { System.Threading.Thread.Sleep(1000); pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword, ""); } catch { } } if (string.IsNullOrEmpty(pageSrcLogin)) { Log("[ " + DateTime.Now + " ] => [ Couldn't Login In With : " + _Username + " ]"); return; } string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string sourceAlias = string.Empty; string regCsrfParam = string.Empty; if (pageSrcLogin.Contains("csrfToken")) { try { int startindex = pageSrcLogin.IndexOf("name=\"csrfToken\""); if (startindex > 0) { string start = pageSrcLogin.Substring(startindex).Replace("name=\"csrfToken\"", ""); int endindex = start.IndexOf("\" "); string end = start.Substring(0, endindex); csrfToken = end.Replace("value=\"", "").Replace("\\", "").Replace(" ", ""); //csrfToken = Uri.EscapeDataString(csrfToken); if (csrfToken.Contains("https://www.linkedin.com")) { csrfToken = Utils.getBetween("@@@@@@@" + csrfToken, "@@@@@@@", "\"/></form>"); } } else { string[] Arr = csrfToken.Split('"'); csrfToken = Arr[2].Replace("\\", string.Empty); } } catch { try { csrfToken = pageSrcLogin.Substring(pageSrcLogin.IndexOf("csrfToken"), 100); if (csrfToken.Contains("&")) { string[] Arr = csrfToken.Split('&'); csrfToken = Arr[0]; } else if (csrfToken.Contains(",")) { string[] Arr = csrfToken.Split(','); csrfToken = Arr[0].Replace("\\", string.Empty); } else { string[] Arr = csrfToken.Split(','); csrfToken = Arr[0].Replace("\\", string.Empty).Replace("csrfToken=", "").Replace("\n", "").Replace("\">", ""); } } catch { } } } try { if (csrfToken.Contains("&")) { string[] Arr1 = csrfToken.Split('&'); csrfToken = Arr1[0].Replace("\"", string.Empty); } } catch { } SearchCriteria.CsrToken = csrfToken.Replace("\n", "").Replace("//", "").Replace("\">", "").Replace("csrfToken=", ""); if (pageSrcLogin.Contains("sourceAlias")) { try { sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2].Replace("\\", string.Empty); } catch { } } try { int SourceAliasStart = pageSrcLogin.IndexOf("regCsrfParam"); if (SourceAliasStart > 0) { try { regCsrfParam = pageSrcLogin.Substring(pageSrcLogin.IndexOf("regCsrfParam"), 100); string[] Arr = regCsrfParam.Split('"'); regCsrfParam = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty); } catch { } } if (string.IsNullOrEmpty(regCsrfParam)) { regCsrfParam = Utils.getBetween(pageSrcLogin, "loginCsrfParam", "/>"); regCsrfParam = Utils.getBetween(regCsrfParam, "value=\"", "\""); } } catch { } postUrl = "https://www.linkedin.com/uas/login-submit"; //postdata = "isJsEnabled=true&source_app=&tryCount=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&loginCsrfParam=" + regCsrfParam + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; postdata = "isJsEnabled=true&source_app=&tryCount=&clickedSuggestion=false&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&trk=hb_signin&loginCsrfParam=" + regCsrfParam + "&fromEmail=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; // postdata = "isJsEnabled=true&source_app=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign+In&session_redirect=&trk=&loginCsrfParam=7462d247-6d54-47de-8f22-29723ea15f9d&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; try { ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata, _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword);//HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "http://www.linkedin.com/uas/login?goback=&trk=hb_signin", "", ""); } catch { } //postUrl = "https://www.linkedin.com/uas/login-submit"; //isJsEnabled=true&source_app=&tryCount=&session_key=gargimishra%40globussoft.com&session_password=globussoft&signin=Sign%20In&session_redirect=&csrfToken=ajax%3A7066152446927176852&sourceAlias=0_7r5yezRXCiA_H0CRD8sf6DhOjTKUNps5xGTqeX8EEoi //postdata = "isJsEnabled=true&source_app=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; // postdata = "session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; //ResLogin = HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "https://www.linkedin.com/uas/login?goback=&trk=hb_signin", "true", ""); string dts = string.Empty; string captchachallengeid = string.Empty; string origActionAlias = string.Empty; string origSourceAlias = string.Empty; string irhf = string.Empty; string captchaText = string.Empty; string ImageUrl = string.Empty; // if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted") || ResLogin.Contains("Change your password") || ResLogin.Contains("Please confirm your email address") && !ResLogin.Contains("Sign Out")) { SearchCriteria.loginREsponce = ResLogin; } else if (ResLogin.Contains("Security Verification")) { string dataforcapctha = HttpHelper.getHtmlfromUrl1(new Uri("https://www.google.com/recaptcha/api/noscript?k=6LcnacMSAAAAADoIuYvLUHSNLXdgUcq-jjqjBo5n")); if (!string.IsNullOrEmpty(dataforcapctha)) { int startindex = dataforcapctha.IndexOf("id=\"recaptcha_challenge_field\""); if (startindex > 0) { string start = dataforcapctha.Substring(startindex).Replace("id=\"recaptcha_challenge_field\"", ""); int endindex = start.IndexOf("\">"); string end = start.Substring(0, endindex).Replace("value=", "").Replace("\"", ""); ImageUrl = "https://www.google.com/recaptcha/api/image?c=" + end; WebClient webclient = new WebClient(); byte[] args = webclient.DownloadData(ImageUrl); string[] arr1 = new string[] { Globals.CapchaLoginID, Globals.CapchaLoginPassword, "" }; captchaText = DecodeDBC(arr1, args); } if (ResLogin.Contains("name=\"security-challenge-id\"")) { int startindexnew = ResLogin.IndexOf("name=\"security-challenge-id\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"security-challenge-id\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); captchachallengeid = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"dts\"")) { int startindexnew = ResLogin.IndexOf("name=\"dts\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"dts\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); dts = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"origActionAlias\"")) { int startindexnew = ResLogin.IndexOf("name=\"origActionAlias\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"origActionAlias\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); origActionAlias = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"origSourceAlias\"")) { int startindexnew = ResLogin.IndexOf("name=\"origSourceAlias\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"origSourceAlias\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); origSourceAlias = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"irhf\"")) { int startindexnew = ResLogin.IndexOf("name=\"irhf\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"irhf\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); irhf = end.Replace("\"", ""); } } //postdata = "dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&hr=&source_app=&csrfToken=" + csrfToken + "&trk=guest_home&isJsEnabled=true&session_redirect=&session_password="******"&session_key=" + _Username + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&irhf=" + irhf +"&sourceAlias=" + sourceAlias; if (!string.IsNullOrEmpty(ImageUrl) && !string.IsNullOrEmpty(captchaText)) { postdata = "recaptcha_challenge_field=" + ImageUrl.Replace("https://www.google.com/recaptcha/api/image?c=", "") + "&recaptcha_response_field=" + captchaText.Replace(" ", "+") + "&dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&hr=&source_app=&csrfToken=" + csrfToken + "&isJsEnabled=true&session_redirect=&session_password="******"&session_key=" + Uri.EscapeDataString(_Username) + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&irhf=" + irhf + "&sourceAlias=" + sourceAlias; postdata = postdata.Replace(" ", ""); ResLogin = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/uas/captcha-submit"), postdata, "https://www.linkedin.com/uas/login-submit", "", "", "", "", ""); } else { ResLogin = ""; } if (ResLogin.Contains("The text you entered does not match the characters in the security image. Please try again with this new image") || string.IsNullOrEmpty(ResLogin)) { Log("[ " + DateTime.Now + " ] => [ " + _Username + " Cannot Login because of Capctcha ]"); GlobusFileHelper.WriteStringToTextfile(_Username + ":" + _Password + ":" + _ProxyAddress + ":" + _ProxyPort + ":" + _ProxyUsername + ":" + _ProxyPassword, Globals.pathCapcthaLogin); SearchCriteria.loginREsponce = string.Empty; } } } //ResLogin.Contains("Sign Out") && ResLogin.Contains("class=\"signout\"") && !ResLogin.Contains("Your LinkedIn account has been temporarily restricted") if (ResLogin.Contains("Sign Out") && !ResLogin.Contains("Your LinkedIn account has been temporarily restricted")) { SearchCriteria.loginREsponce = string.Empty; IsLoggedIn = true; string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch")); SearchCriteria.loginREsponce = Search; } else if (ResLogin.Contains("logout?session_full_logout")) { SearchCriteria.loginREsponce = string.Empty; IsLoggedIn = true; string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch")); SearchCriteria.loginREsponce = Search; } else { //There was an unexpected problem that prevented us from completing your request. SearchCriteria.loginREsponce = string.Empty; IsLoggedIn = false; } //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword); //LogoutHttpHelper(ref HttpHelper); //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword); } catch { } }
public void LoginVerfy(string ConfemUrl, string gif, string logpic) { Globussoft.GlobusHttpHelper HttpHelper = new Globussoft.GlobusHttpHelper(); int intProxyPort = 80; Regex IdCheck = new Regex("^[0-9]*$"); if (!string.IsNullOrEmpty(proxyPort) && IdCheck.IsMatch(proxyPort)) { intProxyPort = int.Parse(proxyPort); } string PageSourse1 = HttpHelper.getHtmlfromUrlProxy(new Uri(ConfemUrl), proxyAddress, intProxyPort, proxyUser, proxyPass); //string PageSourse1 = HttpHelper.getHtmlfromUrlProxy(new Uri(url), "127.0.0.1", 8888, "", ""); string valueLSD = "name=" + "\"lsd\""; string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php")); int startIndex = pageSource.IndexOf(valueLSD) + 18; string value = pageSource.Substring(startIndex, 5); //Log("Logging in with " + Username); //string ResponseLogin = HttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Email.Split('@')[0] + "%40" + Email.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + ""); string ResponseLogin = HttpHelper.postFormDataProxy(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Username.Split('@')[0] + "%40" + Username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "", proxyAddress, intProxyPort, proxyUser, proxyPass); //string ResponseLogin = HttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + "rani.khanna" + "%40" + "hotmail.com" + "&pass="******"s15121985" + "&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + ""); /////ssss gif &s=a parse com &s=a////////////////////////// string PageSourse12 = HttpHelper.getHtmlfromUrl(new Uri(ConfemUrl)); try { string PageSourse13 = HttpHelper.getHtmlfromUrl(new Uri(gif)); } catch (Exception) { } try { string PageSourse14 = HttpHelper.getHtmlfromUrl(new Uri(logpic + "&s=a")); } catch (Exception) { } try { string PageSourse15 = HttpHelper.getHtmlfromUrl(new Uri(logpic)); } catch (Exception) { } //** User Id ***************////////////////////////////////// string UsreId = string.Empty; string ProFilePost = string.Empty; //if (ResponseLogin.Contains("http://www.facebook.com/profile.php?id=")) //{ // string[] arrUser = Regex.Split(ResponseLogin, "href"); // foreach (String itemUser in arrUser) // { // if (!itemUser.Contains("<!DOCTYPE")) // { // if (itemUser.Contains("http://www.facebook.com/profile.php?id=")) // { // string[] arrhre = itemUser.Split('"'); // ProFilePost = arrhre[1]; // break; // } // } // } //} //if (ResponseLogin.Contains("http://www.facebook.com/profile.php?id=")) //{ // UsreId = ProFilePost.Replace("http://www.facebook.com/profile.php?id=", ""); //} if (string.IsNullOrEmpty(UsreId)) { UsreId = GlobusHttpHelper.ParseJson(ResponseLogin, "user"); } //*** User Id **************////////////////////////////////// //*** Post Data **************////////////////////////////////// string fb_dtsg = GlobusHttpHelper.GetParamValue(ResponseLogin, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8); if (string.IsNullOrEmpty(fb_dtsg)) { fb_dtsg = GlobusHttpHelper.ParseJson(ResponseLogin, "fb_dtsg"); } string post_form_id = GlobusHttpHelper.GetParamValue(ResponseLogin, "post_form_id");//pageSourceHome.Substring(pageSourceHome.IndexOf("post_form_id"), 200); if (string.IsNullOrEmpty(post_form_id)) { post_form_id = GlobusHttpHelper.ParseJson(ResponseLogin, "post_form_id"); } string PageSourceConfirmed = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/?email_confirmed=1")); string pageSourceCheck = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=contact_importer")); ///Code for skipping additional optional Page try { string postDataSkipFirstStep = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=friend_requests&next_step_name=contact_importer&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=16581681208511510848190"; string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), postDataSkipFirstStep); Thread.Sleep(1000); } catch (Exception) { } pageSourceCheck = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=contact_importer")); //** FB Account Check email varified or not ***********************************************************************************// #region FB Account Check email varified or not string pageSrc1 = string.Empty; string pageSrc2 = string.Empty; string pageSrc3 = string.Empty; string pageSrc4 = string.Empty; string substr1 = string.Empty; if (pageSourceCheck.Contains("Are your friends already on Facebook?") && pageSourceCheck.Contains("Skip this step")) { string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=contact_importer&next_step_name=classmates_coworkers&previous_step_name=friend_requests&skip=Skip%20this%20step&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816776847576104244"; string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData); pageSrc1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers")); Thread.Sleep(1000); pageSrc1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=classmates_coworkers")); } if ((pageSrc1.Contains("Fill out your Profile Info") || pageSrc1.Contains("Fill out your Profile info")) && pageSrc1.Contains("Skip")) { string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer¤t_pane=info&hs[school][id][0]=&hs[school][text][0]=&hs[start_year][text][0]=-1&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[start_year][text][0]=-1&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816776847576104580"; string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData); //pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic")); ///Post Data Parsing Dictionary <string, string> lstfriend_browser_id = new Dictionary <string, string>(); string[] initFriendArray = Regex.Split(postRes, "FriendStatus.initFriend"); int tempCount = 0; foreach (string item in initFriendArray) { if (tempCount == 0) { tempCount++; continue; } if (tempCount > 0) { int startIndx = item.IndexOf("(\\") + "(\\".Length + 1; int endIndx = item.IndexOf("\\", startIndx); string paramValue = item.Substring(startIndx, endIndx - startIndx); lstfriend_browser_id.Add("friend_browser_id[" + (tempCount - 1) + "]=", paramValue); tempCount++; } } string partPostData = string.Empty; foreach (var item in lstfriend_browser_id) { partPostData = partPostData + item.Key + item.Value + "&"; } string newPostData1 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer¤t_pane=pymk&hs[school][id][0]=&hs[school][text][0]=&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&" + partPostData + "phstamp=1658167541109987992266";//"post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer¤t_pane=pymk&friend_browser_id[0]=100002869910855&friend_browser_id[1]=100001857152486&friend_browser_id[2]=575678600&friend_browser_id[3]=100003506761599&friend_browser_id[4]=563402235&friend_browser_id[5]=1268675170&friend_browser_id[6]=1701838026&friend_browser_id[7]=623640106&friend_browser_id[8]=648873235&friend_browser_id[9]=100000151781814&friend_browser_id[10]=657007597&friend_browser_id[11]=1483373867&friend_browser_id[12]=778266161&friend_browser_id[13]=1087830021&friend_browser_id[14]=100001333876108&friend_browser_id[15]=100000534308531&friend_browser_id[16]=1213205246&friend_browser_id[17]=45608778&friend_browser_id[18]=100003080150820&friend_browser_id[19]=892195716&friend_browser_id[20]=100001238774509&friend_browser_id[21]=45602360&friend_browser_id[22]=100000054900916&friend_browser_id[23]=100001308090108&friend_browser_id[24]=100000400766182&friend_browser_id[25]=100001159247338&friend_browser_id[26]=1537081666&friend_browser_id[27]=100000743261988&friend_browser_id[28]=1029373920&friend_browser_id[29]=1077680976&friend_browser_id[30]=100000001266475&friend_browser_id[31]=504487658&friend_browser_id[32]=82600225&friend_browser_id[33]=1023509811&friend_browser_id[34]=100000128061486&friend_browser_id[35]=100001853125513&friend_browser_id[36]=576201748&friend_browser_id[37]=22806492&friend_browser_id[38]=100003232772830&friend_browser_id[39]=1447942875&friend_browser_id[40]=100000131241521&friend_browser_id[41]=100002076794734&friend_browser_id[42]=1397169487&friend_browser_id[43]=1457321074&friend_browser_id[44]=1170969536&friend_browser_id[45]=18903839&friend_browser_id[46]=695329369&friend_browser_id[47]=1265734280&friend_browser_id[48]=698096805&friend_browser_id[49]=777678515&friend_browser_id[50]=529685319&hs[school][id][0]=&hs[school][text][0]=&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user=100003556207009&phstamp=1658167541109987992266"; string postRes1 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData1); pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic")); Thread.Sleep(4000); pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic")); string newPostData2 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816812057527766201"; string postRes2 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData); } if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip")) { string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816776847576104201"; try { string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData); pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=summary")); pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php?ref=wizard")); } catch (Exception) { } } if (pageSrc3.Contains("complete the sign-up process")) { //LoggerWallPoste("not varified through " + Username); } if (pageSourceCheck.Contains("complete the sign-up process")) { //LoggerWallPoste("not varified through Email" + Username); } #endregion //** FB Account Check email varified or not ***********************************************************************************// string pageSourceHome = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php")); ////**Post Message For User***********************///////////////////////////////////////////////////// int count = 0; //string[] Arr = post_form_id.Split('"'); //post_form_id = Arr[4]; //post_form_id = post_form_id.Replace("\\", ""); //post_form_id = post_form_id.Replace("\\", ""); //post_form_id = post_form_id.Replace("\\", ""); //string Response1 = HttpHelper.postFormData(new Uri("http://www.facebook.com/desktop/notifier/transfer.php?__a=1"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/desktop/notifier/transfer.php?__a=1"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/ajax/httponly_cookies.php?dc=snc2&__a=1"), "keys[0]=1150335208&post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/ajax/contextual_help.php?__a=1&set_name=welcome&__user="******"http://www.facebook.com/")); pageSourceCheck1111 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/")); if (pageSourceCheck1111.Contains("complete the sign-up process")) { Console.WriteLine("Account is not verified for : " + Username); } LoggerEmailVerify("Registration Succeeded for: " + Username); //LoggerVerify("Email verification completed for : " + Email); }
public bool gmail(string Email, string Password) { GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); bool activate = false; Chilkat.Http http = new Chilkat.Http(); ///Chilkat Http Request to be used in Http Post... Chilkat.HttpRequest req = new Chilkat.HttpRequest(); bool success; // Any string unlocks the component for the 1st 30-days. success = http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06"); if (success != true) { Console.WriteLine(http.LastErrorText); return(false); } http.CookieDir = "memory"; http.SendCookies = true; http.SaveCookies = true; //http.ProxyDomain = "127.0.0.1"; //http.ProxyPort = 8888; http.SetRequestHeader("Accept-Encoding", "gzip,deflate"); if (Email.Contains("@gmail")) { if (popClient.Connected) { popClient.Disconnect(); } popClient.Connect("pop.gmail.com", int.Parse("995"), true); popClient.Authenticate(Email, Password); int Count = popClient.GetMessageCount(); for (int i = Count; i >= 1; i--) { OpenPOP.MIME.Message Message = popClient.GetMessage(i); string subject = Message.Headers.Subject; if (Message.Headers.Subject.Contains("[WordPress] Activate") && Message.Headers.Subject.Contains("wordpress.com")) { foreach (string href in GetUrlsFromStringGmail(Message.MessageBody[0])) { try { string staticUrl = string.Empty; staticUrl = href; responce = http.QuickGetStr(staticUrl); if (responce.Contains("Your account is now active")) { Log("[ " + DateTime.Now + " ] => [ Account activated ]"); activate = true; } } catch (Exception ex) { } } } } } return(activate); }
public bool MultiPartImageUpload(ref GlobusHttpHelper httpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword) { /////Login to FB ////string valueLSD = "name=" + "\"lsd\""; int intProxyPort = 80; Regex IdCheck = new Regex("^[0-9]*$"); if (!string.IsNullOrEmpty(proxyPort) && IdCheck.IsMatch(proxyPort)) { intProxyPort = int.Parse(proxyPort); } //string pageSource = string.Empty; //try //{ // pageSource = getHtmlfromUrlProxy(new Uri("https://www.facebook.com/login.php"), proxyAddress, intProxyPort, proxyUsername, proxyPassword); // //int startIndex = pageSource.IndexOf(valueLSD) + 18; //} //catch { } //string value = GlobusHttpHelper.GetParamValue(pageSource, "lsd"); string ResponseLogin = string.Empty; try { // ResponseLogin = postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Username.Split('@')[0] + "%40" + Username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + ""); ResponseLogin = httpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com")); } catch { } ///Setting Post Data Params... string userId = GlobusHttpHelper.Get_UserID(ResponseLogin); if (string.IsNullOrEmpty(userId) || userId == "0" || userId.Length < 3) { GlobusLogHelper.log.Info("Please Check The Account : " + Username); GlobusLogHelper.log.Debug("Please Check The Account : " + Username); return false; } string pgSrc_Profile = string.Empty; try { pgSrc_Profile = httpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/profile.php?id=" + userId + "")); } catch { } string profileSource = string.Empty; try { profileSource = httpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/ajax/timeline/profile_pic_selector.php?profile_id=" + userId + "&__a=1&__user="******"")); } catch { } //GlobusHttpHelper httpHelper = new GlobusHttpHelper(); /////Get User ID //ProfileIDExtractor idExtracter = new ProfileIDExtractor(); //idExtracter.ExtractFriendIDs(ref httpHelper, ref userId); string fb_dtsg = GlobusHttpHelper.GetParamValue(ResponseLogin, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8); if (string.IsNullOrEmpty(fb_dtsg)) { fb_dtsg = GlobusHttpHelper.ParseJson(ResponseLogin, "fb_dtsg"); } string last_action_id = GlobusHttpHelper.ParseJson(pgSrc_Profile, "last_action_id"); if (!Utils.IsNumeric(last_action_id)) { last_action_id = "0"; } string postData = "last_action_id=" + last_action_id + "&fb_dtsg=" + fb_dtsg + "&__user="******"&phstamp=165816810252768712174"; string res = string.Empty; try { res = httpHelper.postFormData(new Uri("https://www.facebook.com/ajax/mercury/thread_sync.php?__a=1"), postData); } catch { } NameValueCollection nvc = new NameValueCollection(); //nvc.Add("post_form_id", post_form_id); nvc.Add("fb_dtsg", fb_dtsg); nvc.Add("id", userId); nvc.Add("type", "profile"); //nvc.Add("return", "/ajax/profile/picture/upload_iframe.php?pic_type=1&id=" + userId); nvc.Add("return", "/ajax/timeline/profile_pic_upload.php?pic_type=1&id=" + userId); //UploadFilesToRemoteUrl("http://upload.facebook.com/pic_upload.php ", new string[] { @"C:\Users\Globus-n2\Desktop\Windows Photo Viewer Wallpaper.jpg" }, "", nvc); //HttpUploadFile("http://upload.facebook.com/pic_upload.php ", localImagePath, "file", "image/jpeg", nvc); if (HttpUploadFile("https://upload.facebook.com/pic_upload.php ", localImagePath, "pic", "image/jpeg", nvc, proxyAddress, intProxyPort, proxyUsername, proxyPassword)) //if (HttpUploadFile("http://upload.facebook.com/pic_upload.php ", localImagePath, "file", "image/jpeg", nvc, proxyAddress, intProxyPort, proxyUsername, proxyPassword)) { return true; } return false; }
public bool AddaCover(ref GlobusHttpHelper HttpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref string status) { bool isAddaCover = false; string fb_dtsg = string.Empty; string photo_id = string.Empty; string UsreId = string.Empty; try { string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php")); UsreId = GlobusHttpHelper.GetParamValue(pageSource_Home, "user"); if (string.IsNullOrEmpty(UsreId)) { UsreId = GlobusHttpHelper.ParseJson(pageSource_Home, "user"); } fb_dtsg = GlobusHttpHelper.GetParamValue(pageSource_Home, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8); if (string.IsNullOrEmpty(fb_dtsg)) { fb_dtsg = GlobusHttpHelper.ParseJson(pageSource_Home, "fb_dtsg"); } NameValueCollection nvc = new NameValueCollection(); nvc.Add("fb_dtsg", fb_dtsg); //nvc.Add("filename=", fb_dtsg); nvc.Add("Content-Type:", "image/jpeg"); string response = HttpUploadFile_AddaCover(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword); try { string okay = HttpHelper.getHtmlfromUrl(new Uri("http://3-pct.channel.facebook.com/pull?channel=p_" + UsreId + "&seq=3&partition=69&clientid=70e140db&cb=8p7w&idle=8&state=active&mode=stream&format=json")); } catch { } if (!string.IsNullOrEmpty(response) && response.Contains("photo.php?fbid=")) { #region PostData_ForCoverPhotoSelect //fb_dtsg=AQCLSjCH&photo_id=130869487061841&profile_id=100004163701035&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user=100004163701035&__a=1&phstamp=165816776831066772182 #endregion try { string photo_idValue = response.Substring(response.IndexOf("photo.php?fbid="), response.IndexOf(";", response.IndexOf("photo.php?fbid=")) - response.IndexOf("photo.php?fbid=")).Replace("photo.php?fbid=", string.Empty).Trim(); string[] arrphoto_idValue = Regex.Split(photo_idValue, "[^0-9]"); foreach (string item in arrphoto_idValue) { try { if (item.Length > 6) { photo_id = item; break; } } catch { } } string postData = "fb_dtsg=" + fb_dtsg + "&photo_id=" + photo_id + "&profile_id=" + UsreId + "&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user="******"&__a=1&phstamp=165816776831066772182 "; string postResponse = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/timeline/cover_photo_select.php"), postData); if (!postResponse.Contains("error")) { //string ok = "ok"; isAddaCover = true; } if (string.IsNullOrEmpty(postResponse) || string.IsNullOrWhiteSpace(postResponse)) { status = "Response Is Null !"; } if (postResponse.Contains("errorSummary")) { string summary = GlobusHttpHelper.ParseJson(postResponse, "errorSummary"); string errorDescription = GlobusHttpHelper.ParseJson(postResponse, "errorDescription"); status = "Posting Error: " + summary + " | Error Description: " + errorDescription; //FanPagePosterLogger("Posting Error: " + summary + " | Error Description: " + errorDescription); } } catch { } } else { if (response.Contains("Please choose an image that")) { status = "Please choose an image that's at least 399 pixels wide"; } } } catch { } return isAddaCover; }
public void CrawlingPageDataSource(string Url, ref GlobusHttpHelper HttpHelper) { // if (SearchCriteria.starter) { // if (SearchCriteria.starter) { try { Log("[ " + DateTime.Now + " ] => [ Start Parsing Process ]"); #region Data Initialization string Industry = string.Empty; string URLprofile = string.Empty; string firstname = string.Empty; string lastname = string.Empty; string location = string.Empty; string country = string.Empty; string postal = string.Empty; string phone = string.Empty; string USERemail = string.Empty; string code = string.Empty; string education1 = string.Empty; string education2 = string.Empty; string titlecurrent = string.Empty; string companycurrent = string.Empty; string titlepast1 = string.Empty; string companypast1 = string.Empty; string titlepast2 = string.Empty; string html = string.Empty; string companypast2 = string.Empty; string titlepast3 = string.Empty; string companypast3 = string.Empty; string titlepast4 = string.Empty; string companypast4 = string.Empty; string Recommendations = string.Empty; string Connection = string.Empty; string Designation = string.Empty; string Website = string.Empty; string Contactsettings = string.Empty; string recomandation = string.Empty; string titleCurrenttitle = string.Empty; string titleCurrenttitle2 = string.Empty; string titleCurrenttitle3 = string.Empty; string titleCurrenttitle4 = string.Empty; string Skill = string.Empty; string TypeOfProfile = "Public1"; string Finaldata = string.Empty; #endregion #region LDS_DataInitialization string LDS_FirstName = string.Empty; string LDS_LastName = string.Empty; string LDS_UserProfileLink = string.Empty; string LDS_HeadLineTitle = string.Empty; string LDS_CurrentTitle = string.Empty; string LDS_PastTitles = string.Empty; string LDS_Loction = string.Empty; string LDS_Country = string.Empty; string LDS_Connection = string.Empty; string LDS_Recommendations = string.Empty; string LDS_SkillAndExpertise = string.Empty; string LDS_Education = string.Empty; string LDS_Experience = string.Empty; string LDS_ProfileType = "Public"; string LDS_Groups = string.Empty; string LDS_UserEmail = string.Empty; string LDS_UserContactNumber = string.Empty; string LDS_CurrentCompany = string.Empty; string LDS_PastCompany = string.Empty; string LDS_LoginID = string.Empty; string LDS_Websites = string.Empty; string LDS_Industry = string.Empty; #endregion #region Chilkat Initialization Chilkat.Http http = new Chilkat.Http(); ///Chilkat Http Request to be used in Http Post... Chilkat.HttpRequest req = new Chilkat.HttpRequest(); Chilkat.HtmlUtil htmlUtil = new Chilkat.HtmlUtil(); // Any string unlocks the component for the 1st 30-days. bool success = http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06"); if (success != true) { Console.WriteLine(http.LastErrorText); return; } http.CookieDir = "memory"; http.SendCookies = true; http.SaveCookies = true; html = HttpHelper.getHtmlfromUrl1(new Uri(Url)); html = htmlUtil.EntityDecode(html); //// Convert the HTML to XML: Chilkat.HtmlToXml htmlToXml = new Chilkat.HtmlToXml(); Chilkat.HtmlToXml htmlToXml1 = new Chilkat.HtmlToXml(); Chilkat.HtmlToXml htmlToXml2 = new Chilkat.HtmlToXml(); success = htmlToXml.UnlockComponent("THEBACHtmlToXml_7WY3A57sZH3O"); if ((success != true)) { Console.WriteLine(htmlToXml.LastErrorText); return; } string xHtml = null; string xHtml1 = null; //string xHtml2 = null; htmlToXml.Html = html; xHtml = htmlToXml.ToXml(); Chilkat.Xml xml = new Chilkat.Xml(); xml.LoadXml(xHtml); //// Iterate over all h1 tags: Chilkat.Xml xNode = default(Chilkat.Xml); Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml); #endregion #region for paRSING List<string> list = new List<string>(); List<string> Grouplist = new List<string>(); List<string> listtitle = new List<string>(); List<string> Currentlist = new List<string>(); List<string> Skilllst = new List<string>(); list.Clear(); //new parshing code List<string> TempFirstName = objChilkat.GetDataTagAttributewithId(html, "div", "name-container"); xBeginSearchAfter = null; xNode = xml.SearchForTag(xBeginSearchAfter, "dt"); Grouplist.Clear(); xBeginSearchAfter = null; #region parsergroup xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "class", "group-data"); while ((xNode != null)) { Finaldata = xNode.AccumulateTagContent("text", "/text"); Grouplist.Add(Finaldata); string[] tempC1 = Regex.Split(Finaldata, " at "); xBeginSearchAfter = xNode; xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "class", "group-data"); } int groupcounter = 0; string AllGRoup = string.Empty; foreach (string item in Grouplist) { if (item.Contains("Join")) { if (groupcounter == 0) { LDS_Groups = item; groupcounter++; } else { LDS_Groups = AllGRoup + ";" + item; } } } #endregion #region parserSkill xNode = xml.SearchForTag(xBeginSearchAfter, "dt"); Skilllst.Clear(); xBeginSearchAfter = null; xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "id", "profile-skills"); while ((xNode != null)) { Finaldata = xNode.AccumulateTagContent("text", "/text"); if (Finaldata.Contains("extlib: _toggleclass")) { try { string[] Temp = Finaldata.Split(';'); LDS_SkillAndExpertise = Temp[4]; } catch { } } else { try { LDS_SkillAndExpertise = Finaldata.Replace("Skills & Expertise", " "); Skilllst.Add(Finaldata); } catch { } } xBeginSearchAfter = xNode; xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "id", "profile-skills"); } if (LDS_SkillAndExpertise.Contains(" Endorsements LI.i18n.register('section_skills_person_endorsed_tmpl")) { LDS_SkillAndExpertise = string.Empty; } Skilllst.Distinct(); #endregion #region UrlProfile try { if (html.Contains("webProfileURL")) { int FirstPointForProfileURL = html.IndexOf("webProfileURL"); string FirstSubStringForProfileURL = html.Substring(FirstPointForProfileURL); int SecondPointForProfileURL = FirstSubStringForProfileURL.IndexOf(">"); int ThirdPointForProfileURL = FirstSubStringForProfileURL.IndexOf("</a>"); string SecondSubStringForProfileURL = FirstSubStringForProfileURL.Substring(SecondPointForProfileURL, ThirdPointForProfileURL - SecondPointForProfileURL); LDS_UserProfileLink = SecondSubStringForProfileURL.Replace(">", string.Empty); //qm.AddProfileUrl(URLprofile, DateTime.Now.ToString(), "0"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } try { string[] UrlFull = System.Text.RegularExpressions.Regex.Split(Url, "&authType"); LDS_UserProfileLink = UrlFull[0]; LDS_UserProfileLink = Url; } catch { } #endregion #region Connection if (html.Contains("overview-connections")) { try { Connection = html.Substring(html.IndexOf("leo-module mod-util connections"), 500); string[] Arr = Connection.Split('>'); string tempConnection = Arr[5].Replace("</strong", "").Replace(")</h3", "").Replace("(", ""); if (tempConnection.Length < 8) { LDS_Connection = tempConnection + "Connection"; } else { LDS_Connection = string.Empty; } } catch (Exception ex) { //overview-connections try { LDS_Connection = html.Substring(html.IndexOf("overview-connections"), 50); string[] Arr = Connection.Split('>'); string tempConnection = Arr[3].Replace("</strong", "").Replace(")</h3", "").Replace("(", ""); LDS_Connection = tempConnection + "Connection"; } catch { } } } #endregion #region Recommendation if (html.Contains("Recommendations")) { try { string[] rList = System.Text.RegularExpressions.Regex.Split(html, "Recommendations"); string[] R3List = rList[2].Split('\n'); string temprecomandation = R3List[4].Replace("</strong>", "").Replace("<strong>", ""); if (temprecomandation.Contains("recommended")) { LDS_Recommendations = temprecomandation; } else { LDS_Recommendations = ""; } } catch (Exception ex) { LDS_Recommendations = string.Empty; } } #endregion #region Websites if (html.Contains("websites")) { try { string websitedem = html.Substring(html.IndexOf("websites"), 500); string[] Arr = Regex.Split(websitedem, "href"); foreach (string item in Arr) { if (item.Contains("redir/redirect?url")) { string tempArr = item.Substring(item.IndexOf("name="), 50); string[] temarr = tempArr.Split('\n'); LDS_Websites = temarr[1]; } } } catch (Exception ex) { LDS_Websites = string.Empty; } } #endregion #region Getting Industry try { string Industrytemp = html.Substring(html.IndexOf("Find users in this industry"), 100); string[] TempIndustery = Industrytemp.Split('>'); LDS_Industry = TempIndustery[1].Replace("</strong", "").Replace("</a", ""); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region Getting First Name try { if (html.Contains("given-name")) { int FirstPointForProfilename = html.IndexOf("given-name"); string FirstSubStringForProfilename = html.Substring(FirstPointForProfilename); int SecondPointForProfilename = FirstSubStringForProfilename.IndexOf(">"); int ThirdPointForProfilename = FirstSubStringForProfilename.IndexOf("</span>"); string SecondSubStringForProfilename = FirstSubStringForProfilename.Substring(SecondPointForProfilename, ThirdPointForProfilename - SecondPointForProfilename); LDS_FirstName = SecondSubStringForProfilename.Replace(">", string.Empty); } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region LastName try { if (html.Contains("family-name")) { int FirstPointForProfilelastname = html.IndexOf("family-name"); string FirstSubStringForProfilelastname = html.Substring(FirstPointForProfilelastname); int SecondPointForProfilelastname = FirstSubStringForProfilelastname.IndexOf(">"); int ThirdPointForProfilelastname = FirstSubStringForProfilelastname.IndexOf("</span>"); string SecondSubStringForProfilelastname = FirstSubStringForProfilelastname.Substring(SecondPointForProfilelastname, ThirdPointForProfilelastname - SecondPointForProfilelastname); string templastname = SecondSubStringForProfilelastname.Replace(">", string.Empty); if (templastname.Contains(",")) { string[] arrylastname = templastname.Split(','); LDS_LastName = arrylastname[0]; } else { LDS_LastName = templastname; } } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region Designation Company Current try { if (html.Contains("phonetic-full-name")) { int FirstPointForProfileCurrent = html.IndexOf("phonetic-full-name"); string FirstSubStringForProfileCurrent = html.Substring(FirstPointForProfileCurrent); int SecondPointForProfileCurrent = FirstSubStringForProfileCurrent.IndexOf("display:block"); int ThirdPointForProfileCurrent = FirstSubStringForProfileCurrent.IndexOf("</p>"); string SecondSubStringForProfileCurrent = FirstSubStringForProfileCurrent.Substring(SecondPointForProfileCurrent, ThirdPointForProfileCurrent - SecondPointForProfileCurrent); titlecurrent = SecondSubStringForProfileCurrent.Replace("\">", "").Replace("display:block", string.Empty).Replace("<strong class=\"highlight\"", string.Empty).Replace("</strong", string.Empty).Trim(); string[] tempCCurent = Regex.Split(titlecurrent, " at "); LDS_HeadLineTitle = titlecurrent.Replace(",", ";"); LDS_CurrentCompany = tempCCurent[1].Replace(",", ";"); } else if (html.Contains("<p class=\"title\"")) { LDS_HeadLineTitle = html.Substring(html.IndexOf("<p class=\"title\""), 150); string[] HeadLineTitle = LDS_HeadLineTitle.Split('>'); string tempHeadLineTitle = HeadLineTitle[1].Replace("\n", "").Replace(")</h3", "").Replace("</p", ""); LDS_HeadLineTitle = tempHeadLineTitle; try { string[] tempCCurent = Regex.Split(tempHeadLineTitle, " at "); LDS_HeadLineTitle = tempCCurent[0]; LDS_CurrentCompany = tempCCurent[1]; } catch { } } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region Education try { if (html.Contains("summary-education")) { int FirstPointForProfileeducation1 = html.IndexOf("summary-education"); string FirstSubStringForProfileeducation1 = html.Substring(FirstPointForProfileeducation1); int SecondPointForProfileeducation1 = FirstSubStringForProfileeducation1.IndexOf("<li>"); int ThirdPointForProfileeducation1 = FirstSubStringForProfileeducation1.IndexOf("</li>"); string SecondSubStringForProfileeducation1 = FirstSubStringForProfileeducation1.Substring(SecondPointForProfileeducation1, ThirdPointForProfileeducation1 - SecondPointForProfileeducation1); education1 = SecondSubStringForProfileeducation1.Replace("<li>", string.Empty).Replace(",", string.Empty).Trim(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region Country try { if (html.Contains("locality")) { int FirstPointForlocality = html.IndexOf("locality"); string FirstSubStringForlocality = html.Substring(FirstPointForlocality); int SecondPointForlocality = FirstSubStringForlocality.IndexOf("location"); int ThirdPointForlocality = FirstSubStringForlocality.IndexOf("</a>"); string SecondSubStringForlocality = FirstSubStringForlocality.Substring(SecondPointForlocality, ThirdPointForlocality - SecondPointForlocality); string temlocation = SecondSubStringForlocality.Replace("location", string.Empty).Replace(">", string.Empty).Replace('"', ' '); string[] temp = temlocation.Split(','); LDS_Loction = temp[0].Replace("<strong class= highlight", string.Empty).Replace("</strong", string.Empty); LDS_Country = temp[1].Replace("<strong class= highlight", string.Empty).Replace("</strong", string.Empty); // country = temp[1].Replace("</strong", string.Empty); } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region User Email try { if (html.Contains("Email & Phone:")) { int FirstPointFortitlepast1 = html.IndexOf("abook-email"); string FirstSubStringFortitlepast1 = html.Substring(FirstPointFortitlepast1); int SecondPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("<a"); int ThirdPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("</a>"); string SecondSubStringFortitlepast1 = FirstSubStringFortitlepast1.Substring(SecondPointFortitlepast1, ThirdPointFortitlepast1 - SecondPointFortitlepast1); string[] tempEmail = SecondSubStringFortitlepast1.Split('>'); LDS_UserEmail = tempEmail[1]; } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region Type Of profile try { if (html.Contains("profile-header")) { int FirstPointForProfileType = html.IndexOf("profile-header"); string FirstSubStringForProfileType = html.Substring(FirstPointForProfileType); int SecondPointForProfileType = FirstSubStringForProfileType.IndexOf("class=\"n fn\""); int ThirdPointForProfileType = FirstSubStringForProfileType.IndexOf("</span>"); string SecondSubStringForProfileType = FirstSubStringForProfileType.Substring(SecondPointForProfileType, ThirdPointForProfileType - SecondPointForProfileType); string[] tempProfileType = SecondSubStringForProfileType.Split('>'); string ProfileType = tempProfileType[1]; LDS_ProfileType = ProfileType; } //<h1><span id="name" class="n fn">Private</span> else if (html.Contains(" class=\"n fn\"")) { try { string ProfileTypetemp = html.Substring(html.IndexOf("class=\"n fn\""), 20); string[] TempProfileType = ProfileTypetemp.Split('>'); LDS_ProfileType = TempProfileType[1].Replace("</strong", "").Replace("</a", ""); } catch { } } if (LDS_ProfileType != "Public") { LDS_ProfileType = "Private"; } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region PhonNumber try { if (html.Contains("<dt>Phone:</dt>")) { int FirstPointFortitlepast1 = html.IndexOf("profile-personal"); string FirstSubStringFortitlepast1 = html.Substring(FirstPointFortitlepast1); int SecondPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("<p>"); int ThirdPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("<span"); string SecondSubStringFortitlepast1 = FirstSubStringFortitlepast1.Substring(SecondPointFortitlepast1, ThirdPointFortitlepast1 - SecondPointFortitlepast1); LDS_UserContactNumber = SecondSubStringFortitlepast1.Replace("<p>", string.Empty); } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion xNode = xml.SearchForTag(xBeginSearchAfter, "dt"); xBeginSearchAfter = xNode; list.Clear(); #endregion #region Regionfor PastCompney try { if (html.Contains("summary-past")) { int FirstPointForPasttitle = html.IndexOf("summary-past"); string FirstSubStringForPasttitle = html.Substring(FirstPointForPasttitle); int SecondPointForPasttitle = FirstSubStringForPasttitle.IndexOf("<li>"); int ThirdPointForPasttitle = FirstSubStringForPasttitle.IndexOf("summary-education"); string SecondSubStringForPasttitle = FirstSubStringForPasttitle.Substring(SecondPointForPasttitle, ThirdPointForPasttitle - SecondPointForPasttitle); string FirstSubStringForPasttitlelast = htmlUtil.EntityDecode(SecondSubStringForPasttitle); htmlToXml1.Html = FirstSubStringForPasttitlelast; xHtml1 = htmlToXml1.ToXml(); Chilkat.Xml xml1 = new Chilkat.Xml(); xml1.LoadXml(xHtml1); //// Iterate over all h1 tags: Chilkat.Xml xNode1 = default(Chilkat.Xml); Chilkat.Xml xBeginSearchAfter1 = default(Chilkat.Xml); list.Clear(); string[] tempC1 = null; xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li"); while ((xNode1 != null)) { Finaldata = xNode1.AccumulateTagContent("text", "/text"); listtitle.Add(Finaldata); // list.Add(Finaldata); try { tempC1 = Regex.Split(Finaldata, " at "); } catch { } if (tempC1 != null) { try { list.Add(tempC1[1]); } catch { } } xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li"); xBeginSearchAfter1 = xNode1; } if (listtitle.Count > 0 || list.Count > 0) { try { titlepast1 = listtitle[0] != null ? listtitle[0] : string.Empty; titlepast2 = listtitle[1] != null ? listtitle[1] : string.Empty; titlepast3 = listtitle[2] != null ? listtitle[2] : string.Empty; titlepast4 = listtitle[3] != null ? listtitle[3] : string.Empty; } catch { } try { companypast1 = list[0] != null ? list[0] : string.Empty; companypast2 = list[1] != null ? list[1] : string.Empty; companypast3 = list[2] != null ? list[2] : string.Empty; companypast4 = list[3] != null ? list[3] : string.Empty; } catch { } } } } catch { }; list.Clear(); #endregion string companyCurrenttitle1 = string.Empty; string companyCurrenttitle2 = string.Empty; string companyCurrenttitle3 = string.Empty; string companyCurrenttitle4 = string.Empty; #region Regionfor summary-current try { if (html.Contains("summary-current")) { int FirstPointForCurrenttitle = html.IndexOf("summary-current"); string FirstSubStringForCurrenttitle = html.Substring(FirstPointForCurrenttitle); int SecondPointForCurrenttitle = FirstSubStringForCurrenttitle.IndexOf("<li>"); int ThirdPointForCurrenttitle = FirstSubStringForCurrenttitle.IndexOf("summary-past"); string SecondSubStringForCurrenttitle = FirstSubStringForCurrenttitle.Substring(SecondPointForCurrenttitle, ThirdPointForCurrenttitle - SecondPointForCurrenttitle); string FirstSubStringForCurrenttitlelast = htmlUtil.EntityDecode(SecondSubStringForCurrenttitle); htmlToXml1.Html = FirstSubStringForCurrenttitlelast; xHtml1 = htmlToXml1.ToXml(); Chilkat.Xml xml1 = new Chilkat.Xml(); xml1.LoadXml(xHtml1); //// Iterate over all h1 tags: Chilkat.Xml xNode1 = default(Chilkat.Xml); Chilkat.Xml xBeginSearchAfter1 = default(Chilkat.Xml); Currentlist.Clear(); list.Clear(); string[] tempC1 = null; xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li"); while ((xNode1 != null)) { Finaldata = xNode1.AccumulateTagContent("text", "/text"); Currentlist.Add(Finaldata); // list.Add(Finaldata); try { tempC1 = Regex.Split(Finaldata, " at "); } catch { } if (tempC1 != null) { try { list.Add(tempC1[1]); } catch { } } xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li"); xBeginSearchAfter1 = xNode1; } if (Currentlist.Count > 0 || list.Count > 0) { try { titleCurrenttitle = Currentlist[0] != null ? Currentlist[0] : string.Empty; titleCurrenttitle2 = Currentlist[1] != null ? Currentlist[1] : string.Empty; titleCurrenttitle3 = Currentlist[2] != null ? Currentlist[2] : string.Empty; titleCurrenttitle4 = Currentlist[3] != null ? Currentlist[3] : string.Empty; } catch { } try { companyCurrenttitle1 = list[0] != null ? list[0] : string.Empty; companyCurrenttitle2 = list[1] != null ? list[1] : string.Empty; companyCurrenttitle3 = list[2] != null ? list[2] : string.Empty; companyCurrenttitle4 = list[3] != null ? list[3] : string.Empty; } catch { } } } } catch { }; list.Clear(); #endregion #region RegionForEDUCATION try { if (html.Contains("summary-education")) { int FirstPointForEDUCATION = html.IndexOf("summary-education"); string FirstSubStringForEDUCATION = html.Substring(FirstPointForEDUCATION); int SecondPointForEDUCATION = FirstSubStringForEDUCATION.IndexOf("<li>"); int ThirdPointForEDUCATION = FirstSubStringForEDUCATION.IndexOf("</ul>"); string SecondSubStringForEDUCATION = FirstSubStringForEDUCATION.Substring(SecondPointForEDUCATION, ThirdPointForEDUCATION - SecondPointForEDUCATION); //string tempEDu = SecondSubStringForEDUCATION.Replace("<li>", string.Empty).Replace("</li>", string.Empty).Replace(" ", string.Empty).Replace("\n", string.Empty).Replace("\t", string.Empty).Trim(); string temptg = SecondSubStringForEDUCATION.Replace("<li>", ""); string[] templis6t = temptg.Split('/'); education1 = templis6t[0].Replace("\n", string.Empty).Replace("\t", string.Empty).Replace("<", string.Empty).Replace("span>", string.Empty).Replace(",", string.Empty).Trim(); education2 = templis6t[1].Replace("\n", string.Empty).Replace("\t", string.Empty).Replace("li>", string.Empty).Replace("<", string.Empty).Replace("span>", string.Empty).Replace(",", string.Empty).Trim(); } } catch { }; list.Clear(); #endregion string GroupPastJob = string.Empty; string GroupEduction = string.Empty; LDS_PastTitles = titlepast1 + ";" + titlepast3; LDS_PastCompany = companypast1 + ";" + companypast3; LDS_Education = education1 + ";" + education2; LDS_CurrentTitle = titleCurrenttitle; LDS_LoginID = _UserName;//SearchCriteria.LoginID; //"ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "HeadLineTitle" + "," + "CurrentTitle " + "," + "Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumbe" + "," + "PastTitles" + "," + "PastCompany" + "," + "Loction" + "," + "Country" + "," + "titlepast3" + "," + "companypast3" + "," + "titlepast4" + "," + "companypast4" + ","; string LDS_FinalData = LDS_ProfileType.Replace(",", ";") + "," + LDS_UserProfileLink.Replace(",", ";") + "," + LDS_FirstName.Replace(",", ";") + "," + LDS_LastName.Replace(",", ";") + "," + LDS_HeadLineTitle.Replace(",", ";") + "," + LDS_CurrentTitle.Replace(",", ";") + "," + LDS_CurrentCompany.Replace(",", ";") + "," + LDS_Connection.Replace(",", ";") + "," + LDS_Recommendations.Replace(",", ";") + "," + LDS_SkillAndExpertise.Replace(",", ";") + "," + LDS_Experience.Replace(",", ";") + "," + LDS_Education.Replace(",", ";") + "," + LDS_Groups.Replace(",", ";") + "," + LDS_UserEmail.Replace(",", ";") + "," + LDS_UserContactNumber.Replace(",", ";") + "," + LDS_PastTitles.Replace(",", ";") + "," + LDS_PastCompany.Replace(",", ";") + "," + LDS_Loction.Replace(",", ";") + "," + LDS_Country.Replace(",", ";") + "," + LDS_Industry.Replace(",", ";") + "," + LDS_Websites.Replace(",", ";") + "," + LDS_LoginID.Replace(",", ";") + ","; if (LDS_FinalData.Contains("<strong class=\"highlight\"") || LDS_FinalData.Contains("<span class=\"full-name\"") || LDS_FinalData.Contains("<strong class=\"highlight\"") || LDS_FinalData.Contains("overview-connections\">")) { LDS_FinalData = LDS_FinalData.Replace("<span class=\"full-name\"", "").Replace("\n", "").Replace("<strong class=\"highlight\"", "").Replace("overview-connections\">", "").Replace("</strong>", "").Replace("<strong>", ""); } if (!string.IsNullOrEmpty(LDS_FirstName) || !string.IsNullOrEmpty(LDS_FirstName)) { Log(LDS_FinalData); } // if (SearchCriteria.starter) { string tempFinalData = LDS_FinalData.Replace(";", "").Replace(LDS_UserProfileLink, "").Replace("Public", "").Replace(",", "").Replace(LDS_LoginID, "").Trim(); if (!string.IsNullOrEmpty(tempFinalData)) { //AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, Globals.path_ScrappedMembersFromGroup); string CSVHeader = "ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "HeadLineTitle" + "," + "Current Title " + "," + "Current Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedInLoginID" + ","; string CSV_Content = TypeOfProfile.Replace(",", ";") + "," + LDS_UserProfileLink.Replace(",", ";") + "," + LDS_FirstName.Replace(",", ";") + "," + LDS_LastName.Replace(",", ";") + "," + LDS_HeadLineTitle.Replace(",", ";") + "," + LDS_CurrentTitle.Replace(",", ";") + "," + LDS_CurrentCompany.Replace(",", ";") + "," + LDS_Connection.Replace(",", ";") + "," + LDS_Recommendations.Replace(",", ";") + "," + LDS_SkillAndExpertise.Replace(",", ";") + "," + LDS_Experience.Replace(",", ";") + "," + LDS_Education.Replace(",", ";") + "," + LDS_Groups.Replace(",", ";") + "," + LDS_UserEmail.Replace(",", ";") + "," + LDS_UserContactNumber.Replace(",", ";") + "," + LDS_PastTitles.Replace(",", ";") + "," + LDS_PastCompany.Replace(",", ";") + "," + LDS_Loction.Replace(",", ";") + "," + LDS_Country.Replace(",", ";") + "," + LDS_Industry.Replace(",", ";") + "," + LDS_Websites.Replace(",", ";") + "," + LDS_LoginID.Replace(",", ";"); //string CSV_Content = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + Connection.Replace(",", ";") + "," + recomandation.Replace(",", string.Empty) + "," + Skill.Replace(",", ";") + "," + LDS_Experience.Replace(",", string.Empty) + "," + EducationCollection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + LDS_UserContact.Replace(",", ";") + "," + LDS_PastTitles + "," + AllComapny.Replace(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID + ",";// +TypeOfProfile + ","; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_ScrappedMembersFromGroup); Log("[ " + DateTime.Now + " ] => [ Data Saved In CSV File With URL >>> " + LDS_UserProfileLink + " ]"); } //if (!string.IsNullOrEmpty(LDS_FirstName) || !string.IsNullOrEmpty(LDS_FirstName)) //{ // AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, SearchCriteria.FileName); //} } } catch (Exception ex) { }; } } }
public string HttpUploadProfilePic(ref GlobusHttpHelper HttpHelper, string profileId, string url, string paramName, string contentType, string localImagePath, NameValueCollection nvc, string proxyAddress, int proxyPort, string proxyUsername, string proxyPassword) { string response = string.Empty; try { paramName = "file"; //int w, h; //try //{ // GetJpegDimension(localImagePath, out w, out h); //} //catch { } // System.Drawing.Image objImage = System.drImage.FromFile("C:\imagename.gif"); //int width = objImage.Width; // height = objImage.Height; //string localImagePath1 = localImagePath.Replace("C:\\Users\\user\\Desktop\\Desktop\\FEmale pics", string.Empty).Replace("\\", string.Empty); string localImagePath1 = localImagePath; #region PostData_ForUploadImage try { //Bitmap b = new Bitmap(path); //w = b.width; h = b.height; } catch { } // -----------------------------187451459023968 //Content-Disposition: form-data; name="upload_info" //Dvhp8F7dIlmSwUmzNPsW985izeEG5OTZ35YK4V9YA1GIwwTqLJ9ljQxuxzH-wSutLAMYYF9AAXbxo- //6PDqZtoi7TuqbxCAeqHX9NoQ_uvzd4zaRhmuzlTKkl-3VOiMuWDzlK003lzMDv5UwRLhQFXcLF-3v- //4qdfLwWwKyPTGvbIw4ektMKwVE5ists0ThihmuflKFiuAZrO7- //uWDzlK0037zwcC55XRhekF2EiiXObIlloWDq5ljWA5zanovadkQ5ilFH5_ui2VuP1 //-----------------------------187451459023968 //Content-Disposition: form-data; name="upload_info_with_js" //Dvhp8F7dIlmSwUmzNPsW985izeEG5OTZ35YK4V9YA1GIwwTqLJ9ljQxuxzH-wSutLAMYYF9AAXbxo- //6PDqZtoi7TuqbxCAeqHX9NoQ_uvzd4zaRhmuzlTKkl-3VOiMuWDzlK003lzMDv5UwRLhQFXcLF-3v- //4qdfLwWwKyPTGvbIw4ektMKwVE5ists0ThihmuflKFiuAZrO7- //uWDzlK0037zwcC55XRhekF2EiiXObIlloWDq5ljWA5zanovadkQ5ilFH5_ui2VuP1 //-----------------------------187451459023968 //Content-Disposition: form-data; name="callback" //profilePicture.processResponse //-----------------------------187451459023968 //Content-Disposition: form-data; name="file"; filename="Koala.jpg" //Content-Type: image/jpeg //���� #endregion try { ////log.Debug(string.Format("Uploading {0} to {1}", file, url)); //string boundary = "---------------------------" + DateTime.Now.Ticks.ToString(""); string boundary = "---------------------------" + DateTime.Now.Ticks.ToString(); byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n"); gRequest = (HttpWebRequest)WebRequest.Create(url); gRequest.ContentType = "multipart/form-data; boundary=" + boundary; gRequest.Referer = "http://www.linkedin.com/profile/edit-picture-info?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1%2Enpe_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&trk=prof-ovw-edit-photo"; gRequest.Method = "POST"; gRequest.KeepAlive = true; gRequest.Credentials = System.Net.CredentialCache.DefaultCredentials; gRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0";//"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16"; gRequest.Accept = " text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, */*"; gRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; ChangeProxy(proxyAddress, proxyPort, proxyUsername, proxyPassword); gRequest.CookieContainer = new CookieContainer(); //gCookiesContainer; #region CookieManagment if (this.gCookies != null && this.gCookies.Count > 0) { gRequest.CookieContainer.Add(gCookies); } #endregion using (Stream rs = gRequest.GetRequestStream()) { //Stream rs = gRequest.GetRequestStream(); int tempi = 0; string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}"; foreach (string key in nvc.Keys) { string formitem = string.Empty; if (tempi == 0) { byte[] firstboundarybytes = System.Text.Encoding.ASCII.GetBytes("--" + boundary + "\r\n"); rs.Write(firstboundarybytes, 0, firstboundarybytes.Length); formitem = string.Format(formdataTemplate, key, nvc[key]); byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem); rs.Write(formitembytes, 0, formitembytes.Length); tempi++; continue; } rs.Write(boundarybytes, 0, boundarybytes.Length); formitem = string.Format(formdataTemplate, key, nvc[key]); byte[] formitembytes1 = System.Text.Encoding.UTF8.GetBytes(formitem); rs.Write(formitembytes1, 0, formitembytes1.Length); } rs.Write(boundarybytes, 0, boundarybytes.Length); string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n"; string header = string.Format(headerTemplate, paramName, localImagePath1, contentType); byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header); rs.Write(headerbytes, 0, headerbytes.Length); using (FileStream fileStream = new FileStream(localImagePath, FileMode.Open, FileAccess.Read)) { //FileStream fileStream = new FileStream(localImagePath, FileMode.Open, FileAccess.Read); byte[] buffer = new byte[4096]; int bytesRead = 0; while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0) { rs.Write(buffer, 0, bytesRead); } //fileStream.Close(); } byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n"); rs.Write(trailer, 0, trailer.Length); //rs.Close(); } #region CookieManagment if (this.gCookies != null && this.gCookies.Count > 0) { gRequest.CookieContainer.Add(gCookies); } #endregion using (WebResponse wresp = gRequest.GetResponse()) { //WebResponse wresp = null; try { //wresp = gRequest.GetResponse(); using (Stream stream2 = wresp.GetResponseStream()) { //Stream stream2 = wresp.GetResponseStream(); using (StreamReader reader2 = new StreamReader(stream2)) { //StreamReader reader2 = new StreamReader(stream2); response = reader2.ReadToEnd(); } } //log.Debug(string.Format("File uploaded, server response is: {0}", reader2.ReadToEnd())); return response; } catch (Exception ex) { ////log.Error("Error uploading file", ex); //if (wresp != null) //{ // wresp.Close(); // wresp = null; //} //// return false; } } } catch { } finally { gRequest = null; } } catch { } return response; }
public void GetGroupMemberInfo(ref GlobusHttpHelper httpHelper, List<string> lstGrpMemProfileURLs) { try { foreach (string item in lstGrpMemProfileURLs) { try { if (!CrawlingLinkedInPage(item, ref httpHelper)) { CrawlingPageDataSource(item, ref httpHelper); } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } }
public Dictionary <string, string> PostAddMembers(ref GlobusHttpHelper HttpHelper, string user) { try { string MemId = string.Empty; string MemFName = string.Empty; string MemLName = string.Empty; string MemFullName = string.Empty; string pageSource = string.Empty; string Name = string.Empty; int start1 = 0; #region old code //MemberDtl.Clear(); //string pageGetreq = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?gid=28410&csrfToken=ajax%3A1826913778783200924")); //http://www.linkedin.com/connections2?displayFilteredConns=&fetchConnsFromDB=false #endregion //string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/connections2?displayFilteredConns")); //string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/connections")); //string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/api/contacts/?start=0&count=10")); do { pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/api/contacts/?start=" + start1 + "&count=10")); //string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "{""); string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "{\"name\":"); foreach (var Members in RgxGroupData) { try { if (Members.Contains(", \"id\":")) { int startindex = Members.IndexOf(", \"id\":"); string start = Members.Substring(startindex); int endIndex = start.IndexOf("}"); MemId = start.Substring(0, endIndex).Replace(""", string.Empty).Replace("id", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("li_", string.Empty).Replace(", \"title\"", string.Empty).Replace("\"", string.Empty).Trim(); MemId = user + ':' + MemId; string Fname = string.Empty; string Lname = string.Empty; try { int StartIndex = Members.IndexOf(""firstName":""); if (StartIndex > 0) { string Start = Members.Substring(StartIndex).Replace(""firstName":"", ""); int EndIndex = Start.IndexOf("","); string End = Start.Substring(0, EndIndex); Fname = End; } } catch (Exception ex) { } try { int StartIndex = Members.IndexOf(""lastName":""); if (StartIndex > 0) { string Start = Members.Substring(StartIndex).Replace(""lastName":"", ""); int EndIndex = Start.IndexOf("","); string End = Start.Substring(0, EndIndex); Lname = End; } } catch (Exception ex) { } try { int StartIndex = Members.IndexOf("\""); if (StartIndex > 0) { string Start = Members.Substring(StartIndex).Replace(""firstName":"", ""); int EndIndex = Start.IndexOf(", \"title\""); string End = Start.Substring(0, EndIndex).Replace(", \"title\"", string.Empty).Replace("\"", string.Empty).Trim(); Name = End; } } catch (Exception ex) { } //MemFullName = Fname + " " + Lname; MemFullName = Name; #region old code //int startindex1 = Members.IndexOf("formattedName"); //string start1 = Members.Substring(startindex1); //int endIndex1 = start1.IndexOf("}"); //MemFullName = start1.Substring(0, endIndex1).Replace("formattedName", string.Empty).Replace(""", string.Empty).Replace(":", string.Empty).Trim(); //.Replace(""", string.Empty).Replace(":", string.Empty).Replace(",", string.Empty).Trim(); //":"agrawal, gaurav" //int startindex2 = Members.IndexOf("lastName"); //string start2 = Members.Substring(startindex2); //int endIndex2 = start2.IndexOf("company\":\""); //MemLName = start2.Substring(0, endIndex1).Replace("lastName", string.Empty).Replace(""", string.Empty).Replace(";",string.Empty).Replace(":", string.Empty).Replace(",", string.Empty).Replace("&quo",string.Empty).Trim(); //MemFullName = MemFName +":" + MemLName; #endregion try { MemberNameAndID.Add(MemId, MemFullName); } catch (Exception ex) { } } } catch { } } start1++; } while (pageSource.Contains("name")); return(MemberNameAndID); } catch (Exception ex) { return(MemberNameAndID); } }
public static string GetPageID(string PageSrcFanPageUrl, ref string FanpageUrl) { #region Get FB Page ID Modified GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); string fbpage_id = string.Empty; try { if (PageSrcFanPageUrl.Contains("profile_owner")) { fbpage_id = ParseEncodedJsonPageID(PageSrcFanPageUrl, "profile_owner"); } if (string.IsNullOrEmpty(fbpage_id)) { if (PageSrcFanPageUrl.Contains("/feeds/page.php?id=")) { int startIndxFeeds = PageSrcFanPageUrl.IndexOf("/feeds/page.php?id=") + "/feeds/page.php?id=".Length; int endIndxFeeds = PageSrcFanPageUrl.IndexOf("\"", startIndxFeeds); fbpage_id = PageSrcFanPageUrl.Substring(startIndxFeeds, endIndxFeeds - startIndxFeeds); if (fbpage_id.Contains("&")) { fbpage_id = fbpage_id.Remove(fbpage_id.IndexOf("&")); } } else if (PageSrcFanPageUrl.Contains("page.php?id=")) { int startIndxFeeds = PageSrcFanPageUrl.IndexOf("/page.php?id=") + "/page.php?id=".Length; int endIndxFeeds = PageSrcFanPageUrl.IndexOf("\"", startIndxFeeds); fbpage_id = PageSrcFanPageUrl.Substring(startIndxFeeds, endIndxFeeds - startIndxFeeds); if (fbpage_id.Contains("&")) { fbpage_id = fbpage_id.Remove(fbpage_id.IndexOf("&")); } } else if (PageSrcFanPageUrl.Contains("php?page_id=")) { int startIndxFeeds = PageSrcFanPageUrl.IndexOf("php?page_id=") + "php?page_id=".Length; int endIndxFeeds = PageSrcFanPageUrl.IndexOf("\"", startIndxFeeds); fbpage_id = PageSrcFanPageUrl.Substring(startIndxFeeds, endIndxFeeds - startIndxFeeds); if (fbpage_id.Contains("&")) { fbpage_id = fbpage_id.Remove(fbpage_id.IndexOf("&")); } } else { //FanPagePosterLogger("Unable To like Fan Page Wall with " + Username + " and " + FanpageUrl); //return; } if (string.IsNullOrEmpty(fbpage_id)) { fbpage_id = HttpHelper.ExtractIDUsingGraphAPI(FanpageUrl, ref HttpHelper); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } return fbpage_id; #endregion }
public bool CrawlingLinkedInPage(string Url, ref GlobusHttpHelper HttpHelper,string FileName) { //Url = "http://www.linkedin.com/profile/view?id=44952194&authType=OUT_OF_NETWORK&authToken=DYBR&locale=en_US&srchid=3817933251416230963594&srchindex=2&srchtotal=1949&trk=vsrp_people_res_name&trkInfo=VSRPsearchId%3A3817933251416230963594%2CVSRPtargetId%3A44952194%2CVSRPcmpt%3Aprimary"; #region Data Initialization string GroupMemId = string.Empty; string Industry = string.Empty; string URLprofile = string.Empty; string firstname = string.Empty; string lastname = string.Empty; string location = string.Empty; string country = string.Empty; string postal = string.Empty; string phone = string.Empty; string USERemail = string.Empty; string code = string.Empty; string education1 = string.Empty; string education2 = string.Empty; string titlecurrent = string.Empty; string companycurrent = string.Empty; string CurrentCompUrl = string.Empty; string CurrentCompSite = string.Empty; string titlepast1 = string.Empty; string companypast1 = string.Empty; string titlepast2 = string.Empty; string html = string.Empty; string companypast2 = string.Empty; string titlepast3 = string.Empty; string companypast3 = string.Empty; string titlepast4 = string.Empty; string companypast4 = string.Empty; string Recommendations = string.Empty; string Connection = string.Empty; string Designation = string.Empty; string Website = string.Empty; string Contactsettings = string.Empty; string recomandation = string.Empty; string titleCurrenttitle = string.Empty; string titleCurrenttitle2 = string.Empty; string titleCurrenttitle3 = string.Empty; string titleCurrenttitle4 = string.Empty; string Skill = string.Empty; string TypeOfProfile = "Public"; List<string> EducationList = new List<string>(); string Finaldata = string.Empty; string EducationCollection = string.Empty; List<string> checkerlst = new List<string>(); List<string> checkgrplist = new List<string>(); string groupscollectin = string.Empty; string strFamilyName = string.Empty; string LDS_LoginID = string.Empty; string LDS_Websites = string.Empty; string LDS_UserProfileLink = string.Empty; string LDS_CurrentTitle = string.Empty; string LDS_Experience = string.Empty; string LDS_UserContact = string.Empty; string LDS_PastTitles = string.Empty; string LDS_BackGround_Summary = string.Empty; string LDS_Desc_AllComp = string.Empty; string Company = string.Empty; List<string> lstpasttitle = new List<string>(); List<string> checkpasttitle = new List<string>(); string DeegreeConn = string.Empty; string AccountType = string.Empty; bool CheckEmployeeScraper = false; string fileName = string.Empty; bool CampaignScraper = false; #endregion #region GetRequest if (Url.Contains("CompanyEmployeeScraper")) { try { Url = Url.Replace("CompanyEmployeeScraper", string.Empty); CheckEmployeeScraper = true; } catch { } } if (Url.Contains("CampaignScraper")) { try { string[] Url_Split = Regex.Split(Url, "CampaignScraper"); Url = Url_Split[0]; fileName = Url_Split[1]; CampaignScraper = true; } catch { } } string stringSource = HttpHelper.getHtmlfromUrl(new Uri(Url.Replace("http", "https"))); #endregion #region GroupMemId try { string[] gid = Url.Split('&'); GroupMemId = gid[0].Replace("http://www.linkedin.com/profile/view?id=", string.Empty); } catch { } #endregion #region Name try { try { strFamilyName = stringSource.Substring(stringSource.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\""), (stringSource.IndexOf("i18n__expand_your_network_to_see_more", stringSource.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\"")) - stringSource.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\""))).Replace("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\"", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim(); } catch { try { strFamilyName = stringSource.Substring(stringSource.IndexOf("fmt__full_name\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__full_name\":")) - stringSource.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim(); } catch { } } if (string.IsNullOrEmpty(strFamilyName)) { try { strFamilyName = stringSource.Substring(stringSource.IndexOf("<span class=\"full-name\">"), (stringSource.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">", stringSource.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">")) - stringSource.IndexOf("<span class=\"full-name\">"))).Replace("<span class=\"full-name\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim(); } catch { } } if (string.IsNullOrEmpty(strFamilyName)) { try { int StartIndex = stringSource.IndexOf("profileFullName"); string Start = stringSource.Substring(StartIndex).Replace("profileFullName", string.Empty); int EndIndex = Start.IndexOf("slideData"); string End = Start.Substring(0, EndIndex).Replace(":", string.Empty).Replace("'",string.Empty).Replace(",",string.Empty).Trim(); strFamilyName = End.Trim(); } catch { } } } catch { } if (string.IsNullOrEmpty(strFamilyName)) { try { int StartIndex = stringSource.IndexOf("</script><title>"); string Start = stringSource.Substring(StartIndex).Replace("</script><title>", string.Empty); int EndIndex = Start.IndexOf("| LinkedIn</title>"); string End = Start.Substring(0, EndIndex).Replace(":", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Trim(); strFamilyName = End.Trim(); } catch { } } // #endregion #region Namesplitation string[] NameArr = new string[5]; if (strFamilyName.Contains(" ")) { try { NameArr = Regex.Split(strFamilyName, " "); } catch { } } #endregion #region FirstName try { firstname = NameArr[0]; } catch { } #endregion #region LastName try { lastname = NameArr[1]; } catch { } try { if (NameArr.Count() == 3) { try { lastname = NameArr[1] + " " + NameArr[2]; } catch { } } if (lastname.Contains("}]")) { #region Name try { try { strFamilyName = stringSource.Substring(stringSource.IndexOf("<span class=\"n fn\">")).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim(); } catch { try { strFamilyName = stringSource.Substring(stringSource.IndexOf("fmt__full_name\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__full_name\":")) - stringSource.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim(); } catch { } } } catch { } #endregion } } catch { } #endregion #region Company try { try { try { //soft engg at TCSi18n__LocationLocationi18n__Linkedin_memberLinkedIn Member //Company = stringSource.Substring(stringSource.IndexOf("\"memberHeadline"), (stringSource.IndexOf("memberID", stringSource.IndexOf("\"memberHeadline")) - stringSource.IndexOf("\"memberHeadline"))).Replace("\"memberHeadline", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace(" ", string.Empty).Replace("visibletrue", string.Empty).Replace("isLNLedtrue",string.Empty).Replace("isPortfoliofalse",string.Empty).Replace("i18n__Location",string.Empty).Replace("Locationi18n__Linkedin_member",string.Empty).Replace("u002d","-").Replace("LinkedIn Member",string.Empty).Replace("--Location","--").Trim(); Company = stringSource.Substring(stringSource.IndexOf("\"memberHeadline"), (stringSource.IndexOf("memberID", stringSource.IndexOf("\"memberHeadline")) - stringSource.IndexOf("\"memberHeadline"))).Replace("\"memberHeadline", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace(" ", string.Empty).Replace("visibletrue", string.Empty).Replace("isLNLedtrue", string.Empty).Replace("isPortfoliofalse", string.Empty).Replace("i18n__Location", string.Empty).Replace("Locationi18n__Linkedin_member", string.Empty).Replace("u002d", "-").Replace("LinkedIn Member", string.Empty).Replace("--Location", "--").ToString().Trim(); if (Company.Contains("#Name?")) { Company = "--"; } if (Company.Contains("i18n")) { Company = Regex.Split(Company, "i18n")[0]; } } catch { } if (string.IsNullOrEmpty(Company)) { try { Company = stringSource.Substring(stringSource.IndexOf("memberHeadline\":"), (stringSource.IndexOf(",", stringSource.IndexOf("memberHeadline\":")) - stringSource.IndexOf("memberHeadline\":"))).Replace("memberHeadline\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace(" ", string.Empty).Replace(":", "").Replace("visibletrue", string.Empty).Replace("&dsh;", "").Replace("&", "").Replace(";", "").Replace("isLNLedtrue", string.Empty).Replace("isPortfoliofalse", string.Empty).Trim(); } catch { } } if (string.IsNullOrEmpty(Company)) { try { Company = stringSource.Substring(stringSource.IndexOf("class=\"title \">"), (stringSource.IndexOf("</p></div></div><div class=\"demographic-info adr editable-item\" id=\"demographics\">", stringSource.IndexOf("</p></div></div><div class=\"demographic-info adr editable-item\" id=\"demographics\">")) - stringSource.IndexOf("class=\"title \">"))).Replace("class=\"title \">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("<strong class=highlight>", string.Empty).Replace("</strong>", string.Empty).Trim(); } catch { } } string[] strdesigandcompany = new string[4]; if (Company.Contains(" at ")) { try { strdesigandcompany = Regex.Split(Company, " at "); } catch { } #region Title try { titlecurrent = strdesigandcompany[0]; } catch { } #endregion #region Current Company try { companycurrent = strdesigandcompany[1]; } catch { } #endregion } } catch { } #region Current Company Site try { try { CurrentCompUrl = stringSource.Substring(stringSource.IndexOf("/companies"), (stringSource.IndexOf("/companies", stringSource.IndexOf("?miniprofile")) - stringSource.IndexOf("?miniprofile"))).Replace("?miniprofi", string.Empty).ToString().Trim(); CurrentCompUrl = "https://www.linkedin.com" + CurrentCompUrl; } catch { } string CompanyUrl = HttpHelper.getHtmlfromUrl1(new Uri(CurrentCompUrl)); try { CurrentCompSite = CompanyUrl.Substring(CompanyUrl.IndexOf("<dt>Website</dt>"), (CompanyUrl.IndexOf("</dd>", CompanyUrl.IndexOf("<dt>Website</dt>")) - CompanyUrl.IndexOf("<dt>Website</dt>"))).Replace("<dt>Website</dt>", string.Empty).Replace("<dd>", string.Empty).Trim(); } catch { } try { CurrentCompSite = CompanyUrl.Substring(CompanyUrl.IndexOf("<h4>Website</h4>"), (CompanyUrl.IndexOf("</p>", CompanyUrl.IndexOf("<h4>Website</h4>")) - CompanyUrl.IndexOf("<h4>Website</h4>"))).Replace("<h4>Website</h4>", string.Empty).Replace("<p>", string.Empty).Trim(); if (CurrentCompSite.Contains("a href=")) { try { string[] websArr = Regex.Split(CurrentCompSite, ">"); CurrentCompSite = websArr[1].Replace("</a", string.Empty).Replace("\n", string.Empty).Trim(); ; } catch { } } } catch { } } catch { } #endregion #region PastCompany string[] companylist = Regex.Split(stringSource, "companyName\""); if (companylist.Count() == 1) { companylist = Regex.Split(stringSource, "company-name"); } if (companylist.Count() == 1) { //companylist = Regex.Split(stringSource, "Companies"); } string AllComapny = string.Empty; string Companyname = string.Empty; if (!stringSource.Contains("company-name") && companylist.Count() > 1) { foreach (string item in companylist) { try { if (!item.Contains("<!DOCTYPE html>")) { Companyname = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("}", string.Empty).Replace("]", string.Empty).Trim(); string items = item; checkerlst.Add(Companyname); checkerlst = checkerlst.Distinct().ToList(); } } catch { } } } else { foreach (string item in companylist) { try { if (!item.Contains("<!DOCTYPE html>")) { Companyname = item.Substring(item.IndexOf(">"), (item.IndexOf("<", item.IndexOf(">")) - item.IndexOf(">"))).Replace(">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("}", string.Empty).Replace("]", string.Empty).Trim(); string items = item; if (!string.IsNullOrEmpty(Companyname)) { checkerlst.Add(Companyname); checkerlst = checkerlst.Distinct().ToList(); } } } catch { } } } AllComapny = string.Empty; foreach (string item1 in checkerlst) { if (string.IsNullOrEmpty(AllComapny)) { AllComapny = item1.Replace("}", "").Replace("]", "").Replace("&", "&"); } else { AllComapny = AllComapny + " : " + item1.Replace("}", "").Replace("]", "").Replace("&", "&"); } } #endregion #endregion Company #region Company Descripription try { string[] str_CompanyDesc = Regex.Split(stringSource, "showSummarySection"); foreach (string item in str_CompanyDesc) { try { string Current_Company = string.Empty; if (!item.Contains("<!DOCTYPE html>")) { int startindex = item.IndexOf("specialties\":\""); if (startindex > 0) { try { string start = item.Substring(startindex).Replace("specialties\":", ""); int endindex = start.IndexOf("\",\"associatedWith\""); string end = start.Substring(0, endindex); Current_Company = end.Replace(",\"specialties_lb\":", string.Empty).Replace("\"", string.Empty).Replace("summary_lb", "Summary").Replace("•", ";").Replace("<br>", string.Empty).Replace("\\n", string.Empty).Replace("\"u002", "-"); LDS_BackGround_Summary = Current_Company; } catch { } } } if (!item.Contains("<!DOCTYPE html>")) { int startindex = item.IndexOf("\"summary_lb\""); if (startindex > 0) { try { string start = item.Substring(startindex).Replace("\"summary_lb\"", ""); int endindex = start.IndexOf("\",\"associatedWith\""); string end = start.Substring(0, endindex); Current_Company = end.Replace(",\"specialties_lb\":", string.Empty).Replace("<br>", string.Empty).Replace("\n", string.Empty).Replace("\"", string.Empty).Replace("summary_lb", "Summary").Replace(",", ";").Replace("u002", "-").Replace("•", string.Empty).Replace(":", string.Empty); LDS_BackGround_Summary = Current_Company; } catch { } } } } catch { } } if (string.IsNullOrEmpty(LDS_BackGround_Summary)) { try { LDS_BackGround_Summary = HttpHelper.GetDataWithTagValueByTagAndAttributeNameWithId(stringSource, "div", "summary-item-view"); LDS_BackGround_Summary = Regex.Replace(LDS_BackGround_Summary, "<.*?>", string.Empty).Replace(",", "").Replace("\n", "").Replace("<![CDATA[", "").Trim(); } catch { } } } catch { } #endregion #region Education try { string[] str_UniversityName = Regex.Split(stringSource, "link__school_name"); foreach (string item in str_UniversityName) { try { string School = string.Empty; string Degree = string.Empty; string SessionEnd = string.Empty; string SessionStart = string.Empty; string Education = string.Empty; if (stringSource.Contains("link__school_name")) { if (!item.Contains("<!DOCTYPE html>")) { try { try { int startindex = item.IndexOf("fmt__school_highlight"); string start = item.Substring(startindex).Replace("fmt__school_highlight", ""); int endindex = start.IndexOf(","); School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty); } catch { } try { int startindex1 = item.IndexOf("degree"); string start1 = item.Substring(startindex1).Replace("degree", ""); int endindex1 = start1.IndexOf(","); Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty); } catch { } try { int startindex2 = item.IndexOf("enddate_my"); string start2 = item.Substring(startindex2).Replace("enddate_my", ""); int endindex2 = start2.IndexOf(","); SessionEnd = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty); } catch { } try { int startindex3 = item.IndexOf("startdate_my"); string start3 = item.Substring(startindex3).Replace("startdate_my", ""); int endindex3 = start3.IndexOf(","); SessionStart = start3.Substring(0, endindex3).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty); } catch { } if (SessionStart == string.Empty && SessionEnd == string.Empty) { Education = " [" + School + "] Degree: " + Degree; } else { Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd; } //University = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\u002d", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); } catch { } EducationList.Add(Education); } } else { str_UniversityName = Regex.Split(stringSource, "<div class=\"education"); foreach (string tempItem in str_UniversityName) { try { if (!tempItem.Contains("<!DOCTYPE html>")) { List<string> lstSchool = HttpHelper.GetTextDataByTagAndAttributeName(tempItem, "h4", "summary fn org"); List<string> lstDegree = HttpHelper.GetTextDataByTagAndAttributeName(tempItem, "span", "degree"); List<string> lstSession = HttpHelper.GetTextDataByTagAndAttributeName(tempItem, "span", "education-date"); if (lstSession.Count == 0) { Education = " [" + lstSchool[0] + "] Degree: " + lstDegree[0]; } else { Education = " [" + lstSchool[0] + "] Degree: " + lstDegree[0] + " Session: " + lstSession[0].Replace("–", "-").Replace(",", "").Trim(); } EducationList.Add(Education); } } catch { } } } } catch { } } EducationList = EducationList.Distinct().ToList(); foreach (string item in EducationList) { if (string.IsNullOrEmpty(EducationCollection)) { EducationCollection = item.Replace("}", "").Replace("]", "").Replace("&", "&"); } else { EducationCollection = EducationCollection + " - " + item.Replace("}", "").Replace("]", "").Replace("&", "&"); } } // string University1 = stringSource.Substring(stringSource.IndexOf("schoolName\":"), (stringSource.IndexOf(",", stringSource.IndexOf("schoolName\":")) - stringSource.IndexOf("schoolName\":"))).Replace("schoolName\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); } catch { } #endregion Education #region Email try { if (stringSource.Contains("mailto:")) { string[] str_Email = Regex.Split(stringSource, "mailto:"); USERemail = stringSource.Substring(stringSource.IndexOf("mailto:"), (stringSource.IndexOf(">", stringSource.IndexOf("mailto:")) - stringSource.IndexOf("mailto:"))).Replace("mailto:", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); } else { string[] str_Email = Regex.Split(stringSource, "email\""); USERemail = stringSource.Substring(stringSource.IndexOf("[{\"email\":"), (stringSource.IndexOf("}]", stringSource.IndexOf("[{\"email\":")) - stringSource.IndexOf("[{\"email\":"))).Replace("[{\"email\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); } } catch (Exception ex) { } #endregion Email #region UserContact try { if (stringSource.Contains("<div id=\"phone-view\">")) { //string[] str_Contact = Regex.Split(stringSource, "<div id=\"phone-view\">"); LDS_UserContact = stringSource.Substring(stringSource.IndexOf("<div id=\"phone-view\">"), (stringSource.IndexOf("</li>", stringSource.IndexOf("<div id=\"phone-view\">")) - stringSource.IndexOf("<div id=\"phone-view\">"))).Replace("<div id=\"phone-view\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("<ul><li>", string.Empty).Replace(" ", "").Trim(); } else { //string[] str_Email = Regex.Split(stringSource, "<div id=\"phone-view\">"); LDS_UserContact = stringSource.Substring(stringSource.IndexOf("<div id=\"phone-view\">"), (stringSource.IndexOf("</li>", stringSource.IndexOf("<div id=\"phone-view\">")) - stringSource.IndexOf("<div id=\"phone-view\">"))).Replace("<div id=\"phone-view\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("<ul><li>", string.Empty).Replace(" ", "").Trim(); } } catch (Exception ex) { } #endregion Email #region Website try { Website = stringSource.Substring(stringSource.IndexOf("[{\"URL\":"), (stringSource.IndexOf(",", stringSource.IndexOf("[{\"URL\":")) - stringSource.IndexOf("[{\"URL\":"))).Replace("[{\"URL\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("}", string.Empty).Replace("]", string.Empty).Trim(); } catch { } if (string.IsNullOrEmpty(Website)) { try { Website = HttpHelper.GetDataWithTagValueByTagAndAttributeNameWithId(stringSource, "div", "website-view"); Website = Regex.Replace(Website, "<[^>]*>", String.Empty).Replace("\n", "").Replace("\r", "").Replace(" ", " ").Trim(); Website = Regex.Replace(Website, @"\s+", " ").Replace(",", " ").Trim(); } catch { } } #endregion Website #region location try { //location = stringSource.Substring(stringSource.IndexOf("Country\",\"fmt__location\":"), (stringSource.IndexOf("i18n_no_location_matches", stringSource.IndexOf("Country\",\"fmt__location\":")) - stringSource.IndexOf("Country\",\"fmt__location\":"))).Replace("Country\",\"fmt__location\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); int startindex = stringSource.IndexOf("fmt_location"); string start = stringSource.Substring(startindex).Replace("fmt_location\":\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex).Replace("\u002d", string.Empty); location = end; } catch (Exception ex) { } if (string.IsNullOrEmpty(location)) { try { List<string> lstLocation = HttpHelper.GetTextDataByTagAndAttributeName(stringSource, "span", "locality"); if (lstLocation.Count > 0) { location = lstLocation[lstLocation.Count - 1].Trim(); } } catch { } } #endregion location #region Country try { int startindex = stringSource.IndexOf("\"geo_region\":"); if (startindex > 0) { string start = stringSource.Substring(startindex).Replace("\"geo_region\":", ""); int endindex = start.IndexOf("\"i18n_geo_region\":\"Location\""); string end = start.Substring(0, endindex); country = end; string[] array = Regex.Split(end, "\"name\":\""); array = array.Skip(1).ToArray(); foreach (string item in array) { try { int startindex1 = item.IndexOf("\",\""); string strat1 = item.Substring(0, startindex1); country = strat1; break; } catch (Exception ex) { } } } } catch (Exception ex) { } if (country == string.Empty) { try { string[] countLocation = location.Split(','); if (countLocation.Count() == 2) { country = location.Split(',')[1]; } else if (countLocation.Count() == 3) { country = location.Split(',')[2]; } } catch { } } #endregion #region Industry try { //Industry = stringSource.Substring(stringSource.IndexOf("fmt__industry_highlight\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__industry_highlight\":")) - stringSource.IndexOf("fmt__industry_highlight\":"))).Replace("fmt__industry_highlight\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); int startindex = stringSource.IndexOf("\"industry_highlight\":\""); if (startindex > 0) { string start = stringSource.Substring(startindex).Replace("\"industry_highlight\":\"", ""); int endindex = start.IndexOf("\","); string end = start.Substring(0, endindex).Replace("\"", string.Empty).Replace("</strong>", string.Empty).Replace("&", "&"); if (end.Contains("strong class")) { Industry = end.Split('>')[1]; } else { Industry = end; } } } catch (Exception ex) { } if (string.IsNullOrEmpty(Industry)) { try { List<string> lstIndustry = HttpHelper.GetTextDataByTagAndAttributeName(stringSource, "dd", "industry"); if (lstIndustry.Count > 0) { Industry = lstIndustry[0].Replace(",", ":").Trim(); } } catch { } } #endregion Industry #region Connection try { //Connection = stringSource.Substring(stringSource.IndexOf("_count_string\":"), (stringSource.IndexOf(",", stringSource.IndexOf("_count_string\":")) - stringSource.IndexOf("_count_string\":"))).Replace("_count_string\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); int startindex = stringSource.IndexOf("\"numberOfConnections\":"); if (startindex > 0) { string start = stringSource.Substring(startindex).Replace("\"numberOfConnections\":", ""); int endindex = start.IndexOf(","); string end = start.Substring(0, endindex).Replace("&", "&").Replace("}", string.Empty); Connection = end; } } catch (Exception ex) { } if (string.IsNullOrEmpty(Connection)) { try { List<string> lstConnection = HttpHelper.GetTextDataByTagAndAttributeName(stringSource, "div", "member-connections"); if (lstConnection.Count > 0) { Connection = lstConnection[0].Replace(",", ":").Trim(); } } catch { } } #endregion Connection #region Recommendation try { string RecomnedUrl = string.Empty; try { int startindex = stringSource.IndexOf("endorsements?id="); string start = stringSource.Substring(startindex); int endIndex = start.IndexOf("\"mem_pic\":"); if (endIndex < 0) { endIndex = start.IndexOf(">"); } RecomnedUrl = (start.Substring(0, endIndex).Replace(",", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty)); } catch { } string PageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/profile-v2-" + RecomnedUrl + "")); string[] arrayRecommendedName = Regex.Split(PageSource, "headline"); if (arrayRecommendedName.Count() == 1) { arrayRecommendedName = Regex.Split(PageSource, "fmt__recommendeeFullName"); } List<string> ListRecommendationName = new List<string>(); foreach (var itemRecomName in arrayRecommendedName) { try { if (!itemRecomName.Contains("Endorsements")) { string Heading = string.Empty; string Name = string.Empty; try { int startindex = itemRecomName.IndexOf(":"); string start = itemRecomName.Substring(startindex); int endIndex = start.IndexOf("\","); Heading = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty).Replace(",", ";")); } catch { } try { int startindex1 = itemRecomName.IndexOf("fmt__referrerfullName"); string start1 = itemRecomName.Substring(startindex1); int endIndex1 = start1.IndexOf("\","); Name = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace("fmt__referrerfullName", string.Empty).Replace(":", string.Empty)); } catch { } if (Name == string.Empty) { int startindex1 = itemRecomName.IndexOf("recommenderTitle\":"); string start1 = itemRecomName.Substring(startindex1); int endIndex1 = start1.IndexOf("\","); Name = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace("recommenderTitle", string.Empty).Replace(":", string.Empty).Replace(",", string.Empty)); } ListRecommendationName.Add(Name + " : " + Heading); } } catch { } } foreach (var item in ListRecommendationName) { if (recomandation == string.Empty) { recomandation = item; } else { recomandation += " - " + item; } } } catch { } #endregion #region Following #endregion #region Experience if (LDS_Experience == string.Empty) { try { string[] array = Regex.Split(stringSource, "title_highlight"); string exp = string.Empty; string comp = string.Empty; List<string> ListExperince = new List<string>(); string SelItem = string.Empty; if (stringSource.Contains("title_highlight")) { foreach (var itemGrps in array) { try { if (itemGrps.Contains("title_pivot") && !itemGrps.Contains("<!DOCTYPE html")) //">Join { try { int startindex = itemGrps.IndexOf("\":\""); string start = itemGrps.Substring(startindex); int endIndex = start.IndexOf(","); exp = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&", "&").Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty)); } catch { } if ((exp.Contains("strong class")) || (exp.Contains("highlight")) || (string.IsNullOrEmpty(exp))) { try { int startindex1 = itemGrps.IndexOf("\"title\":"); string start1 = itemGrps.Substring(startindex1).Replace("\"title\":", string.Empty); int endIndex1 = start1.IndexOf(","); exp = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&", "&").Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty)); } catch { } } try { int startindex1 = itemGrps.IndexOf("companyName"); string start1 = itemGrps.Substring(startindex1); int endIndex1 = start1.IndexOf(","); comp = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace("companyName", string.Empty).Replace(":", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty)); } catch { } if (titlecurrent == string.Empty) { titlecurrent = exp; } if (companycurrent == string.Empty) { companycurrent = comp; } ListExperince.Add(exp + ":" + comp); } } catch { } } } else { array = Regex.Split(stringSource, "<header>"); foreach (string tempItem in array) { try { if (!tempItem.Contains("<!DOCTYPE html>")) { List<string> lstExp = objChilkat.GetDataTag(tempItem, "h4"); List<string> lstComp = objChilkat.GetDataTag(tempItem, "h5"); if (lstExp.Count > 0) { exp = lstExp[0]; } if (lstComp.Count > 0) { comp = lstComp[0]; if (string.IsNullOrEmpty(comp)) { comp = lstComp[1]; } } if (titlecurrent == string.Empty) { titlecurrent = lstExp[0]; } if (companycurrent == string.Empty) { companycurrent = lstComp[0]; } ListExperince.Add(exp + ":" + comp); } } catch { } } } foreach (var item in ListExperince) { if (LDS_Experience == string.Empty) { LDS_Experience = item; } else { LDS_Experience += " - " + item; } } } catch { } try { if (string.IsNullOrEmpty(titlecurrent)) { int StartIndex = stringSource.IndexOf("trk=prof-0-ovw-curr_pos\">"); string Start = stringSource.Substring(StartIndex).Replace("trk=prof-0-ovw-curr_pos\">", string.Empty); int EndIndex = Start.IndexOf("</a>"); string End = Start.Substring(0, EndIndex).Replace("</a>", string.Empty); titlecurrent = End.Trim(); } } catch { } } #endregion #region Group try { string GroupUrl = string.Empty; try { int startindex = stringSource.IndexOf("templateId\":\"profile_v2_connections"); string start = stringSource.Substring(startindex); //int endIndex = start.IndexOf("vsrp_people_res_name"); int endIndex = start.IndexOf("}"); GroupUrl = (start.Substring(0, endIndex).Replace(",", string.Empty).Replace("\"", string.Empty).Replace("templateId:profile_v2_connectionsurl:", string.Empty)); } catch { } string PageSource = HttpHelper.getHtmlfromUrl1(new Uri(GroupUrl)); string[] array1 = Regex.Split(PageSource, "groupRegistration?"); List<string> ListGroupName = new List<string>(); string SelItem = string.Empty; foreach (var itemGrps in array1) { try { if (itemGrps.Contains("?gid=") && !itemGrps.Contains("<!DOCTYPE html")) //">Join { if (itemGrps.IndexOf("?gid=") == 0) { try { int startindex = itemGrps.IndexOf("\"name\":"); string start = itemGrps.Substring(startindex); int endIndex = start.IndexOf(","); ListGroupName.Add(start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("amp", string.Empty).Replace("&", string.Empty).Replace(";", string.Empty).Replace("csrfToken", string.Empty).Replace("name:", string.Empty)); } catch { } } } } catch { } } foreach (var item in ListGroupName) { if (groupscollectin == string.Empty) { groupscollectin = item; } else { groupscollectin += " - " + item; } } } catch { } if (string.IsNullOrEmpty(groupscollectin)) { List<string> lstGroupData = new List<string>(); string[] array1 = Regex.Split(stringSource, "link_groups_settings\":?"); array1 = array1.Skip(1).ToArray(); foreach (string item in array1) { string _item = Utils.getBetween(item, "name\":", ",").Replace("name\":", "").Replace(":", "").Replace("\"", ""); lstGroupData.Add(_item); } foreach (var item in lstGroupData) { if (groupscollectin == string.Empty) { groupscollectin = item; } else { groupscollectin += " - " + item; } } } if (string.IsNullOrEmpty(groupscollectin)) { List<string> lstGroupData = new List<string>(); string tempResponse = Utils.getBetween(stringSource, "<div id=\"groups\"", "<div>"); lstGroupData = HttpHelper.GetDataTag(tempResponse, "strong"); foreach (var item in lstGroupData) { if (groupscollectin == string.Empty) { groupscollectin = item; } else { groupscollectin += " - " + item; } } } #endregion #region skill and Expertise try { string[] strarr_skill = Regex.Split(stringSource, "endorse-item-name-text\""); string[] strarr_skill1 = Regex.Split(stringSource, "fmt__skill_name\""); if (strarr_skill.Count() >= 2) { foreach (string item in strarr_skill) { try { if (!item.Contains("!DOCTYPE html")) { try { //string Grp = item.Substring(item.IndexOf("<"), (item.IndexOf(">", item.IndexOf("<")) - item.IndexOf("<"))).Replace("<", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("\"u002", "-").Trim(); string Grp = item.Substring(item.IndexOf(">"), (item.IndexOf("<", item.IndexOf(">")) - item.IndexOf(">"))).Replace(">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("\"u002", "-").Trim(); checkgrplist.Add(Grp); checkgrplist.Distinct().ToList(); } catch { } } } catch { } } foreach (string item in checkgrplist) { if (string.IsNullOrEmpty(Skill)) { Skill = item.Replace("\"u002", "-").Trim(); } else { Skill = Skill + " - " + item; } } } else { if (strarr_skill1.Count() >= 2) { try { foreach (string skillitem in strarr_skill1) { if (!skillitem.Contains("!DOCTYPE html")) { try { string Grp = skillitem.Substring(skillitem.IndexOf(":"), (skillitem.IndexOf("}", skillitem.IndexOf(":")) - skillitem.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); checkgrplist.Add(Grp); checkgrplist.Distinct().ToList(); } catch { } } } foreach (string item in checkgrplist) { if (string.IsNullOrEmpty(Skill)) { Skill = item; } else { Skill = Skill + " - " + item; } } } catch (Exception ex) { } } } } catch (Exception ex) { } Skill = Skill.Replace("a href=\";edu", "").Trim(); #endregion #region Pasttitle string[] pasttitles = Regex.Split(stringSource, "title_highlight"); string pstTitlesitem = string.Empty; pasttitles = pasttitles.Skip(1).ToArray(); foreach (string item in pasttitles) { try { if (!item.Contains("<!DOCTYPE html>") && !item.Contains("Tip: You can also search by keyword")) { try { string[] Past_Ttl = Regex.Split(item, ","); pstTitlesitem = Past_Ttl[0].Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\u002d", "-").Replace("&", "&"); } catch { } if ((pstTitlesitem.Contains("strong class")) || (pstTitlesitem.Contains("highlight")) || (string.IsNullOrEmpty(pstTitlesitem))) { try { int startindex1 = item.IndexOf("\"title\":"); string start1 = item.Substring(startindex1).Replace("\"title\":", string.Empty); int endIndex1 = start1.IndexOf(","); pstTitlesitem = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&", "&").Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty)); } catch { } } if (string.IsNullOrEmpty(LDS_PastTitles)) { LDS_PastTitles = pstTitlesitem; } else if (LDS_PastTitles.Contains(pstTitlesitem)) { continue; } else { LDS_PastTitles = LDS_PastTitles + " : " + pstTitlesitem; } } } catch { } } #endregion #region All Company Summary //string[] pasttitles = Regex.Split(stringSource, "company_name"); //string pstTitlesitem = string.Empty; string pstDescCompitem = string.Empty; pasttitles = pasttitles.Skip(1).ToArray(); foreach (string item in pasttitles) { if (item.Contains("positionId")) { try { int startindex = item.IndexOf(":"); if (startindex > 0) { string start = item.Substring(startindex).Replace(":\"", ""); int endindex = start.IndexOf("\","); string end = start.Substring(0, endindex); pstTitlesitem = end.Replace(",", ";").Replace("&", "&").Replace("\\u002d", "-"); } int startindex1 = item.IndexOf("summary_lb\":\""); if (startindex > 0) { string start1 = item.Substring(startindex1).Replace("summary_lb\":\"", ""); int endindex1 = 0; if (start1.Contains("associatedWith")) { endindex1 = start1.IndexOf("\",\"associatedWith\""); if (start1.Contains("\"}")) { endindex1 = start1.IndexOf("\"}"); } } else if (start1.Contains("\"}")) { endindex1 = start1.IndexOf("\"}"); } string end1 = start1.Substring(0, endindex1); pstDescCompitem = end1.Replace(",", ";").Replace("u002d", "-").Replace("<br>", string.Empty).Replace("\\n", string.Empty).Replace("\\", string.Empty).Replace("", "@").Replace("’", "'").Replace("•", "@").Replace("●", "@"); if (pstDescCompitem.Contains("\";\"associatedWith")) { pstDescCompitem = Regex.Split(pstDescCompitem, "\";\"associatedWith")[0]; } } if (string.IsNullOrEmpty(LDS_Desc_AllComp)) { LDS_Desc_AllComp = pstTitlesitem + "-" + pstDescCompitem + " ++ "; } else { LDS_Desc_AllComp = LDS_Desc_AllComp + pstTitlesitem + "-" + pstDescCompitem + " ++ "; } } catch { } } } #endregion #region AccountType try { if (stringSource.Contains("has a Premium Account") || stringSource.Contains("Account Holder")) { AccountType = "Premium Account"; } else { AccountType = "Basic Account"; } } catch (Exception ex) { } #endregion Email #region FullUrl try { string[] UrlFull = System.Text.RegularExpressions.Regex.Split(Url, "&authType"); LDS_UserProfileLink = UrlFull[0]; LDS_UserProfileLink = Url; // LDS_UserProfileLink = stringSource.Substring(stringSource.IndexOf("canonicalUrl\":"), (stringSource.IndexOf(",", stringSource.IndexOf("canonicalUrl\":")) - stringSource.IndexOf("canonicalUrl\":"))).Replace("canonicalUrl\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); } catch { } #endregion LDS_LoginID = SearchCriteria.LoginID; if (string.IsNullOrEmpty(firstname)) { firstname = "Linkedin Member"; } string endName = firstname + " " + lastname; //GroupStatus.GroupSpecMem.Add(GroupMemId, endName); if (firstname == string.Empty) firstname = "LinkedIn"; if (lastname == string.Empty) lastname = "Member"; if (Company == string.Empty) Company = "--"; if (titlecurrent == string.Empty) titlecurrent = "--"; if (companycurrent == string.Empty) companycurrent = "--"; if (LDS_Desc_AllComp == string.Empty) LDS_Desc_AllComp = "--"; if (LDS_BackGround_Summary == string.Empty) LDS_BackGround_Summary = "--"; if (Connection == string.Empty) Connection = "--"; if (recomandation == string.Empty) recomandation = "--"; if (Skill == string.Empty) Skill = "--"; if (LDS_Experience == string.Empty) LDS_Experience = "--"; if (EducationCollection == string.Empty) EducationCollection = "--"; if (groupscollectin == string.Empty) groupscollectin = "--"; if (USERemail == string.Empty) USERemail = "--"; if (LDS_UserContact == string.Empty) LDS_UserContact = "--"; if (LDS_PastTitles == string.Empty) LDS_PastTitles = "--"; if (AllComapny == string.Empty) AllComapny = "--"; if (location == string.Empty) location = "--"; if (country == string.Empty) country = "--"; if (Industry == string.Empty) Industry = "--"; if (Website == string.Empty) Website = "--"; string LDS_FinalData = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + CurrentCompSite.Replace(",", ";") + "," + LDS_BackGround_Summary.Replace(",", ";") + "," + Connection.Replace(",", ";") + "," + recomandation.Replace(",", string.Empty) + "," + Skill.Replace(",", ";") + "," + LDS_Experience.Replace(",", string.Empty) + "," + EducationCollection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + LDS_UserContact.Replace(",", ";") + "," + LDS_PastTitles + "," + AllComapny.Replace(",", ";") + "," + location.Replace(",", ";") + "," + country.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID + "," + AccountType; if (!string.IsNullOrEmpty(firstname)) { //Log("[ " + DateTime.Now + " ] => [ Data : " + LDS_FinalData + " ]"); } else { AddToLogger("[ " + DateTime.Now + " ] => [ No Data For URL : " + Url + " ]"); GlobusFileHelper.AppendStringToTextfileNewLineWithCarat(Url, Globals.DesktopFolder + "\\UnScrapedList.txt"); } if (SearchCriteria.starter) { //string tempFinalData = LDS_FinalData.Replace(";", "").Replace(LDS_UserProfileLink, "").Replace(TypeOfProfile, "").Replace(",", "").Replace(LDS_LoginID, "").Trim(); //if (!string.IsNullOrEmpty(tempFinalData)) { //if (CheckEmployeeScraper) //{ // string FileName = "CompanyEmployeeScraper"; // AppFileHelper.AddingLinkedInDataToCSVFileCompanyEmployeeScraper(LDS_FinalData, FileName); // return true; //} //else if (CampaignScraper) { AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, FileName); return true; } //else //{ // AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, SearchCriteria.FileName); // return true; //} } } } catch { } return false; }
public bool GetYahooMails(string yahooEmail, string yahooPassword) { GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); bool activate = false; try { bool emaildata = false; Chilkat.Http http = new Chilkat.Http(); ///Chilkat Http Request to be used in Http Post... Chilkat.HttpRequest req = new Chilkat.HttpRequest(); bool success; // Any string unlocks the component for the 1st 30-days. success = http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06"); if (success != true) { Console.WriteLine(http.LastErrorText); return(false); } http.CookieDir = "memory"; http.SendCookies = true; http.SaveCookies = true; //http.ProxyDomain = "127.0.0.1"; //http.ProxyPort = 8888; http.SetRequestHeader("Accept-Encoding", "gzip,deflate"); Chilkat.Imap iMap = new Imap(); string Username = yahooEmail; string Password = yahooPassword; //Username = "******"; //Password = "******"; iMap.UnlockComponent("THEBACIMAPMAILQ_OtWKOHoF1R0Q"); //iMap. //iMap.HttpProxyHostname = "127.0.0.1"; //iMap.HttpProxyPort = 8888; iMap.Connect("imap.n.mail.yahoo.com"); iMap.Login(yahooEmail, yahooPassword); iMap.SelectMailbox("Inbox"); // Get a message set containing all the message IDs // in the selected mailbox. Chilkat.MessageSet msgSet; //msgSet = iMap.Search("FROM \"facebookmail.com\"", true); msgSet = iMap.GetAllUids(); // Fetch all the mail into a bundle object. Chilkat.Email email = new Chilkat.Email(); //bundle = iMap.FetchBundle(msgSet); string strEmail = string.Empty; List <string> lstData = new List <string>(); if (msgSet != null) { for (int i = msgSet.Count; i > 0; i--) { email = iMap.FetchSingle(msgSet.GetId(i), true); strEmail = email.Subject; string emailHtml = email.GetHtmlBody(); lstData.Add(strEmail); if (email.Subject.Contains("[WordPress] Activate") && email.Subject.Contains("wordpress.com")) { foreach (string href in GetUrlsFromString(email.Body)) { try { string staticUrl = string.Empty; staticUrl = href; responce = http.QuickGetStr(staticUrl); if (responce.Contains("Your account is now active")) { emaildata = true; //Log("your Account is activate now"); activate = true; } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } } } if (emaildata == false) { Log("[ " + DateTime.Now + " ] => [ activation link is not find in user account so your Account is not activate please activate now ]"); } } catch (Exception ex) { } return(activate); }
public void StartAcceptInvitations(ref GlobusHttpHelper httpHelper) { try { string csrfToken = string.Empty; string userFirstName = string.Empty; string UserLastName = string.Empty; string SenderName = string.Empty; string newPagesource = string.Empty; bool isTrue = false; int startRow = 1; string pageSource = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/inbox/invitations/pending")); var resultForUserDetails = FindTheUserName(pageSource); try { resultForUserDetails = resultForUserDetails.Substring(resultForUserDetails.IndexOf("alt="), resultForUserDetails.IndexOf("height") - resultForUserDetails.IndexOf("alt=")).Replace("alt=", string.Empty).Replace("/", string.Empty).Trim(); userFirstName = resultForUserDetails.Split(' ')[0].Replace("\"", string.Empty); UserLastName = resultForUserDetails.Split(' ')[1].Replace("\"", string.Empty); } catch { } if (pageSource.Contains("csrfToken")) { csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 100); string[] Arr = csrfToken.Split('"'); try { foreach (string item in Arr) { try { if (item.Contains("csrfToken=")) { csrfToken = item.Substring(item.IndexOf("csrfToken="), item.IndexOf("&", item.IndexOf("csrfToken=")) - item.IndexOf("csrfToken=")).Replace("csrfToken=", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim();//Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty); break; } } catch (Exception ex) { } if (item.Contains("csrfToken=")) { csrfToken = item.Replace("csrfToken=", string.Empty).Trim(); break; } } } catch (Exception ex) { //csrfToken = Arr[0].Replace("csrfToken=", "").Replace("\\", ""); } } // For Show More //string postData1 = "pkey=inbox-invitations-pending&tcode=%5Bobject%20Arguments%5D&plist="; //string response1 = httpHelper.postFormData(new Uri("http://www.linkedin.com/lite/web-action-track?csrfToken="+csrfToken+""),postData1); //string pageSource2=httpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/inbox/invitations/pending/more?sinceDate=1366351490125&startRow=6&count=20&showBlocked=false&ctx=inbox&rnd=1366353236172")); //*** Conver HTML to XML *******************************// #region Convert HTML to XML ChilkatHttpHelpr objhelper = new ChilkatHttpHelpr(); //xHtml contain xml data string xHtml = objhelper.ConvertHtmlToXml(pageSource); Chilkat.Xml xml = new Chilkat.Xml(); xml.LoadXml(xHtml); //xHtml. //// Iterate over all h1 tags: Chilkat.Xml xNode = default(Chilkat.Xml); Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml); #endregion #region Invitatin count xBeginSearchAfter = null; xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "invitation-count count "); try { while ((xNode != null)) { string strvalue = xNode.AccumulateTagContent("text", "script|style"); string Invitatincount = strvalue; Log("[ " + DateTime.Now + " ] => [ Invitation Count = " + Invitatincount + " UserName = "******" ]"); Log("-----------------------------------------------------------------------------------------------------------------------------------"); break; } } catch (Exception ex) { } #endregion do { newPagesource = httpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/inbox/invitations?keywords=&sortBy=&startRow=" + startRow + "&subFilter=&trk=&showBlocked=false")); if (newPagesource.Contains("inbox-list")) { string inbox_list = httpHelper.GetDataWithTagValueByTagAndAttributeNameWithClass(newPagesource, "ol", "inbox-list "); if (inbox_list.Contains("<li")) { isTrue = true; string[] srrLi = Regex.Split(inbox_list, "<li"); foreach (string item in srrLi) { try { if (item.Contains("data-gid=\"")) { string data_gid = item.Substring(item.IndexOf("data-gid=\"") + 10, item.IndexOf("\"", item.IndexOf("data-gid=\"") + 10) - (item.IndexOf("data-gid=\"") + 10)).Replace("\"", string.Empty).Replace("data-gid=\"", string.Empty).Trim(); int startindex1 = item.IndexOf("alt="); string start1 = item.Substring(startindex1).Replace("alt=",string.Empty); int endindex1 = start1.IndexOf("height"); string end1 = start1.Substring(0, endindex1).Replace("\"", string.Empty).Trim(); SenderName = end1; string response2 = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/inbox/action?mboxItemGID=" + data_gid + "&actionType=invitationAccept&csrfToken=" + csrfToken + "&goback=%2Epiv_*1_*1_*1_*1_*1&trk=inbox-invitations-inv-accept&ctx=inbox&rnd=1366352095313")); if (response2.Contains(" are now connected")) { string SuccessMsg = string.Empty; int startindex = response2.IndexOf("<div class=\"confirmation\">"); if (startindex > 0) { try { string start = response2.Substring(startindex).Replace("<div class=\"confirmation\">", string.Empty); int endindex = start.IndexOf("<ul>"); string end = start.Substring(0, endindex); //SuccessMsg = end.Replace("<h4>", string.Empty).Replace("\"", string.Empty).Replace("</h4>", string.Empty).Replace("\n", string.Empty).Replace("\t", string.Empty).Replace("\"u002", "-").Replace("You", "User: "******"<h4>", string.Empty).Replace("\"", string.Empty).Replace("</h4>", string.Empty).Replace("\n", string.Empty).Replace("\t", string.Empty).Replace("\"u002", "-").Replace("You", "User: "******"( Name:" + userFirstName + " " + UserLastName + ") ").Trim(); } catch { } } GlobusFileHelper.AppendStringToTextfileNewLine(SuccessMsg, Globals.path_AcceptInvitationEmail); Log("[ " + DateTime.Now + " ] => [ " + SuccessMsg + " ]"); } if (!(response2.Contains(SenderName))) { Log("[ " + DateTime.Now + " ] => [ Invitation accepted from " + SenderName + " ]"); } else { //Log("There is some error !"); } } } catch (Exception ex) { } } } else { //Log("[ " + DateTime.Now + " ] => [ There is no invitation ! ]"); Log("[ " + DateTime.Now + " ] => [ No more invitations left to accept ! ]"); } } startRow = startRow + 10; } while (newPagesource.Contains("is now a connection.")); //else //{ // Log("[ " + DateTime.Now + " ] => [ There is no invitation ! ]"); //} //if (isTrue) //{ // StartAcceptInvitations(ref httpHelper); //} } catch (Exception ex) { } }
public static List<string> GetAllFriends(ref GlobusHttpHelper globusHttpHelper, string userId) { List<string> finalList_Friends = new List<string>(); List<string> list_finalFriendsID = new List<string>(); try { string pgSource_Friends = globusHttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/profile.php?id=" + userId + "&sk=friends"));////fbProfileUrl = "https://www.facebook.com/profile.php?id="; string[] Friends = Regex.Split(pgSource_Friends, "user.php"); ParseFriendIDs(Friends, finalList_Friends); List<string> lstnewfriendid = new List<string>(); // {"collection_token":"1220529617:2356318349:2","cursor":"MDpub3Rfc3RydWN0dXJlZDoxMDAwMDA5MjM1MTg5MjY=","tab_key":"friends","profile_id":1220529617,"overview":false,"ftid":null,"order":null,"sk":"friends"} string collection_token = ""; string cursor = ""; //check if all friends loaded string patternAllFriendsLoaded = "\"TimelineAppCollection\",\"setFullyLoaded\",[],[\"pagelet_timeline_app_collection_"; int tempCount_AjaxRequests = 0; do // { try { collection_token = ""; cursor = ""; string[] arry = Regex.Split(pgSource_Friends, "enableContentLoader"); if (arry.Length > 1) { try { string rawData = arry[1]; int startIndx_collection_token = rawData.IndexOf("pagelet_timeline_app_collection_") + "pagelet_timeline_app_collection_".Length; int endIndx_collection_token = rawData.IndexOf("\"", startIndx_collection_token); collection_token = rawData.Substring(startIndx_collection_token, endIndx_collection_token - startIndx_collection_token); int startIndx_cursor = rawData.IndexOf(",\"", endIndx_collection_token) + ",\"".Length; int endIndx_cursor = rawData.IndexOf("\"", startIndx_cursor); cursor = rawData.Substring(startIndx_cursor, endIndx_cursor - startIndx_cursor); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } string raw_data = "{\"collection_token\":\"" + collection_token + "\",\"cursor\":\"" + cursor + "\",\"tab_key\":\"friends\",\"profile_id\":" + userId + ",\"overview\":false,\"ftid\":null,\"order\":null,\"sk\":\"friends\"}"; string encoded_raw_data = Uri.EscapeDataString(raw_data); string getURL_MoreFriendsAjax = "https://www.facebook.com/ajax/pagelet/generic.php/AllFriendsAppCollectionPagelet?data=" + encoded_raw_data + "&__user="******"&__a=1&__dyn=7n8ahyj2qmudwNAEU&__req=2"; string res_getURL_MoreFriendsAjax = globusHttpHelper.getHtmlfromUrl(new Uri(getURL_MoreFriendsAjax)); pgSource_Friends = res_getURL_MoreFriendsAjax; string[] arry_UserData = Regex.Split(pgSource_Friends, "user.php"); ParseFriendIDs(arry_UserData, finalList_Friends); tempCount_AjaxRequests++; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } while ((collection_token != "" && cursor != "") || tempCount_AjaxRequests < 15 || pgSource_Friends.Contains(patternAllFriendsLoaded)); finalList_Friends.ForEach(delegate(String friendID) { if (friendID.Contains("&")) { friendID = friendID.Remove(friendID.IndexOf("&")); } list_finalFriendsID.Add(friendID); }); list_finalFriendsID = list_finalFriendsID.Distinct().ToList(); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } return list_finalFriendsID; }
public void PostFinalMsgGroupMember(ref GlobusHttpHelper HttpHelper, Dictionary<string, string> SlectedContacts, string msg, string body, string UserName, string FromemailId, string FromEmailNam, int mindelay, int maxdelay) { try { string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string sourceAlias = string.Empty; string ReturnString = string.Empty; string PostMsgSubject = string.Empty; string PostMsgBody = string.Empty; try { string MessageText = string.Empty; string PostedMessage = string.Empty; int totalSelectedItems = SlectedContacts.Count; Log("[ " + DateTime.Now + " ] => [ Total Selected Members : " + totalSelectedItems + " ]"); IEnumerable<IEnumerable<KeyValuePair<string, string>>> partitioned = SlectedContacts.Partition(50); foreach (var item in partitioned) { string FString = string.Empty; string Nstring = string.Empty; string connId = string.Empty; string FullName = string.Empty; string ContactName = string.Empty; string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top")); if (pageSource.Contains("csrfToken")) { csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50); string[] Arr = csrfToken.Split('&'); csrfToken = Arr[0]; csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty); csrfToken = csrfToken.Trim(); } if (pageSource.Contains("sourceAlias")) { sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2]; } try { foreach (KeyValuePair<string, string> itemChecked in item) { try { string FName = string.Empty; string Lname = string.Empty; FullName = string.Empty; FName = itemChecked.Value.Split(' ')[0]; Lname = itemChecked.Value.Split(' ')[1]; FullName = FName + " " + Lname; try { ContactName = ContactName + " : " + FullName; if (ContactName.Contains("class=")) { try { ContactName = ContactName.Substring(0, ContactName.IndexOf("class=")).Trim(); } catch (Exception ex) { } } } catch { } Log("[ " + DateTime.Now + " ] => [ Adding Contact : " + FullName + " ]"); string ToCd = itemChecked.Key; List<string> AddAllString = new List<string>(); if (FString == string.Empty) { string CompString = "{" + "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}"; FString = CompString; } else { string CompString = "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}"; FString = CompString; } if (Nstring == string.Empty) { Nstring = FString; connId = ToCd; } else { Nstring += "," + FString; connId += " " + ToCd; } } catch { } } Nstring += "}"; try { string PostMessage; string ResponseStatusMsg; Log("[ " + DateTime.Now + " ] => [ Message Sending Process Running.. ]"); PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(body.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeints&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Uri.EscapeUriString(Nstring) +"&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&goback=.smg_*1_*1_*1_*1_*1_*1_*1_*1_*1"; ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/msgToConns"), PostMessage); if (ResponseStatusMsg.Contains("Your message was successfully sent.")) { Log("[ " + DateTime.Now + " ] => [ Subject Posted : " + msg + " ]"); Log("[ " + DateTime.Now + " ] => [ Body Text Posted : " + body.ToString() + " ]"); Log("[ " + DateTime.Now + " ] => [ Message Posted To Accounts : " + item.Count() + " ] "); ReturnString = "Your message was successfully."; #region CSV string bdy = string.Empty; try { bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " "); } catch { } if (string.IsNullOrEmpty(bdy)) { bdy = body.ToString().Replace(",", ":"); } string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName"; string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageSentGroupMember); #endregion //GlobusFileHelper.AppendStringToTextfileNewLine("Subject Posted : " + textMsg.Text.ToString(), Globals.path_MessageGroupMember); //GlobusFileHelper.AppendStringToTextfileNewLine("Body Text Posted : " + txtBody.Text.ToString(), Globals.path_MessageGroupMember); //GlobusFileHelper.AppendStringToTextfileNewLine("Message Posted To All Selected Accounts", Globals.path_MessageGroupMember); } else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request.") || ResponseStatusMsg.Contains("You are no longer authorized to message this")) { //Log("Error In Message Posting"); Log("[ " + DateTime.Now + " ] => [ There was an unexpected problem that prevented us from completing your request ]"); //string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName"; //string CSV_Content = UserName + "," + msg + "," + body.ToString() + "," + ContactName; //CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageSentGroupMember); GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember); } } catch (Exception ex) { //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember); } int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember); } } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember); } }
public List<string> ExtractFriendIDs_URLSpecific(ref GlobusHttpHelper HttpHelper, ref string userID, string specificURL, ref List<string> lstFriend_Suggestions) { try { string pgSrc_HomePage = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/")); string ProFileURL = string.Empty; string UserId = string.Empty; #region Get User or Account ID if (pgSrc_HomePage.Contains("http://www.facebook.com/profile.php?id=")) { ///Modified Sumit [10-12-2011] #region int startIndx = pgSrc_HomePage.IndexOf("http://www.facebook.com/profile.php?id="); int endIndx = pgSrc_HomePage.IndexOf("\"", startIndx + 1); ProFileURL = pgSrc_HomePage.Substring(startIndx, endIndx - startIndx); if (ProFileURL.Contains("&")) { string[] Arr = ProFileURL.Split('&'); ProFileURL = Arr[0]; } #endregion } if (ProFileURL.Contains("http://www.facebook.com/profile.php?id=")) { UserId = ProFileURL.Replace("http://www.facebook.com/profile.php?id=", ""); if (UserId.Contains("&")) { UserId = UserId.Remove(UserId.IndexOf("&")); } //userID = UserId; } #endregion List<string> lstFriend_Requests = new List<string>(); //List<string> lstFriend_Suggestions = new List<string>(); string pgSrc_FriendsPage = HttpHelper.getHtmlfromUrl(new Uri(specificURL)); ChilkatHttpHelpr chilkatHelpr = new ChilkatHttpHelpr(); //List<string> aTags = chilkatHelpr.GetDataTag(pgSrc_FriendsPage, "a"); //List<string> spanTags = chilkatHelpr.GetDataTag(pgSrc_FriendsPage, "span"); List<string> requestProfileURLs_FR_Requests = chilkatHelpr.GetHrefsByTagAndAttributeName(pgSrc_FriendsPage, "span", "title fsl fwb fcb"); lstFriend_Requests.AddRange(requestProfileURLs_FR_Requests); List<string> requestProfileURLs_FR_Suggestions = chilkatHelpr.GetElementsbyTagAndAttributeName(pgSrc_FriendsPage, "div", "title fsl fwb fcb", "id"); lstFriend_Suggestions.AddRange(requestProfileURLs_FR_Suggestions); #region Old Code //if (pgSrc_FriendsPage.Contains("http://www.facebook.com/profile.php?id=")) //{ // string[] arr = Regex.Split(pgSrc_FriendsPage, "href"); // foreach (string strhref in arr) // { // if (!strhref.Contains("<!DOCTYPE")) // { // if (strhref.Contains("profile.php?id")) // { // int startIndx = strhref.IndexOf("profile.php?id") + "profile.php?id".Length + 1; // int endIndx = strhref.IndexOf("\"", startIndx); // string profileID = strhref.Substring(startIndx, endIndx - startIndx); // if (profileID.Contains("&")) // { // profileID = profileID.Remove(profileID.IndexOf("&")); // } // if (profileID.Contains("\\")) // { // profileID = profileID.Replace("\\", ""); // } // lstFriend.Add(profileID); // } // } // } //} #endregion List<string> itemId = lstFriend_Requests.Distinct().ToList(); return itemId; } catch (Exception) { return null; } }
public void GetGroupMember(ref GlobusHttpHelper httpHelper) { try { foreach (string item in LstGroupURL) { try { if (!isPathCreated) { //File Path At Runtime isPathCreated = true; Globals.path_ScrappedMembersFromGroup = DateTime.Now.ToString("MM_dd_yyyy hh_mm_ss"); } Log("[ " + DateTime.Now + " ] => [ Start Finding Group Member With The URL >>> " + item + " With Username >>> " + _UserName + " ]"); string groupId = string.Empty; string groupIdPart = item.Substring(item.IndexOf("/groups"), item.Length - item.IndexOf("/groups")).Trim(); int startindex = groupIdPart.IndexOf("&gid="); if (startindex < 0) { startindex = groupIdPart.IndexOf("gid="); } string start = groupIdPart.Substring(startindex).Replace("&gid=", string.Empty).Replace("gid=", string.Empty); int endindex = start.IndexOf("&"); if (endindex < 0) { start = start + "&"; endindex = start.IndexOf("&"); } string end = start.Substring(0, endindex); groupId = end.Trim(); //if (item.Contains("gid") && item.Contains("/groups")) //{ // string groupIdPart = item.Substring(item.IndexOf("/groups"), item.Length - item.IndexOf("/groups")).Trim(); // string[] numArr = Regex.Split(groupIdPart, "^[0-9]*$"); // foreach (string item1 in numArr) // { // try // { // if (!string.IsNullOrEmpty(item1)) // { // groupId = item1.Trim(); // break; // } // } // catch (Exception ex) // { // } // } //} //if (item.Contains("/groups")) //{ // string groupIdPart = item.Substring(item.IndexOf("/groups"), item.Length - item.IndexOf("/groups")).Trim(); // string[] numArr = Regex.Split(groupIdPart, "[^0-9]"); // foreach (string item1 in numArr) // { // try // { // if (!string.IsNullOrEmpty(item1)) // { // groupId = item1.Trim(); // break; // } // } // catch (Exception ex) // { // } // } //} Log("[ " + DateTime.Now + " ] => [ Please Wait........Process is Running ]"); GroupStatus dataScrape = new GroupStatus(); List<string> lstGrpMemberProfileURLs = dataScrape.GetAllGrpMember(ref httpHelper, groupId); //Dictionary<string,string> dicGrpMem=dataScrape.AddSpecificGroupUser(ref httpHelper, groupId, 25); //GetGroupMemberInfo(ref httpHelper, lstGrpMemberProfileURLs); } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } } Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED of Finding Member With Username >>> " + _UserName + " ]"); Log("-----------------------------------------------------------------------------------------------------------------------------------"); } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } }
public string ExtractIDUsingGraphAPI(string URL, ref GlobusHttpHelper HttpHelper) { string profileID = string.Empty; try { if (URL.Contains("id=")) { profileID = URL.Replace(URL.Remove(URL.IndexOf("id=") + "id=".Length), ""); return profileID; } int startIndx = URL.LastIndexOf("/"); string name = URL.Substring(startIndx).Replace("/", ""); string response = HttpHelper.getHtmlfromUrl(new Uri("https://graph.facebook.com/" + name)); profileID = ParseJsonGraphAPI(response, "id"); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } return profileID; }
public bool CrawlingLinkedInPage(string Url, ref GlobusHttpHelper HttpHelper) { //new Thread(() => // { Log("[ " + DateTime.Now + " ] => [ Parsing For URL : " + Url + " ]"); // Workbooks myExcelWorkbooks = ClsExcelData.myExcelWorkbooks; #region Data Initialization string GroupMemId = string.Empty; string Industry = string.Empty; string URLprofile = string.Empty; string firstname = string.Empty; string lastname = string.Empty; string location = string.Empty; string country = string.Empty; string postal = string.Empty; string phone = string.Empty; string USERemail = string.Empty; string code = string.Empty; string education1 = string.Empty; string education2 = string.Empty; string titlecurrent = string.Empty; string companycurrent = string.Empty; string titlepast1 = string.Empty; string companypast1 = string.Empty; string titlepast2 = string.Empty; string html = string.Empty; string companypast2 = string.Empty; string titlepast3 = string.Empty; string companypast3 = string.Empty; string titlepast4 = string.Empty; string companypast4 = string.Empty; string Recommendations = string.Empty; string Connection = string.Empty; string Designation = string.Empty; string Website = string.Empty; string Contactsettings = string.Empty; string recomandation = string.Empty; string memhead = string.Empty; string titleCurrenttitle = string.Empty; string titleCurrenttitle2 = string.Empty; string titleCurrenttitle3 = string.Empty; string titleCurrenttitle4 = string.Empty; string Skill = string.Empty; string TypeOfProfile = "Public"; List<string> EducationList = new List<string>(); string Finaldata = string.Empty; string EducationCollection = string.Empty; List<string> checkerlst = new List<string>(); List<string> checkgrplist = new List<string>(); string groupscollectin = string.Empty; string strFamilyName = string.Empty; string LDS_LoginID = string.Empty; string LDS_Websites = string.Empty; string LDS_UserProfileLink = string.Empty; string LDS_CurrentTitle = string.Empty; string LDS_Experience = string.Empty; string LDS_UserContact = string.Empty; string LDS_PastTitles = string.Empty; string LDS_HeadLineTitle = string.Empty; string Company = string.Empty; string degreeConnection = string.Empty; string website1 = string.Empty; string LDS_CurrentCompany = string.Empty; List<string> lstpasttitle = new List<string>(); List<string> checkpasttitle = new List<string>(); List<string> titleList = new List<string>(); List<string> companyList = new List<string>(); #endregion string stringSource = HttpHelper.getHtmlfromUrl1(new Uri(Url)); if (stringSource.Contains("Sign in to LinkedIn")) { Log("[ " + DateTime.Now + " ] => [ Sign in to LinkedIn ]"); } #region GroupMemId try { string[] gid = Url.Split('&'); GroupMemId = gid[0].Replace("http://www.linkedin.com/profile/view?id=", string.Empty); } catch { } #endregion #region Name try { try { //strFamilyName = stringSource.Substring(stringSource.IndexOf("fmt__profileUserFullName\":\""), (stringSource.IndexOf("i18n__expand_your_network_to_see_more", stringSource.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\"")) - stringSource.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\""))).Replace("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\"", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("}", string.Empty).Replace("]", string.Empty).Trim(); int startindex = stringSource.IndexOf("fmt__profileUserFullName\":\""); string start = stringSource.Substring(startindex).Replace("fmt__profileUserFullName\":\"", ""); int endindex = start.IndexOf("\",\""); string end = start.Substring(0, endindex).Replace("\\u002d", "-"); strFamilyName = end; if (string.IsNullOrEmpty(strFamilyName)) { strFamilyName = stringSource.Substring(stringSource.IndexOf("fmt__full_name\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__full_name\":")) - stringSource.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("}", string.Empty).Replace("]", string.Empty).Trim(); } } catch { try { strFamilyName = stringSource.Substring(stringSource.IndexOf("fmt__full_name\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__full_name\":")) - stringSource.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("}", string.Empty).Replace("]", string.Empty).Trim(); } catch { } } } catch { } if (strFamilyName == string.Empty) { try { int startindex = stringSource.IndexOf("<title>"); string start = stringSource.Substring(startindex).Replace("<title>", string.Empty); int endindex = start.IndexOf("</title>"); string end = start.Substring(0, endindex).Replace("\\u002d", "-").Replace("| LinkedIn", string.Empty).Trim(); strFamilyName = end; } catch { } } #endregion #region Namesplitation string[] NameArr = new string[5]; if (strFamilyName.Contains(" ")) { try { NameArr = Regex.Split(strFamilyName, " "); } catch { } } #endregion #region FirstName try { firstname = NameArr[0]; } catch { } #endregion #region LastName try { lastname = NameArr[1]; } catch { } try { if (NameArr.Count() == 3) { lastname = NameArr[1] + " " + NameArr[2]; } else if (NameArr.Count() == 4) { lastname = NameArr[1] + " " + NameArr[2] + " " + NameArr[3]; } else if (NameArr.Count() == 5) { lastname = NameArr[1] + " " + NameArr[2] + " " + NameArr[3] + " " + NameArr[4]; } if (lastname.Contains("}]")) { #region Name try { try { strFamilyName = stringSource.Substring(stringSource.IndexOf("<span class=\"n fn\">")).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim(); } catch { try { strFamilyName = stringSource.Substring(stringSource.IndexOf("fmt__full_name\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__full_name\":")) - stringSource.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim(); } catch { } } } catch { } #endregion } } catch { } #endregion #region titlecurrent //try //{ try { try { //Company = stringSource.Substring(stringSource.IndexOf("visible\":true,\"memberHeadline"), (stringSource.IndexOf("memberID", stringSource.IndexOf("visible\":true,\"memberHeadline")) - stringSource.IndexOf("visible\":true,\"memberHeadline"))).Replace("visible\":true,\"memberHeadline", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace(" ", string.Empty).Trim(); // int startindex = stringSource.IndexOf("memberHeadline"); // string start = stringSource.Substring(startindex).Replace("memberHeadline", ""); // int endindex = start.IndexOf("\",\""); // string end = start.Substring(0, endindex).Replace("\"", "").Replace(":", ""); // titlecurrent = end.Replace("\\u002d", "-"); int startindex = stringSource.IndexOf("\"title_highlight\":\""); string start = stringSource.Substring(startindex).Replace("\"title_highlight\":\"", ""); int endindex = start.IndexOf("\",\""); string end = start.Substring(0, endindex).Replace("\u002d", string.Empty).Replace("Å", "A").Replace("\\u002d", "-").Replace("\"\n", "").Replace("\n", "").Replace(";", ",").Replace("&", ""); titlecurrent = end; } catch { } // if (string.IsNullOrEmpty(Company)) if (string.IsNullOrEmpty(titlecurrent)) { try { //memberHeadline // titlecurrent = stringSource.Substring(stringSource.IndexOf("memberHeadline\":"), (stringSource.IndexOf(",", stringSource.IndexOf("memberHeadline\":")) - stringSource.IndexOf("memberHeadline\":"))).Replace("memberHeadline\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace(" ", string.Empty).Replace(":", "").Replace("&dsh;", "").Replace("&", "").Replace(";", "").Replace("u002d",string.Empty).Trim(); int startindex = stringSource.IndexOf("memberHeadline"); string start = stringSource.Substring(startindex).Replace("memberHeadline", ""); int endindex = start.IndexOf("\",\""); string end = start.Substring(0, endindex).Replace("\"", "").Replace(":", ""); memhead = end.Replace("\\u002d", "-"); } catch { } } if (string.IsNullOrEmpty(titlecurrent)) { string[] cmpny = Regex.Split(stringSource, "trk=prof-exp-title' name='title' title='Find others with this title'>"); foreach (string item in cmpny) { try { try { if (!item.Contains("<!DOCTYPE html>")) { int startindex = item.IndexOf(""); string start = item.Substring(startindex); int endindex = start.IndexOf("</a>"); string end = start.Substring(0, endindex).Replace("</a>", String.Empty); string titles = end.Trim(); titleList.Add(titles); titleList = titleList.Distinct().ToList(); } } catch { } } catch { } } } if (titleList.Count > 0) { titlecurrent = titleList[0]; } string[] strdesigandcompany1 = new string[4]; if (memhead.Contains(" at ") || memhead.Contains(" of ")) { // titlecurrent = string.Empty; companycurrent = string.Empty; try { strdesigandcompany1 = Regex.Split(memhead, " at "); if (strdesigandcompany1.Count() == 1) { strdesigandcompany1 = Regex.Split(memhead, " of "); } } catch { } try { titlecurrent = strdesigandcompany1[0]; } catch { } } string[] strdesigandcompany = new string[4]; if (Company.Contains(" at ") || Company.Contains(" of ")) { titlecurrent = string.Empty; companycurrent = string.Empty; try { strdesigandcompany = Regex.Split(Company, " at "); if (strdesigandcompany.Count() == 1) { strdesigandcompany = Regex.Split(Company, " of "); } } catch { } #region Title try { titlecurrent = strdesigandcompany[0]; } catch { } #endregion #region Current Company try { companycurrent = strdesigandcompany[1]; } catch { } #endregion } } catch { } //} //catch{} #region PastCompany string[] companylist = Regex.Split(stringSource, "companyName\""); string AllComapny = string.Empty; string Companyname = string.Empty; foreach (string item in companylist) { try { if (!item.Contains("<!DOCTYPE html>")) { Companyname = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("}", string.Empty).Replace("]", string.Empty).Trim(); //Checklist.Add(item); string items = item; checkerlst.Add(Companyname); checkerlst = checkerlst.Distinct().ToList(); } } catch { } } // string AllComapny = string.Empty; if (checkerlst.Count > 0) { foreach (string item1 in checkerlst) { try { if (string.IsNullOrEmpty(AllComapny)) { AllComapny = item1.Replace("}", "").Replace("]", "").Replace("&", "&"); } else { AllComapny = AllComapny + " : " + item1.Replace("}", "").Replace("]", "").Replace("&", "&"); } } catch { } } } if (string.IsNullOrEmpty(AllComapny)) { string[] allCompany = Regex.Split(stringSource, "trk=prof-exp-company-name\" name=\"company\" title=\"Find others who have worked at this company\">"); foreach (string item in allCompany) { if (!item.Contains("<!DOCTYPE html>")) { try { int startindex = item.IndexOf(""); string start = item.Substring(startindex); int endindex = start.IndexOf("</a>"); string end = start.Substring(0, endindex).Replace("</a>", string.Empty); string companies = end.Trim(); companyList.Add(companies); companyList = companyList.Distinct().ToList(); } catch { } } } string[] allcompany1 = Regex.Split(stringSource, "trk=prof-exp-company-name\">"); foreach (string item in allcompany1) { if (!item.Contains("<!DOCTYPE html>") && !item.Contains("<span data-tracking=\"mcp_profile_sum\"")) { try { int startindex = item.IndexOf(""); string start = item.Substring(startindex); int endindex = start.IndexOf("</a>"); string end = start.Substring(0, endindex).Replace("</a>", string.Empty); string companies = end.Replace("&", "&").Trim(); companyList.Add(companies); companyList = companyList.Distinct().ToList(); } catch { } } } if (companyList.Count > 0) { foreach (string item1 in companyList) { try { if (string.IsNullOrEmpty(AllComapny)) { AllComapny = item1.Replace("}", "").Replace("]", "").Replace("&", "&"); } else { AllComapny = AllComapny + " : " + item1.Replace("}", "").Replace("]", "").Replace("&", "&"); } } catch { } } } } if (companyList.Count > 0) { companycurrent = companyList[0]; } // if (companycurrent == string.Empty) // { // try // { // companycurrent = checkerlst[0].ToString(); // } // catch { } // } #endregion #endregion Company #region Company try { try { try { Company = stringSource.Substring(stringSource.IndexOf("visible\":true,\"memberHeadline"), (stringSource.IndexOf("memberID", stringSource.IndexOf("visible\":true,\"memberHeadline")) - stringSource.IndexOf("visible\":true,\"memberHeadline"))).Replace("visible\":true,\"memberHeadline", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace(" ", string.Empty).Trim(); } catch { } if (string.IsNullOrEmpty(Company)) { try { //memberHeadline Company = stringSource.Substring(stringSource.IndexOf("memberHeadline\":"), (stringSource.IndexOf(",", stringSource.IndexOf("memberHeadline\":")) - stringSource.IndexOf("memberHeadline\":"))).Replace("memberHeadline\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace(" ", string.Empty).Replace(":", "").Replace("&dsh;", "").Replace("&", "").Replace(";", "").Trim(); } catch { } } string[] strdesigandcompany = new string[4]; if (Company.Contains(" at ")) { try { strdesigandcompany = Regex.Split(Company, " at "); } catch { } #region Title try { LDS_HeadLineTitle = strdesigandcompany[0]; titlecurrent = strdesigandcompany[0]; } catch { } #endregion #region Current Company try { companycurrent = strdesigandcompany[1]; } catch { } #endregion } } catch { } #region PastCompany string[] grpcompanylist = Regex.Split(stringSource, "companyName\""); string grpAllComapny = string.Empty; string grpCompanyname = string.Empty; foreach (string item in grpcompanylist) { try { if (!item.Contains("<!DOCTYPE html>")) { grpCompanyname = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); //Checklist.Add(item); string items = item; checkerlst.Add(grpCompanyname); checkerlst = checkerlst.Distinct().ToList(); } } catch { } } grpAllComapny = string.Empty; foreach (string item1 in checkerlst) { if (string.IsNullOrEmpty(grpAllComapny)) { grpAllComapny = item1.Replace("}", "").Replace("]", "").Replace("&", "&"); } else { grpAllComapny = grpAllComapny + " : " + item1.Replace("}", "").Replace("]", "").Replace("&", "&"); } } #endregion #endregion Company #region Education try { // string[] str_UniversityName = Regex.Split(stringSource, "link__school_name"); string[] str_UniversityName = Regex.Split(stringSource, "link__school_name_public"); foreach (string item in str_UniversityName) { try { string School = string.Empty; string Degree = string.Empty; string SessionEnd = string.Empty; string SessionStart = string.Empty; string Education = string.Empty; if (!item.Contains("<!DOCTYPE html>")) { try { try { int startindex = item.IndexOf("\"schoolName\":"); string start = item.Substring(startindex).Replace("\"schoolName\":", string.Empty); int endindex = start.IndexOf(","); School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\t", string.Empty); } catch { } try { int startindex1 = item.IndexOf("degree"); string start1 = item.Substring(startindex1).Replace("degree", ""); int endindex1 = start1.IndexOf(","); Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty); } catch { } try { int startindex2 = item.IndexOf("enddate_my"); string start2 = item.Substring(startindex2).Replace("enddate_my", ""); int endindex2 = start2.IndexOf(","); SessionEnd = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty); } catch { } try { int startindex3 = item.IndexOf("startdate_my"); string start3 = item.Substring(startindex3).Replace("startdate_my", ""); int endindex3 = start3.IndexOf(","); SessionStart = start3.Substring(0, endindex3).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty); } catch { } //if (Degree == string.Empty) //{ // try // { // if (!item.Contains("\"degree\":\"")) // { // int startindex4 = item.IndexOf("name\":"); // string start4 = item.Substring(startindex4).Replace("name\":", ""); // int endindex4 = start4.IndexOf(","); // Degree = start4.Substring(0, endindex4).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty); // } // } // catch { } //} if (SessionStart == string.Empty && SessionEnd == string.Empty) { Education = " [" + School + "] Degree: " + Degree; } else { Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd; } //University = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\u002d", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); } catch { } EducationList.Add(Education); } } catch { } } EducationList = EducationList.Distinct().ToList(); if (EducationList.Count == 0) { //string[] uniName = Regex.Split(stringSource, "trk=prof-edu-school-name' title=\"More details for this school\">"); //foreach (string item in uniName) //{ // try // { // string School = string.Empty; // string Degree = string.Empty; // string SessionEnd = string.Empty; // string SessionStart = string.Empty; // string Education = string.Empty; // if (!item.Contains("<!DOCTYPE html>")) // { // try // { // try // { // int startindex = item.IndexOf(""); // string start = item.Substring(startindex); // int endindex = start.IndexOf("</a>"); // School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\t", string.Empty).Trim(); // } // catch // { } // try // { // int startindex1 = item.IndexOf("degree"); // string start1 = item.Substring(startindex1).Replace("degree", ""); // int endindex1 = start1.IndexOf(","); // Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty).Replace(">",string.Empty); // } // catch { } // try // { // int startindex2 = item.IndexOf("<time datetime="); // string start2 = item.Substring(startindex2).Replace("<time datetime=", string.Empty); // int endindex2 = start2.IndexOf(">"); // SessionStart = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("'",string.Empty); // } // catch { } // try // { // int startindex2 = item.IndexOf("</time><time datetime="); // string start2 = item.Substring(startindex2).Replace("</time><time datetime=", string.Empty); // int endindex2 = start2.IndexOf(">"); // SessionEnd = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace(">",string.Empty).Replace("'",string.Empty); // } // catch { } // if (SessionStart == string.Empty && SessionEnd == string.Empty) // { // Education = " [" + School + "] Degree: " + Degree; // } // else // { // Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd; // } // } // catch // { } // EducationList.Add(Education); // } // } // catch { } //} string[] uniName1 = Regex.Split(stringSource, "trk=prof-edu-school-name' title="); foreach (string item in uniName1) { try { string School = string.Empty; string Degree = string.Empty; string SessionEnd = string.Empty; string SessionStart = string.Empty; string Education = string.Empty; if (!item.Contains("<!DOCTYPE html>")) { try { try { int startindex = item.IndexOf(">"); string start = item.Substring(startindex); int endindex = start.IndexOf("</a>"); School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\t", string.Empty).Replace(">", string.Empty).Trim(); } catch { } try { int startindex1 = item.IndexOf("degree"); string start1 = item.Substring(startindex1).Replace("degree", ""); int endindex1 = start1.IndexOf(","); Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty).Replace(">", string.Empty); if (Degree.Contains("connection") || Degree.Contains("title") || Degree.Contains("firstName") || Degree.Contains("authToken")) { Degree = string.Empty; } } catch { } try { int startindex2 = item.IndexOf("<time datetime="); string start2 = item.Substring(startindex2).Replace("<time datetime=", string.Empty); int endindex2 = start2.IndexOf(">"); SessionStart = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("'", string.Empty); } catch { } if (string.IsNullOrEmpty(SessionStart)) { try { int startindex3 = item.IndexOf("<span class=\"education-date\"><time>"); string start3 = item.Substring(startindex3).Replace("<span class=\"education-date\"><time>", string.Empty); int endindex3 = start3.IndexOf("</time>"); SessionStart = start3.Substring(0, endindex3).Replace("</time>", string.Empty).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty); } catch { } } try { int startindex2 = item.IndexOf("<time> –"); string start2 = item.Substring(startindex2).Replace("<time> –", string.Empty); int endindex2 = start2.IndexOf("</time>"); SessionEnd = start2.Substring(0, endindex2).Replace("</time>", string.Empty).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty); } catch { } if (string.IsNullOrEmpty(SessionStart)) { try { int startindex3 = item.IndexOf("<span class=\"education-date\"><time>"); string start3 = item.Substring(startindex3).Replace("<span class=\"education-date\"><time>", string.Empty); int endindex3 = start3.IndexOf("</time>"); SessionEnd = start3.Substring(0, endindex3).Replace("</time>", string.Empty).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty); } catch { } } if (SessionStart == string.Empty && SessionEnd == string.Empty) { Education = " [" + School + "] Degree: " + Degree; } else { if (Degree == string.Empty) { Education = " [" + School + "] Session: " + SessionStart + "-" + SessionEnd; } else { Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd; } } } catch { } EducationList.Add(Education); } } catch { } } } EducationList = EducationList.Distinct().ToList(); if (EducationList.Count > 0) { foreach (string item in EducationList) { if (string.IsNullOrEmpty(EducationCollection)) { // EducationCollection = item.Replace("}", "").Replace("]", "").Replace("&", "&"); EducationCollection = item.Replace("}", "").Replace("&", "&"); } else { // EducationCollection = EducationCollection + " - " + item.Replace("}", "").Replace("]", "").Replace("&", "&"); EducationCollection = EducationCollection + " - " + item.Replace("}", "").Replace("&", "&"); } } } // string University1 = stringSource.Substring(stringSource.IndexOf("schoolName\":"), (stringSource.IndexOf(",", stringSource.IndexOf("schoolName\":")) - stringSource.IndexOf("schoolName\":"))).Replace("schoolName\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); } catch { } #endregion Education #region Email try { string[] str_Email = Regex.Split(stringSource, "email\""); USERemail = stringSource.Substring(stringSource.IndexOf("[{\"email\":"), (stringSource.IndexOf("}]", stringSource.IndexOf("[{\"email\":")) - stringSource.IndexOf("[{\"email\":"))).Replace("[{\"email\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("}]", string.Empty).Trim(); } catch (Exception ex) { } if (string.IsNullOrEmpty(USERemail)) { try { int startindex = stringSource.IndexOf("Email:"); string start = stringSource.Substring(startindex).Replace("Email:", ""); int endindex = start.IndexOf("Phone"); string end = start.Substring(0, endindex).Replace("\u003cbr", "").Replace("\\u003cbr\\u003e", "").Replace("\\n", "").Replace(" ", ""); USERemail = end; } catch { } } #endregion Email #region Contact try { int startindex = stringSource.IndexOf("Phone:"); string start = stringSource.Substring(startindex).Replace("Phone:", ""); int endindex = start.IndexOf("Skype"); string end = start.Substring(0, endindex).Replace("\\u003cbr\\u003e", "").Replace("\\u002d", "").Replace("\\n", ""); LDS_UserContact = end; } catch { } if (string.IsNullOrEmpty(LDS_UserContact)) { try { int startindex = stringSource.IndexOf("[{\"number\":\""); string start = stringSource.Substring(startindex).Replace("[{\"number\":\"", ""); int endindex = start.IndexOf("\"}]"); string end = start.Substring(0, endindex).Replace("\\u003cbr\\u003e", "").Replace("\\u002d", "").Replace("\\n", ""); LDS_UserContact = end; } catch { } } #endregion #region Website string Web1 = string.Empty; List<string> Websites = new List<string>(); try { int startindex = stringSource.IndexOf("\"websites\":"); string start = stringSource.Substring(startindex).Replace("\"websites\":", ""); int endindex = start.IndexOf("\"showTencent\":"); string end = start.Substring(0, endindex).Replace("[{\"", string.Empty).Replace("{", string.Empty).Trim(); Web1 = end; } catch { } string[] web = Regex.Split(Web1, "\"URL\":\""); foreach (var items in web) { try { int startindex = items.IndexOf(""); string start = items.Substring(startindex).Replace("\"", ""); int endindex = start.IndexOf("}"); string end = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace("URL:", string.Empty); Website = end; } catch { } try { if (Website.Contains("]") || Website.Contains("}") || Website.Contains("[") || Website.Contains("}")) { Website = Website.Replace("]", string.Empty).Replace("}", string.Empty).Replace("\\u002d", string.Empty).Replace("[", string.Empty).Replace("{", string.Empty).Trim(); } } catch { } Websites.Add(Website); } string item2 = string.Empty; website1 = Websites[0]; //foreach (var item in Websites) int size = Websites.Count; for (int i = 1; i <= size; i++) { try { website1 += " - " + Websites[i]; } catch { } } #endregion Website #region location try { //location = stringSource.Substring(stringSource.IndexOf("Country\",\"fmt__location\":"), (stringSource.IndexOf("i18n_no_location_matches", stringSource.IndexOf("Country\",\"fmt__location\":")) - stringSource.IndexOf("Country\",\"fmt__location\":"))).Replace("Country\",\"fmt__location\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); int startindex = stringSource.IndexOf("fmt_location"); string start = stringSource.Substring(startindex).Replace("fmt_location\":\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex).Replace("\u002d", string.Empty).Replace("Å", "A").Replace("\\u002d", "-"); location = end; } catch (Exception ex) { } if (location == string.Empty) { try { int startindex = stringSource.IndexOf("name='location' title=\"Find other members"); string start = stringSource.Substring(startindex).Replace("name='location' title=\"Find other members", string.Empty); int startindex1 = start.IndexOf("\">"); string start1 = start.Substring(startindex1); int endindex = start1.IndexOf("</a>"); string end = start1.Substring(0, endindex).Replace("\u002d", string.Empty).Replace("Å", "A").Replace("\\u002d", "-").Replace(">", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Trim(); location = end; } catch { } } #endregion location #region Country try { int startindex = stringSource.IndexOf("\"geo_region\":"); if (startindex > 0) { string start = stringSource.Substring(startindex).Replace("\"geo_region\":", ""); int endindex = start.IndexOf("\"i18n_geo_region\":\"Location\""); string end = start.Substring(0, endindex); country = end; string[] array = Regex.Split(end, "\"name\":\""); array = array.Skip(1).ToArray(); foreach (string item in array) { try { int startindex1 = item.IndexOf("\",\""); string strat1 = item.Substring(0, startindex1); country = strat1; break; } catch (Exception ex) { } } } } catch (Exception ex) { } if (country == string.Empty) { try { string[] countLocation = location.Split(','); if (countLocation.Count() == 2) { country = location.Split(',')[1]; } else if (countLocation.Count() == 3) { country = location.Split(',')[2]; } } catch { } } #endregion #region Industry try { //Industry = stringSource.Substring(stringSource.IndexOf("fmt__industry_highlight\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__industry_highlight\":")) - stringSource.IndexOf("fmt__industry_highlight\":"))).Replace("fmt__industry_highlight\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); int startindex = stringSource.IndexOf("\"industry_highlight\":\""); if (startindex > 0) { string start = stringSource.Substring(startindex).Replace("\"industry_highlight\":\"", ""); int endindex = start.IndexOf("\","); string end = start.Substring(0, endindex).Replace("&", "&"); Industry = end; } } catch (Exception ex) { } if (string.IsNullOrEmpty(Industry)) { try { int startindex = stringSource.IndexOf("name=\"industry\" title=\"Find other members in this industry\">"); string start = stringSource.Substring(startindex).Replace("name=\"industry\" title=\"Find other members in this industry\">", string.Empty); int endindex = start.IndexOf("</a>"); string end = start.Substring(0, endindex).Replace("</a>", string.Empty).Replace("&", "&"); Industry = end; } catch { } } #endregion Industry #region Connection try { //Connection = stringSource.Substring(stringSource.IndexOf("_count_string\":"), (stringSource.IndexOf(",", stringSource.IndexOf("_count_string\":")) - stringSource.IndexOf("_count_string\":"))).Replace("_count_string\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); int startindex = stringSource.IndexOf("\"numberOfConnections\":"); if (startindex > 0) { string start = stringSource.Substring(startindex).Replace("\"numberOfConnections\":", ""); int endindex = start.IndexOf("},\""); string end = start.Substring(0, endindex).Replace("&", "&").Replace("\"", "").Replace("connectionsBrowseable:true", "").Replace(",", ""); Connection = end; } if (startindex < 0) { int startindex1 = stringSource.IndexOf("overview-connections"); if (startindex1 > 0) { string start = stringSource.Substring(startindex1).Replace("overview-connections", "").Replace("\n", string.Empty).Replace("<p>", string.Empty).Replace("</p>", string.Empty); int endindex = start.IndexOf("</strong>"); string end = start.Substring(0, endindex).Replace("&", "&").Replace("\"", string.Empty).Replace("<strong>", string.Empty).Replace(">", string.Empty).Trim(); Connection = end; } } if (string.IsNullOrEmpty(Connection)) { try { int startindex1 = stringSource.IndexOf("class=\"member-connections\"><strong>"); string start = stringSource.Substring(startindex1).Replace("class=\"member-connections\"><strong>", "").Replace("\n", string.Empty).Replace("<p>", string.Empty).Replace("</p>", string.Empty); int endindex = start.IndexOf("</strong>"); string end = start.Substring(0, endindex).Replace("&", "&").Replace("\"", string.Empty).Replace("<strong>", string.Empty).Replace("<a href=#connections class=connections-link>", string.Empty).Replace("más de", string.Empty).Replace("</a>", string.Empty).Replace(">",string.Empty).Trim(); Connection = end; } catch { } } } catch (Exception ex) { } #endregion Connection #region Recommendation try { string RecomnedUrl = string.Empty; try { int startindex = stringSource.IndexOf("endorsements?id="); string start = stringSource.Substring(startindex); int endIndex = start.IndexOf("\"mem_pic\":"); RecomnedUrl = (start.Substring(0, endIndex).Replace(",", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty)); } catch { } string PageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/profile-v2-" + RecomnedUrl + "")); string[] arrayRecommendedName = Regex.Split(PageSource, "headline"); if (arrayRecommendedName.Count() == 1) { arrayRecommendedName = Regex.Split(PageSource, "fmt__recommendeeFullName"); } List<string> ListRecommendationName = new List<string>(); foreach (var itemRecomName in arrayRecommendedName) { try { if (!itemRecomName.Contains("Endorsements")) { string Heading = string.Empty; string Name = string.Empty; try { int startindex = itemRecomName.IndexOf(":"); string start = itemRecomName.Substring(startindex); int endIndex = start.IndexOf("\","); Heading = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty)); } catch { } try { int startindex1 = itemRecomName.IndexOf("fmt__referrerfullName"); string start1 = itemRecomName.Substring(startindex1); int endIndex1 = start1.IndexOf("\","); Name = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace("fmt__referrerfullName", string.Empty).Replace(":", string.Empty)); } catch { } if (Name == string.Empty) { int startindex1 = itemRecomName.IndexOf("recommenderTitle\":"); string start1 = itemRecomName.Substring(startindex1); int endIndex1 = start1.IndexOf("\","); Name = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace("recommenderTitle", string.Empty).Replace(":", string.Empty).Replace(",", string.Empty)); } ListRecommendationName.Add(Name + " : " + Heading); } } catch { } } foreach (var item in ListRecommendationName) { if (recomandation == string.Empty) { recomandation = item; } else { recomandation += " - " + item; } } } catch { } if (string.IsNullOrEmpty(Recommendations)) { List<string> ListRecommendationName = new List<string>(); string[] recommend = Regex.Split(stringSource, "trk=prof-exp-snippet-endorsement-name'>"); foreach (string item in recommend) { if (!item.Contains("<!DOCTYPE html>")) try { int startindex = item.IndexOf(""); string start = item.Substring(startindex); int endindex = start.IndexOf("</a>"); string end = start.Substring(0, endindex).Replace("</a>", string.Empty); string recmnd = end.Trim(); ListRecommendationName.Add(recmnd); } catch { } } foreach (string item in ListRecommendationName) { if (recomandation == string.Empty) { recomandation = item; } else { recomandation += " - " + item; } } } #endregion #region Group try { #region commented by Prabhat 17/05/13 1:27 PM //string groupdata = string.Empty; //int startindex = stringSource.IndexOf("\"groupsMpr\":"); //if (startindex > 0) //{ // string start = stringSource.Substring(startindex); // int endindex = start.IndexOf("},\""); // string end = start.Substring(0, endindex); // groupdata = end; //} //string[] CheckList = Regex.Split(groupdata, "\"name\""); //CheckList = CheckList.Skip(1).ToArray(); //foreach (string item in CheckList) //{ // try // { // int endindexdata = item.IndexOf("\","); // string enddata = item.Substring(0, endindexdata).Replace("\"","").Replace(":",""); // if(string.IsNullOrEmpty(groupscollectin)) // { // groupscollectin = enddata; // } // else // { // groupscollectin = groupscollectin + ":" + enddata; // } // } // catch(Exception ex) // { // } //} #endregion string PageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/mappers?x-a=profile_v2_groups%2Cprofile_v2_follow%2Cprofile_v2_connections&x-p=profile_v2_discovery%2Erecords%3A4%2Ctop_card%2EprofileContactsIntegrationStatus%3A0%2Cprofile_v2_comparison_insight%2Edistance%3A1%2Cprofile_v2_right_fixed_discovery%2Eoffset%3A0%2Cprofile_v2_connections%2Edistance%3A1%2Cprofile_v2_right_fixed_discovery%2Erecords%3A4%2Cprofile_v2_network_overview_insight%2Edistance%3A1%2Cprofile_v2_right_top_discovery_teamlinkv2%2Eoffset%3A0%2Cprofile_v2_right_top_discovery_teamlinkv2%2Erecords%3A4%2Cprofile_v2_discovery%2Eoffset%3A0%2Cprofile_v2_summary_upsell%2EsummaryUpsell%3Atrue%2Cprofile_v2_network_overview_insight%2EnumConn%3A1668%2Ctop_card%2Etc%3Atrue&x-oa=bottomAliases&id=" + GroupMemId + "&locale=&snapshotID=&authToken=&authType=name&invAcpt=¬Contactable=&primaryAction=&isPublic=false&sfd=true&_=1366115853014")); string[] array = Regex.Split(PageSource, "href=\"/groupRegistration?"); string[] array1 = Regex.Split(PageSource, "groupRegistration?"); List<string> ListGroupName = new List<string>(); string SelItem = string.Empty; foreach (var itemGrps in array1) { try { if (itemGrps.Contains("?gid=") && !itemGrps.Contains("<!DOCTYPE html")) //">Join { if (itemGrps.IndexOf("?gid=") == 0) { try { int startindex = itemGrps.IndexOf("\"name\":"); string start = itemGrps.Substring(startindex); int endIndex = start.IndexOf(","); ListGroupName.Add(start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("amp", string.Empty).Replace("&", string.Empty).Replace(";", string.Empty).Replace("csrfToken", string.Empty).Replace("name:", string.Empty)); } catch { } } } } catch { } } foreach (var item in ListGroupName) { if (groupscollectin == string.Empty) { groupscollectin = item; } else { groupscollectin += " - " + item; } } } catch { } #endregion #region Experience if (LDS_Experience == string.Empty) { try { string[] array = Regex.Split(stringSource, "title_highlight"); string exp = string.Empty; string comp = string.Empty; List<string> ListExperince = new List<string>(); List<string> ListCompany = new List<string>(); string SelItem = string.Empty; foreach (var itemGrps in array) { try { if (itemGrps.Contains("title_pivot") && !itemGrps.Contains("<!DOCTYPE html")) //">Join { try { int startindex = itemGrps.IndexOf("\":\""); string start = itemGrps.Substring(startindex); int endIndex = start.IndexOf(","); exp = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&", "&").Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty)); } catch { } try { int startindex1 = itemGrps.IndexOf("companyName"); string start1 = itemGrps.Substring(startindex1); int endIndex1 = start1.IndexOf(","); comp = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace("companyName", string.Empty).Replace(":", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty)); } catch { } if (Company == string.Empty) { Company = comp; } if (LDS_HeadLineTitle == string.Empty) { LDS_HeadLineTitle = exp; } ListExperince.Add(exp + ":" + comp); ListCompany.Add(comp); companycurrent = ListCompany[0]; } } catch { } } if (ListExperince.Count > 0) { foreach (var item in ListExperince) { if (LDS_Experience == string.Empty) { LDS_Experience = item; } else { LDS_Experience += " - " + item; } } } } catch { } try { string[] array = Regex.Split(stringSource, "name='title' title='Find others with this title'>"); string exp = string.Empty; string comp = string.Empty; List<string> ListExperince = new List<string>(); List<string> ListCompany = new List<string>(); string SelItem = string.Empty; foreach (var itemGrps in array) { try { if (!itemGrps.Contains("<!DOCTYPE html")) //">Join { try { int startindex = itemGrps.IndexOf(""); string start = itemGrps.Substring(startindex); int endIndex = start.IndexOf("</a>"); exp = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&", "&").Replace(";", string.Empty).Replace("\\u002d", "-").Replace("</a>", string.Empty).Replace("name:", string.Empty)); } catch { } try { int startindex1 = itemGrps.IndexOf("trk=prof-exp-company-name\">"); string start1 = itemGrps.Substring(startindex1); int endIndex1 = start1.IndexOf("</a>"); comp = (start1.Substring(0, endIndex1).Replace("trk=prof-exp-company-name\">", string.Empty).Replace(":", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("</a>", string.Empty).Replace("name:", string.Empty)).Replace("\"", string.Empty); } catch { } if (Company == string.Empty) { Company = comp; } if (LDS_HeadLineTitle == string.Empty) { LDS_HeadLineTitle = exp; } ListExperince.Add(exp + ":" + comp); ListCompany.Add(comp); companycurrent = ListCompany[0]; if (companycurrent.Contains("span data-tracking") || string.IsNullOrEmpty(companycurrent)) { try { if (companyList.Count > 0) { companycurrent = companyList[0]; } } catch { } } } } catch { } } if (ListExperince.Count > 0) { foreach (var item in ListExperince) { if (LDS_Experience == string.Empty) { LDS_Experience = item; } else { LDS_Experience += " - " + item; } } } } catch { } } #endregion #region skill and Expertise try { string[] strarr_skill = Regex.Split(stringSource, "endorse-item-name-text\""); string[] strarr_skill1 = Regex.Split(stringSource, "fmt__skill_name\""); if (strarr_skill.Count() >= 2) { foreach (string item in strarr_skill) { try { if (!item.Contains("!DOCTYPE html")) { try { string Grp = item.Substring(item.IndexOf(">"), (item.IndexOf("<", item.IndexOf(">")) - item.IndexOf(">"))).Replace(">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("&", "&").Trim(); checkgrplist.Add(Grp); checkgrplist.Distinct().ToList(); } catch { } } } catch { } } if (checkgrplist.Count > 0) { foreach (string item in checkgrplist) { if (string.IsNullOrEmpty(Skill)) { Skill = item; } else { Skill = Skill + " : " + item; } } } } else { if (strarr_skill1.Count() >= 2) { try { foreach (string skillitem in strarr_skill1) { if (!skillitem.Contains("!DOCTYPE html")) { try { // string Grp = skillitem.Substring(skillitem.IndexOf(":"), (skillitem.IndexOf("}", skillitem.IndexOf(":")) - skillitem.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); // checkgrplist.Add(Grp); // checkgrplist.Distinct().ToList(); int startindex = skillitem.IndexOf(":\""); string start = skillitem.Substring(startindex); int endindex = start.IndexOf("viewerEndorsementId"); if (!start.Contains("viewerEndorsementId")) { int endindex1 = start.IndexOf("\"}"); string end1 = skillitem.Substring(0, endindex1).Replace("\"}", "").Replace("\"", "").Replace("\":", "").Replace(",", "").Replace(":", "").Replace("\\u002d", ""); string Grp1 = end1; checkgrplist.Add(Grp1); checkgrplist.Distinct().ToList(); } else { string end = skillitem.Substring(0, endindex).Replace("viewerEndorsementId", string.Empty).Replace("\"", "").Replace("\":", "").Replace(",", "").Replace(":", "").Replace("\\u002d", ""); string Grp = end; checkgrplist.Add(Grp); checkgrplist.Distinct().ToList(); } } catch { } } } foreach (string item in checkgrplist) { if (string.IsNullOrEmpty(Skill)) { Skill = item; } else { Skill = Skill + " : " + item; } } } catch (Exception ex) { } } } } catch (Exception ex) { } #endregion #region Pasttitle string[] pasttitles = Regex.Split(stringSource, "title_highlight"); string pstTitlesitem = string.Empty; pasttitles = pasttitles.Skip(1).ToArray(); foreach (string item in pasttitles) { try { if (!item.Contains("<!DOCTYPE html>") && !item.Contains("Tip: You can also search by keyword")) { try { string[] Past_Ttl = Regex.Split(item, ","); pstTitlesitem = Past_Ttl[0].Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\u002d", "-").Replace("&", "&"); } catch { } if (string.IsNullOrEmpty(LDS_PastTitles)) { LDS_PastTitles = pstTitlesitem; } else if (LDS_PastTitles.Contains(pstTitlesitem)) { continue; } else { LDS_PastTitles = LDS_PastTitles + " : " + pstTitlesitem; } } } catch { } } if (string.IsNullOrEmpty(LDS_PastTitles)) { try { foreach (string item in titleList) { LDS_PastTitles = LDS_PastTitles + " : " + item; } } catch { } } if (string.IsNullOrEmpty(LDS_PastTitles)) { if (stringSource.Contains("id=\"overview-summary-past\">")) { string _tempPageSourcePastTitle = Utils.getBetween(stringSource, "id=\"overview-summary-past\">", "</tr>"); string[] pasttitles1 = Regex.Split(_tempPageSourcePastTitle, "dir=\"auto\">"); string pstTitlesitem1 = string.Empty; pasttitles1 = pasttitles1.Skip(1).ToArray(); foreach (string item in pasttitles1) { try { if (!item.Contains("<!DOCTYPE html>") && !item.Contains("Tip: You can also search by keyword")) { try { string[] Past_Ttl = Regex.Split(item, "<"); pstTitlesitem1 = Past_Ttl[0].Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\u002d", "-").Replace("&", "&"); } catch { } if (string.IsNullOrEmpty(LDS_PastTitles)) { LDS_PastTitles = pstTitlesitem1; } else if (LDS_PastTitles.Contains(pstTitlesitem1)) { continue; } else { LDS_PastTitles = LDS_PastTitles + " : " + pstTitlesitem1; } } } catch { } } } } #endregion #region FullUrl try { string[] UrlFull = System.Text.RegularExpressions.Regex.Split(Url, "&authType"); LDS_UserProfileLink = UrlFull[0]; LDS_UserProfileLink = Url; // LDS_UserProfileLink = stringSource.Substring(stringSource.IndexOf("canonicalUrl\":"), (stringSource.IndexOf(",", stringSource.IndexOf("canonicalUrl\":")) - stringSource.IndexOf("canonicalUrl\":"))).Replace("canonicalUrl\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); } catch { } #endregion #region Current Title Current Company try { int startindex = stringSource.IndexOf("memberHeadline"); if (startindex < 0) { try { int startindex1 = stringSource.IndexOf("<p class=\"title \">"); string start1 = stringSource.Substring(startindex1).Replace("<p class=\"title \">", string.Empty); int endindex1 = start1.IndexOf("</p>"); string end1 = start1.Substring(0, endindex1).Replace("</p>", string.Empty).Replace("ó", "ó").Replace("ñ", "ñ"); LDS_HeadLineTitle = end1.Trim(); } catch { } } else { try { string start = stringSource.Substring(startindex).Replace("memberHeadline", string.Empty); int endindex = start.IndexOf("\",\""); string end = start.Substring(0, endindex).Replace("\"", "").Replace(":", string.Empty); LDS_HeadLineTitle = end.Replace("\\u002d", "-"); } catch { } } } catch { } if (LDS_HeadLineTitle.Contains(" at ") || LDS_HeadLineTitle.Contains(" of ")) { // titlecurrent = string.Empty; string[] strdesigandcompany1 = new string[4]; // companycurrent = string.Empty; try { strdesigandcompany1 = Regex.Split(LDS_HeadLineTitle, " at "); if (strdesigandcompany1.Count() == 1) { strdesigandcompany1 = Regex.Split(LDS_HeadLineTitle, " of "); } } catch { } try { if (string.IsNullOrEmpty(companycurrent)) { companycurrent = strdesigandcompany1[1]; } if (companycurrent.Contains("span data-tracking") || string.IsNullOrEmpty(companycurrent)) { if (companyList.Count > 0) { companycurrent = companyList[0]; } } } catch { } } try { try { Company = stringSource.Substring(stringSource.IndexOf("visible\":true,\"memberHeadline"), (stringSource.IndexOf("memberID", stringSource.IndexOf("visible\":true,\"memberHeadline")) - stringSource.IndexOf("visible\":true,\"memberHeadline"))).Replace("visible\":true,\"memberHeadline", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("u002d", string.Empty).Replace(" ", string.Empty).Trim(); } catch { } if (string.IsNullOrEmpty(Company)) { try { Company = stringSource.Substring(stringSource.IndexOf("memberHeadline\":"), (stringSource.IndexOf(",", stringSource.IndexOf("memberHeadline\":")) - stringSource.IndexOf("memberHeadline\":"))).Replace("memberHeadline\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace(" ", string.Empty).Replace(":", "").Replace("&dsh;", "").Replace("&", "").Replace(";", "").Replace("u002d", string.Empty).Trim(); } catch { } } string[] strdesigandcompany = new string[4]; if (Company.Contains(" at ")) { try { strdesigandcompany = Regex.Split(Company, " at "); } catch { } #region Title try { LDS_HeadLineTitle = strdesigandcompany[0].Replace("\\u002d", "-"); } catch { } #endregion #region Current Company try { LDS_CurrentCompany = strdesigandcompany[1]; } catch { } #endregion } } catch { } #endregion Company #region degreeConnection //try //{ // int startindex = stringSource.IndexOf("text_plain__NAME_is_"); // string start = stringSource.Substring(startindex).Replace("text_plain__NAME_is_", string.Empty); // int endindex = start.IndexOf("_key"); // string end = start.Substring(0, endindex).Replace("_key", string.Empty); // degreeConnection = end.Replace("_", " ").Trim(); // if (degreeConnection.Contains("your connection")) // { // degreeConnection = "1st degree contact"; // } //} //catch //{ } //if (string.IsNullOrEmpty(degreeConnection)) //{ // try // { // int startindex = stringSource.IndexOf("class=\"fp-degree-icon\"><abbr title=\""); // string start = stringSource.Substring(startindex).Replace("class=\"fp-degree-icon\"><abbr title=\"", string.Empty); // int startindex1 = start.IndexOf("class=\"degree-icon \">"); // string start1 = start.Substring(startindex1); // int endindex = start1.IndexOf("<sup>"); // string end = start1.Substring(0, endindex).Replace("class=\"degree-icon \">", string.Empty).Replace("\"", string.Empty).Replace("<sup>", string.Empty); // degreeConnection = end.Replace("_", " ").Trim(); // } // catch // { } //} string[] arr = Regex.Split(stringSource, "<span class=\"fp-degree-icon\">"); arr = arr.Skip(1).ToArray(); foreach (string tempItem in arr) { if (tempItem.Contains("class=\"degree-icon \">")) { int startindex = tempItem.IndexOf("class=\"degree-icon \">"); string start = tempItem.Substring(startindex).Replace("class=\"degree-icon \">", string.Empty); int endIndex = start.IndexOf("</abbr>"); string end = start.Substring(0, endIndex).Replace("</abbr>", string.Empty).Replace("</sup>", string.Empty).Replace("<sup>", string.Empty); degreeConnection = end.Trim(); break; } } if (string.IsNullOrEmpty(degreeConnection)) { try { int startindex = stringSource.IndexOf("class=\"degree-icon \">"); string start = stringSource.Substring(startindex).Replace("class=\"degree-icon \">", string.Empty); int endIndex = start.IndexOf("</abbr>"); string end = start.Substring(0, endIndex).Replace("</abbr>", string.Empty).Replace("</sup>", string.Empty).Replace("<sup>", string.Empty); degreeConnection = end.Trim(); } catch { } } #endregion degreeConnection if (firstname == string.Empty) firstname = "LinkedIn"; if (lastname == string.Empty) lastname = "Member"; if (LDS_HeadLineTitle == string.Empty) LDS_HeadLineTitle = "--"; if (titlecurrent == string.Empty) titlecurrent = "--"; if (Company == string.Empty) Company = "--"; if (Connection == string.Empty) Connection = "--"; if (recomandation == string.Empty) recomandation = "--"; if (Skill == string.Empty) Skill = "--"; if (LDS_Experience == string.Empty) LDS_Experience = "--"; if (EducationCollection == string.Empty) EducationCollection = "--"; if (groupscollectin == string.Empty) groupscollectin = "--"; if (USERemail == string.Empty) USERemail = "--"; if (LDS_UserContact == string.Empty) LDS_UserContact = "--"; if (grpAllComapny == string.Empty) grpAllComapny = "--"; if (location == string.Empty) location = "--"; if (country == string.Empty) country = "--"; if (Industry == string.Empty) Industry = "--"; // if (Website == string.Empty) Website = "--"; if (website1 == string.Empty) website1 = "--"; if (degreeConnection == string.Empty) degreeConnection = "--"; if (companycurrent == string.Empty) companycurrent = "--"; // LDS_LoginID = _UserName; LDS_LoginID = UN; //SearchCriteria.LoginID; //LDS_LoginID = UserDetails.UserName; // string FinalData = firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + Skill.Replace(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + EducationCollection.Replace(",", ";") + "," + recomandation.Replace(",", ";") + "," + Connection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + URLprofile.Replace(",", ";") + "," + UserDetails.UserName + "," + TypeOfProfile + ","; string LDS_FinalData = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + Connection.Replace(",", ";") + "," + recomandation.Replace(",", string.Empty) + "," + Skill.Replace(",", ";") + "," + LDS_Experience.Replace(",", string.Empty) + "," + EducationCollection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + LDS_UserContact.Replace(",", ";") + "," + LDS_PastTitles + "," + grpAllComapny.Replace(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID + ",";// +TypeOfProfile + ","; //if (!string.IsNullOrEmpty(firstname)) //{ // Log(LDS_FinalData); //} //else //{ // Log("No Data For URL : " + Url); // GlobusFileHelper.AppendStringToTextfileNewLineWithCarat(Url, Globals.DesktopFolder + "\\UnScrapedList.txt"); //} // if (SearchCriteria.starter) //string tempFinalData = LDS_FinalData.Replace(";", "").Replace(LDS_UserProfileLink, "").Replace(TypeOfProfile, "").Replace(",", "").Replace(LDS_LoginID, "").Trim(); //if (!string.IsNullOrEmpty(tempFinalData)) //{ //AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, Globals.path_ScrappedMembersFromGroup); string CSVHeader = "ProfileType" + "," + "Degree Connection" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "HeadLineTitle" + "," + "Current Title " + "," + "Current Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedInLoginID" + ","; string CSV_Content = TypeOfProfile.Replace(",", ";") + "," + degreeConnection.Replace(",", ";") + "," + LDS_UserProfileLink.Replace(",", ";") + "," + firstname.Replace(",", ";") + "," + lastname.Replace(",", ";") + "," + LDS_HeadLineTitle.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";").Replace("002", "-") + "," + Connection.Replace(",", ";") + "," + recomandation.Replace(",", ";") + "," + Skill.Replace(",", ";") + "," + LDS_Experience.Replace(",", ";") + "," + EducationCollection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + LDS_UserContact.Replace(",", ";") + "," + LDS_PastTitles.Replace(",", ";") + "," + grpAllComapny.Replace(",", ";") + "," + location.Replace(",", ";") + "," + country.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + website1.Replace(",", ";") + "," + LDS_LoginID.Replace(",", ";"); //string CSV_Content = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + Connection.Replace(",", ";") + "," + recomandation.Replace(",", string.Empty) + "," + Skill.Replace(",", ";") + "," + LDS_Experience.Replace(",", string.Empty) + "," + EducationCollection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + LDS_UserContact.Replace(",", ";") + "," + LDS_PastTitles + "," + AllComapny.Replace(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID + ",";// +TypeOfProfile + ","; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_ScrappedMembersFromGroup); Log("[ " + DateTime.Now + " ] => [ Data Saved In CSV File With URL >>> " + LDS_UserProfileLink + " ]"); return true; //} } catch { }; return false; }
public string ExtractIDOfNonTimeLine(string URL, ref GlobusHttpHelper HttpHelper) { string id = ""; try { string strURLPageSource = HttpHelper.getHtmlfromUrl(new Uri(URL)); if (strURLPageSource.Contains("profile-picture-overlay")) { string[] arrprofile_picture_overlay = Regex.Split(strURLPageSource, "profile-picture-overlay"); if (arrprofile_picture_overlay.Count() > 1) { if (arrprofile_picture_overlay[1].Contains("?set=")) { string strid = arrprofile_picture_overlay[1].Substring(arrprofile_picture_overlay[1].IndexOf("?set="), (arrprofile_picture_overlay[1].IndexOf("&", arrprofile_picture_overlay[1].IndexOf("?set=")) - arrprofile_picture_overlay[1].IndexOf("?set="))).Replace("?set=", string.Empty).Replace(".", "/").Trim(); string[] arrId = Regex.Split(strid, "/"); id = arrId.Last(); } } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } return id; }