public static void ReplaceOrAdd <T, TR>(this Dictionary <T, TR> dict, T key, TR replacement) { if (dict.ContainsKey(key)) { dict.Replace(key, replacement); } else { dict[key] = replacement; } }
public T SetElementCount(String element, TValue count) { if (count.Equals(default(TValue))) { return(new T { Dictionary = Dictionary.RemoveKey(element) }); } return(new T { Dictionary = Dictionary.Replace(element, count) }); }
public void Visit(CallGraphNode node) { if (!Visited.Contains(node)) { Indices.Replace(node, CurIndex); Levels.Replace(node, CurIndex); CurIndex++; Visited.Push(node); foreach (var child in node.Callees) { if (!Visited.Contains(child)) { Visit(child); Levels.Replace(node, Math.Min(Levels.Get(child), Levels.Get(node))); } else { Levels.Replace(node, Math.Min(Levels.Get(node), Indices.Get(child))); } } if (Levels.Get(node) == Indices.Get(node)) { var scc = new List <CallGraphNode>(); CallGraphNode next = Visited.Pop(); scc.Add(node); while (next != node) { scc.Add(next); next = Visited.Pop(); } SCCs.Add(scc); } } }
public void Process(PlayerConnected connection) { var playerId = connection.PlayerId; PlayerContex context; if (state.Players.TryGetValue(playerId, out context)) { context.Output = connection.OutputQueue; context.PlayerHandler.PlayerJoin(); } else { var source = new CancellationTokenSource(); LoadingsPlayers.Replace(playerId, source, old => old.Cancel()); state.Storage.LoadPlayer(playerId, connection.PlayerType, x => { state.InputQueue.Post(new PlayerLoaded(x, source.Token, connection.OutputQueue)); }); } }
public Dictionary<string, string> AddSpecificGroupUser(ref GlobusHttpHelper HttpHelper, string UserID, string gid) { string endName = string.Empty; string DeegreeConn = string.Empty; string endKey = string.Empty; string Locality = string.Empty; string Val_sourceAlias = string.Empty; string Val_key = string.Empty; string Val_defaultText = string.Empty; string Name = string.Empty; string Val_CsrToken = string.Empty; string Val_Subject = string.Empty; string Val_greeting = string.Empty; string Val_AuthToken = string.Empty; string Val_AuthType = string.Empty; string val_trk = string.Empty; string Val_lastName = string.Empty; string html = string.Empty; string Title = string.Empty; #region Data Initialization string GroupMemId = string.Empty; string GroupName = 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 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 csrfToken = string.Empty; string pageSource = string.Empty; string[] RgxSikValue = new string[] { }; string[] RgxPageNo = new string[] { }; string sikvalue = string.Empty; int pageno = 25; int counter = 0; #endregion try { GroupSpecMem.Clear(); GroupName = gid.Split(':')[0]; string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top")); if (pageSource1.Contains("csrfToken")) { csrfToken = pageSource1.Substring(pageSource1.IndexOf("csrfToken"), 50); string[] Arr = csrfToken.Split('>'); csrfToken = Arr[0]; csrfToken = csrfToken.Replace(":", "%3A").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 src", string.Empty); csrfToken = csrfToken.Trim(); } for (int i = 1; i <= pageno; i++) { counter++; string[] RgxGroupData = new string[] { }; if (WithGroupSearch == true) { string txid = (UnixTimestampFromDateTime(System.DateTime.Now) * 1000).ToString(); if (counter == 1) { pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2])); RgxSikValue = System.Text.RegularExpressions.Regex.Split(pageSource, "sik"); try { sikvalue = RgxSikValue[1].Split('&')[0].Replace("=", string.Empty); } catch { } try { if (NumberHelper.ValidateNumber(sikvalue)) { sikvalue = sikvalue.Split('\"')[0]; } else { sikvalue = sikvalue.Split('\"')[0]; } } catch { sikvalue = sikvalue.Split('\"')[0]; } if (!string.IsNullOrEmpty(sikvalue)) { string postdata = "csrfToken=" + csrfToken + "&searchField=" + SearchKeyword + "&searchMembers=submit&searchMembers=Search&gid=" + gid.Split(':')[2] + "&goback=.gna_" + gid.Split(':')[2] + ""; pageSource = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/groups"), postdata, "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[2] + "", "", ""); } else { pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?csrfToken="+csrfToken+"&search="+SearchKeyword.Replace(" ","+")+"&gid=" + gid.Split(':')[2])); } } if (!string.IsNullOrEmpty(sikvalue)) { if (counter > 1) { string getdata = "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[2] + ""; pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata)); } RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\" id=\""); if (counter == 1) { try { RgxPageNo = System.Text.RegularExpressions.Regex.Split(pageSource, "<h3 class=\"page-title\">Search Results: <span>"); pageno = Convert.ToInt32(RgxPageNo[1].Split('<')[0].Replace("(", string.Empty).Replace(")", string.Empty).Replace("+", string.Empty).Trim()); pageno = pageno / 20 + 1; } catch { } if (pageno > 25) { pageno = 25; } } } else { // RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\">"); if (counter > 1) { string getdata = "https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[2] + "&page="+i; pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata)); } RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\">"); if (counter == 1) { try { RgxPageNo = System.Text.RegularExpressions.Regex.Split(pageSource, "<h3 class=\"page-title\">Search Results <span>"); pageno = Convert.ToInt32(RgxPageNo[1].Split('<')[0].Replace("(", string.Empty).Replace(")", string.Empty).Replace("+", string.Empty).Trim()); pageno = pageno / 20 + 1; } catch { } if (pageno > 25) { pageno = 25; } } } } else { //pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&split_page=" + i + "")); pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?gid=" + gid.Split(':')[2] + "&page=" + i)); RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\" id=\""); if (RgxGroupData.Length == 1) { RgxGroupData = Regex.Split(pageSource, "<span class=\"new-miniprofile-container\""); if (RgxGroupData.Length == 1) { break; } } } #region for csv if (WithCsvinAddFriend == true) { List<string> PageSerchUrl = ChilkatBasedRegex.GettingAllUrls(pageSource, "profile/view?id"); string FrnAcceptUrL = string.Empty; foreach (string item in PageSerchUrl) { try { if (item.Contains("/profile/view?id")) { FrnAcceptUrL = "http://www.linkedin.com" + item; string[] urll = Regex.Split(FrnAcceptUrL, "&authType"); Log("[ " + DateTime.Now + " ] => [ " + FrnAcceptUrL + " ]"); string stringSource = HttpHelper.getHtmlfromUrl1(new Uri(FrnAcceptUrL)); #region GroupMemId try { string[] gid1 = FrnAcceptUrL.Split('&'); GroupMemId = gid1[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("i18n__Overview_for_X"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Overview_for_X")) - stringSource.IndexOf("i18n__Overview_for_X"))).Replace("i18n__Overview_for_X", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":Overview for", "").Trim(); } catch { } } } 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]; if (NameArr.Count() == 3) { lastname = NameArr[1] + " " + NameArr[2]; } 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 Company = string.Empty; 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(); 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("i18n__LocationLocationcompletenessLevel4", string.Empty).Replace("visibletrue", "").Replace("isPortfoliofalse", string.Empty).Replace("isLNLedtrue", 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(";", "").Replace("isPortfoliofalse", string.Empty).Replace("isLNLedtrue", string.Empty).Trim(); } catch { } } titlecurrent = string.Empty; companycurrent = string.Empty; string[] strdesigandcompany = new string[4]; if (Company.Contains(" at ") || Company.Contains(" of ")) { 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 } if (titlecurrent == string.Empty) { titlecurrent = Company; } } catch { } #region PastCompany string[] companylist = Regex.Split(stringSource, "companyName\""); string AllComapny = string.Empty; string Companyname = string.Empty; checkerlst.Clear(); foreach (string item1 in companylist) { try { if (!item1.Contains("<!DOCTYPE html>")) { Companyname = item1.Substring(item1.IndexOf(":"), (item1.IndexOf(",", item1.IndexOf(":")) - item1.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 = item1; 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("&", "&"); } } if (companycurrent == string.Empty) { companycurrent = checkerlst[0].ToString(); } #endregion #endregion Company #region Company Descripription try { string[] str_CompanyDesc = Regex.Split(stringSource, "showSummarySection"); foreach (string item2 in str_CompanyDesc) { try { string Current_Company = string.Empty; if (!item2.Contains("<!DOCTYPE html>")) { int startindex = item2.IndexOf("specialties\":\""); if (startindex > 0) { try { string start = item2.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("\"u002", "-"); LDS_BackGround_Summary = Current_Company; } catch { } } } if (!item2.Contains("<!DOCTYPE html>")) { int startindex = item2.IndexOf("\"summary_lb\""); if (startindex > 0) { try { string start = item2.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); LDS_BackGround_Summary = Current_Company; } catch { } } } } catch { } } } catch { } #endregion #region Education EducationCollection = string.Empty; try { try { EducationCollection = 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).Trim(); } catch { try { // education1 = stringSource.Substring(stringSource.IndexOf("i18n__Overview_for_X"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Overview_for_X")) - stringSource.IndexOf("i18n__Overview_for_X"))).Replace("i18n__Overview_for_X", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":Overview for", "").Trim(); } catch { } } } catch { } #endregion #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) { } #endregion Email #region Website Website = string.Empty; 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).Trim(); } catch { } #endregion Website #region location location = string.Empty; 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(); } catch (Exception ex) { try { if (string.IsNullOrEmpty(location)) { int startindex = stringSource.IndexOf("\"fmt_location\":\""); if (startindex > 0) { string start = stringSource.Substring(startindex).Replace("\"fmt_location\":\"", ""); int endindex = start.IndexOf("\","); string end = start.Substring(0, endindex); country = end; } } } catch (Exception ex1) { } } #endregion location #region Country try { int startindex = stringSource.IndexOf("\"locationName\":\""); if (startindex > 0) { string start = stringSource.Substring(startindex).Replace("\"locationName\":\"", ""); int endindex = start.IndexOf("\","); string end = start.Substring(0, endindex); location = end; } } catch (Exception ex) { } #endregion #region Industry Industry = string.Empty; 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) { } #endregion Industry #region Connection Connection = string.Empty; 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) { } #endregion Connection #region Recommendation try { //recomandation = stringSource.Substring(stringSource.IndexOf("i18n__Recommend_Query\":"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Recommend_Query\":")) - stringSource.IndexOf("i18n__Recommend_Query\":"))).Replace("i18n__Recommend_Query\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); string PageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/profile-v2-endorsements?id=" + GroupMemId + "&authType=OUT_OF_NETWORK&authToken=rXRG&goback=%2Efps_PBCK_*1_*1_*1_*1_*1_*1_tcs_*2_CP_I_us_*1_*1_false_1_R_*1_*51_*1_*51_true_*1_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2")); string[] arrayRecommendedName = Regex.Split(PageSource, "headline"); List<string> ListRecommendationName = new List<string>(); recomandation = string.Empty; foreach (var itemRecomName in arrayRecommendedName) { try { if (!itemRecomName.Contains("Endorsements")) { try { int startindex = itemRecomName.IndexOf(":"); string start = itemRecomName.Substring(startindex); int endIndex = start.IndexOf("\","); string Heading = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty)); 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)); ListRecommendationName.Add(Name + " : " + Heading); } catch { } } } catch { } } foreach (var item5 in ListRecommendationName) { if (recomandation == string.Empty) { recomandation = item5; } else { recomandation += " - " + item5; } } } catch { } #endregion #region Experience LDS_Experience = string.Empty; 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; 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 (titlecurrent == string.Empty) { titlecurrent = exp; } if (companycurrent == string.Empty) { companycurrent = comp; } ListExperince.Add(exp + ":" + comp); } } catch { } } foreach (var itemExp in ListExperince) { if (LDS_Experience == string.Empty) { LDS_Experience = itemExp; } else { LDS_Experience += " - " + itemExp; } } } catch { } } #endregion #region Group try { 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 item6 in ListGroupName) { if (groupscollectin == string.Empty) { groupscollectin = item6; } else { groupscollectin += " - " + item6; } } } 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 item7 in strarr_skill) { try { if (!item7.Contains("!DOCTYPE html")) { try { string Grp = item7.Substring(item7.IndexOf("<"), (item7.IndexOf(">", item7.IndexOf("<")) - item7.IndexOf("<"))).Replace("<", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); checkgrplist.Add(Grp); checkgrplist.Distinct().ToList(); } catch { } } } catch { } } foreach (string item8 in checkgrplist) { if (string.IsNullOrEmpty(Skill)) { Skill = item8; } else { Skill = Skill + " - " + item8; } } } 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 item9 in checkgrplist) { if (string.IsNullOrEmpty(Skill)) { Skill = item9; } else { Skill = Skill + " - " + item9; } } } catch (Exception ex) { } } } } catch (Exception ex) { } #endregion #region Pasttitle and All Company Summary string[] pasttitles = Regex.Split(stringSource, "company_name"); string pstTitlesitem = string.Empty; string pstDescCompitem = string.Empty; LDS_PastTitles = string.Empty; pasttitles = pasttitles.Skip(1).ToArray(); foreach (string item10 in pasttitles) { if (item10.Contains("positionId")) { try { int startindex = item10.IndexOf(":"); if (startindex > 0) { string start = item10.Substring(startindex).Replace(":\"", ""); int endindex = start.IndexOf("\","); string end = start.Substring(0, endindex); pstTitlesitem = end.Replace(",", ";"); } if (string.IsNullOrEmpty(LDS_PastTitles)) { LDS_PastTitles = pstTitlesitem; } else { LDS_PastTitles = LDS_PastTitles + " : " + pstTitlesitem; } int startindex1 = item10.IndexOf("summary_lb\":\""); if (startindex > 0) { string start1 = item10.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); 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 FullUrl try { string[] UrlFull = System.Text.RegularExpressions.Regex.Split(FrnAcceptUrL, "&authType"); LDS_UserProfileLink = UrlFull[0]; LDS_UserProfileLink = UrlFull[0]; // 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 = UserID; if (string.IsNullOrEmpty(firstname)) { firstname = "Linkedin Member"; } LDS_BackGround_Summary = LDS_BackGround_Summary.Replace("\n", "").Replace("-", "").Replace("d", "").Replace("•", "").Replace(";", "").Replace("\n", "").Replace(",", "").Replace("ȁ", "").Trim(); LDS_Desc_AllComp = "NA"; Skill = "NA"; string LDS_FinalData = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + LDS_Desc_AllComp + "," + 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(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID.Replace(",", ";") + ","; AppFileHelper.AddingLinkedInGroupMemberDataToCSVFile(LDS_FinalData, SearchCriteria.FileName); } catch { } } } catch { } } } #endregion foreach (var GrpUser in RgxGroupData) { try { if (GrpUser.Contains("member")) { if (GrpUser.Contains("title=\"YOU") || GrpUser.Contains("<!DOCTYPE html>")) { if (GrpUser.Contains("title=\"YOU")) { } continue; } try { //data-li-fullName="Kashish Arora">Send message</a> int startindex = GrpUser.IndexOf("fullName="); if (startindex > 0) { endName = string.Empty; string start = GrpUser.Substring(startindex); int endIndex = start.IndexOf(">Send message<"); if (endIndex == -1) { endIndex = start.IndexOf(">"); } endName = start.Substring(0, endIndex).Replace("fullName=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&", "&").Replace(""", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9","é").Trim(); } else { endName = string.Empty; int startindex1 = GrpUser.IndexOf("alt="); string start = GrpUser.Substring(startindex1).Replace("alt=\"", ""); int endIndex = start.IndexOf("\""); try { endName = start.Substring(0, endIndex).Replace("alt=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace(">", string.Empty).Replace("\"", string.Empty).Replace("&", "&").Replace(""", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9", "é").Trim(); } catch { } try { if (string.IsNullOrEmpty(endName)) { endName = start.Substring(start.IndexOf("alt="), start.IndexOf("class=", start.IndexOf("alt=")) - start.IndexOf("alt=")).Replace("alt=", string.Empty).Replace("alt=", string.Empty).Replace("\"", string.Empty).Replace(""", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9", "é").Trim(); } } catch { } } } catch { } //Deegree connection try { int startindex = GrpUser.IndexOf("<span class=\"degree-icon\">"); if (startindex > 0) { DeegreeConn = string.Empty; string start = GrpUser.Substring(startindex); int endIndex = start.IndexOf("<sup>"); DeegreeConn = start.Substring(0, endIndex).Replace("<span class=\"degree-icon\">", string.Empty); if (DeegreeConn == "1") { DeegreeConn = DeegreeConn + "st"; } else if (DeegreeConn == "2") { DeegreeConn = DeegreeConn + "nd"; } else if (DeegreeConn == "3") { DeegreeConn = DeegreeConn + "rd"; } } else { startindex = GrpUser.IndexOf("span class=\"degree-icon group\">"); DeegreeConn = string.Empty; if (startindex > 0) { DeegreeConn = string.Empty; string start = GrpUser.Substring(startindex); int endIndex = start.IndexOf("</span>"); DeegreeConn = start.Substring(0, endIndex).Replace("span class=\"degree-icon group\">", string.Empty); } if (DeegreeConn == string.Empty) { DeegreeConn = "3rd"; } } } catch { } try { int startindex2 = GrpUser.IndexOf("memberId="); if (startindex2 > 0) { endKey = string.Empty; string start1 = GrpUser.Substring(startindex2); int endIndex1 = start1.IndexOf("data-li-fullName="); endKey = start1.Substring(0, endIndex1).Replace("memberId=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Trim(); } else { endKey = string.Empty; int startindex3 = GrpUser.IndexOf("member-"); string start1 = GrpUser.Substring(startindex3); int endIndex1 = start1.IndexOf(">"); endKey = start1.Substring(0, endIndex1).Replace("member-", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace(">", string.Empty).Replace("\"", string.Empty).Trim(); } } catch { } try { GroupSpecMem.Add(endKey, " [" + GroupName.Replace(",", string.Empty) + " ] " + endName + " (" + DeegreeConn.Replace(",", string.Empty) + ")"); string item = UserID + "," + GroupName.Replace(",", string.Empty) + "," + endName + "," + DeegreeConn.Replace(",", string.Empty); AddingLinkedInDataToCSVFile1(item); if (WithGroupSearch == true) { Loggergrppmem("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " (" + DeegreeConn + ") with Search keyword : " + SearchKeyword + " ]"); } else { Loggergrppmem("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " ]"); } } catch { } } else { } } catch { } } } return GroupSpecMem; } catch { } return GroupSpecMem; }
public Dictionary<string, string> AddSpecificGroupUser(ref GlobusHttpHelper HttpHelper, LinkedinUser objLinkedinUser, string gid) { string endName = string.Empty; string DeegreeConn = string.Empty; string endKey = string.Empty; string Locality = string.Empty; string Val_sourceAlias = string.Empty; string Val_key = string.Empty; string Val_defaultText = string.Empty; string Name = string.Empty; string Val_CsrToken = string.Empty; string Val_Subject = string.Empty; string Val_greeting = string.Empty; string Val_AuthToken = string.Empty; string Val_AuthType = string.Empty; string val_trk = string.Empty; string Val_lastName = string.Empty; string html = string.Empty; string Title = string.Empty; #region Data Initialization string GroupMemId = string.Empty; string GroupName = 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 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 csrfToken = string.Empty; string pageSource = string.Empty; string[] RgxSikValue = new string[] { }; string[] RgxPageNo = new string[] { }; string sikvalue = string.Empty; int pageno = 25; int counter = 0; string group_Url = string.Empty; string pagination_url = string.Empty; string groupId = string.Empty; string UserID = string.Empty; #endregion try { HttpHelper = objLinkedinUser.globusHttpHelper; UserID = objLinkedinUser.username; GroupSpecMem.Clear(); GroupName = gid.Split('^')[0]; groupId = gid.Split(':')[1]; string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/home?trk=hb_tab_home_top")); if (pageSource1.Contains("csrfToken")) { csrfToken = pageSource1.Substring(pageSource1.IndexOf("csrfToken"), 50); string[] Arr = csrfToken.Split('>'); csrfToken = Arr[0]; csrfToken = csrfToken.Replace(":", "%3A").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 src", string.Empty); csrfToken = csrfToken.Trim(); } for (int i = 1; i <= pageno; i++) { counter++; string[] RgxGroupData = new string[] { }; #region with group search if (WithGroupSearch == true) { string txid = (UnixTimestampFromDateTime(System.DateTime.Now) * 1000).ToString(); if (counter == 1) { // pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2])); pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[1])); string Gid = string.Empty; try { Gid = gid.Split(':')[1]; } catch (Exception ex) { } string URL = "https://www.linkedin.com/groups?viewMembers=&gid=" + Gid; pageSource = HttpHelper.getHtmlfromUrl(new Uri(URL)); RgxSikValue = System.Text.RegularExpressions.Regex.Split(pageSource, "sik"); try { sikvalue = RgxSikValue[1].Split('&')[0].Replace("=", string.Empty); } catch { } try { if (NumberHelper.ValidateNumber(sikvalue)) { sikvalue = sikvalue.Split('\"')[0]; } else { sikvalue = sikvalue.Split('\"')[0]; } } catch { sikvalue = sikvalue.Split('\"')[0]; } //if (pageSource.Contains("<p class=\"paginate\">")) //{ // pagination_url = Utils.getBetween(pageSource, "<p class=\"paginate\">", "</a>"); // pagination_url = Utils.getBetween(pagination_url, "href=\"", "\">").Replace("amp;", ""); // pagination_url = "https://www.linkedin.com" + pagination_url; //} if (!string.IsNullOrEmpty(sikvalue)) { //string postdata = "csrfToken=" + csrfToken + "&searchField=" + SearchKeyword + "&searchMembers=submit&searchMembers=Search&gid=" + gid.Split(':')[2] + "&goback=.gna_" + gid.Split(':')[2] + ""; //pageSource = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/groups"), postdata, "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[2] + "", "", ""); #region Commented by sharan string postdata = "csrfToken=" + csrfToken + "&searchField=" + SearchKeyword + "&searchMembers=submit&searchMembers=Search&gid=" + gid.Split(':')[1] + "&goback=.gna_" + gid.Split(':')[1] + ""; pageSource = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/groups"), postdata, "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[1] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[1] + "", "", ""); #endregion #region written by sharan pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[1])); #endregion //string postdata = "csrfToken=" + csrfToken + "&searchField=" + SearchKeyword + "&searchMembers=submit&searchMembers=Search&gid=" + gid.Split(':')[1] + "&goback=.gna_" + gid.Split(':')[1] + ""; //pageSource = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/groups"), postdata, "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[1] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[1] + "", "", ""); } else { pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[1])); // pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[1])); } } if (!string.IsNullOrEmpty(sikvalue)) { if (counter > 1) { // string getdata = "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[2] + ""; string getdata = "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[1] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[1] + ""; string new_pagination_url = pagination_url; new_pagination_url = Utils.getBetween("###" + new_pagination_url, "###", "page="); new_pagination_url = new_pagination_url + "page=" + counter; pageSource = HttpHelper.getHtmlfromUrl(new Uri(new_pagination_url)); // pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata)); // string getdata = "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[1] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[1] + ""; // pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata)); } RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\">"); if (counter == 1) { try { RgxPageNo = System.Text.RegularExpressions.Regex.Split(pageSource, "<h3 class=\"page-title\">Search Results: <span>"); pageno = Convert.ToInt32(RgxPageNo[1].Split('<')[0].Replace("(", string.Empty).Replace(")", string.Empty).Replace("+", string.Empty).Trim()); pageno = pageno / 20 + 1; } catch { } if (pageno > 25) { pageno = 25; } try { if (pageSource.Contains("<p class=\"paginate\">")) { pagination_url = Utils.getBetween(pageSource, "<p class=\"paginate\">", "</a>"); pagination_url = Utils.getBetween(pagination_url, "href=\"", "\">").Replace("amp;", ""); pagination_url = "https://www.linkedin.com" + pagination_url; pagination_url = pagination_url.Replace("amp;", ""); } } catch { } } } else { // RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\">"); if (counter > 1) { //string getdata = "https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[2] + "&page="+i; //string getdata = "https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[2] + "&page=" + i; string new_pagination_url = pagination_url; new_pagination_url = Utils.getBetween("###" + new_pagination_url, "###", "page="); new_pagination_url = new_pagination_url + "page=" + counter; pageSource = HttpHelper.getHtmlfromUrl(new Uri(new_pagination_url)); // pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata)); } if (string.IsNullOrEmpty(sikvalue) && counter == 1) { try { if (pageSource.Contains("<p class=\"paginate\">")) { pagination_url = Utils.getBetween(pageSource, "<p class=\"paginate\">", "</a>"); pagination_url = Utils.getBetween(pagination_url, "href=\"", "\">").Replace("amp;", ""); pagination_url = "https://www.linkedin.com" + pagination_url; pagination_url = pagination_url.Replace("amp;", ""); } } catch { } } RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\">"); if (counter == 1) { try { RgxPageNo = System.Text.RegularExpressions.Regex.Split(pageSource, "<h3 class=\"page-title\">Search Results <span>"); pageno = Convert.ToInt32(RgxPageNo[1].Split('<')[0].Replace("(", string.Empty).Replace(")", string.Empty).Replace("+", string.Empty).Trim()); pageno = pageno / 20 + 1; } catch { } if (pageno > 25) { pageno = 25; } } } } #endregion else { //pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&split_page=" + i + "")); pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?gid=" + gid.Split(':')[1] + "&page=" + i)); group_Url = "https://www.linkedin.com/grp/members?gid=" + gid.Split(':')[1]; RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\" id=\""); if (RgxGroupData.Length == 1) { RgxGroupData = Regex.Split(pageSource, "<span class=\"new-miniprofile-container\""); if (RgxGroupData.Length == 1) { break; } } } #region for csv if (WithCsvinAddFriend == true) { List<string> PageSerchUrl = ChilkatBasedRegex.GettingAllUrls(pageSource, "profile/view?id"); string FrnAcceptUrL = string.Empty; foreach (string item in PageSerchUrl) { try { if (item.Contains("/profile/view?id")) { FrnAcceptUrL = "http://www.linkedin.com" + item; string[] urll = Regex.Split(FrnAcceptUrL, "&authType"); GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + FrnAcceptUrL + " ]"); string stringSource = HttpHelper.getHtmlfromUrl(new Uri(FrnAcceptUrL)); #region GroupMemId try { string[] gid1 = FrnAcceptUrL.Split('&'); GroupMemId = gid1[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("i18n__Overview_for_X"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Overview_for_X")) - stringSource.IndexOf("i18n__Overview_for_X"))).Replace("i18n__Overview_for_X", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":Overview for", "").Trim(); } catch { } } } 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]; if (NameArr.Count() == 3) { lastname = NameArr[1] + " " + NameArr[2]; } 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 Company = string.Empty; 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(); 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("i18n__LocationLocationcompletenessLevel4", string.Empty).Replace("visibletrue", "").Replace("isPortfoliofalse", string.Empty).Replace("isLNLedtrue", 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(";", "").Replace("isPortfoliofalse", string.Empty).Replace("isLNLedtrue", string.Empty).Trim(); } catch { } } titlecurrent = string.Empty; companycurrent = string.Empty; string[] strdesigandcompany = new string[4]; if (Company.Contains(" at ") || Company.Contains(" of ")) { 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 } if (titlecurrent == string.Empty) { titlecurrent = Company; } } catch { } #region PastCompany string[] companylist = Regex.Split(stringSource, "companyName\""); string AllComapny = string.Empty; string Companyname = string.Empty; checkerlst.Clear(); foreach (string item1 in companylist) { try { if (!item1.Contains("<!DOCTYPE html>")) { Companyname = item1.Substring(item1.IndexOf(":"), (item1.IndexOf(",", item1.IndexOf(":")) - item1.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 = item1; 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("&", "&"); } } if (companycurrent == string.Empty) { companycurrent = checkerlst[0].ToString(); } #endregion #endregion Company #region Company Descripription try { string[] str_CompanyDesc = Regex.Split(stringSource, "showSummarySection"); foreach (string item2 in str_CompanyDesc) { try { string Current_Company = string.Empty; if (!item2.Contains("<!DOCTYPE html>")) { int startindex = item2.IndexOf("specialties\":\""); if (startindex > 0) { try { string start = item2.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("\"u002", "-"); LDS_BackGround_Summary = Current_Company; } catch { } } } if (!item2.Contains("<!DOCTYPE html>")) { int startindex = item2.IndexOf("\"summary_lb\""); if (startindex > 0) { try { string start = item2.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); LDS_BackGround_Summary = Current_Company; } catch { } } } } catch { } } } catch { } #endregion #region Education EducationCollection = string.Empty; try { try { EducationCollection = 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).Trim(); } catch { try { // education1 = stringSource.Substring(stringSource.IndexOf("i18n__Overview_for_X"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Overview_for_X")) - stringSource.IndexOf("i18n__Overview_for_X"))).Replace("i18n__Overview_for_X", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":Overview for", "").Trim(); } catch { } } } catch { } #endregion #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) { } #endregion Email #region Website Website = string.Empty; 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).Trim(); } catch { } #endregion Website #region location location = string.Empty; 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(); } catch (Exception ex) { try { if (string.IsNullOrEmpty(location)) { int startindex = stringSource.IndexOf("\"fmt_location\":\""); if (startindex > 0) { string start = stringSource.Substring(startindex).Replace("\"fmt_location\":\"", ""); int endindex = start.IndexOf("\","); string end = start.Substring(0, endindex); country = end; } } } catch (Exception ex1) { } } #endregion location #region Country try { int startindex = stringSource.IndexOf("\"locationName\":\""); if (startindex > 0) { string start = stringSource.Substring(startindex).Replace("\"locationName\":\"", ""); int endindex = start.IndexOf("\","); string end = start.Substring(0, endindex); location = end; } } catch (Exception ex) { } #endregion #region Industry Industry = string.Empty; 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) { } #endregion Industry #region Connection Connection = string.Empty; 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) { } #endregion Connection #region Recommendation try { //recomandation = stringSource.Substring(stringSource.IndexOf("i18n__Recommend_Query\":"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Recommend_Query\":")) - stringSource.IndexOf("i18n__Recommend_Query\":"))).Replace("i18n__Recommend_Query\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); string PageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/profile-v2-endorsements?id=" + GroupMemId + "&authType=OUT_OF_NETWORK&authToken=rXRG&goback=%2Efps_PBCK_*1_*1_*1_*1_*1_*1_tcs_*2_CP_I_us_*1_*1_false_1_R_*1_*51_*1_*51_true_*1_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2")); string[] arrayRecommendedName = Regex.Split(PageSource, "headline"); List<string> ListRecommendationName = new List<string>(); recomandation = string.Empty; foreach (var itemRecomName in arrayRecommendedName) { try { if (!itemRecomName.Contains("Endorsements")) { try { int startindex = itemRecomName.IndexOf(":"); string start = itemRecomName.Substring(startindex); int endIndex = start.IndexOf("\","); string Heading = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty)); 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)); ListRecommendationName.Add(Name + " : " + Heading); } catch { } } } catch { } } foreach (var item5 in ListRecommendationName) { if (recomandation == string.Empty) { recomandation = item5; } else { recomandation += " - " + item5; } } } catch { } #endregion #region Experience LDS_Experience = string.Empty; 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; 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 (titlecurrent == string.Empty) { titlecurrent = exp; } if (companycurrent == string.Empty) { companycurrent = comp; } ListExperince.Add(exp + ":" + comp); } } catch { } } foreach (var itemExp in ListExperince) { if (LDS_Experience == string.Empty) { LDS_Experience = itemExp; } else { LDS_Experience += " - " + itemExp; } } } catch { } } #endregion #region Group try { string PageSource = HttpHelper.getHtmlfromUrl(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 item6 in ListGroupName) { if (groupscollectin == string.Empty) { groupscollectin = item6; } else { groupscollectin += " - " + item6; } } } 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 item7 in strarr_skill) { try { if (!item7.Contains("!DOCTYPE html")) { try { string Grp = item7.Substring(item7.IndexOf("<"), (item7.IndexOf(">", item7.IndexOf("<")) - item7.IndexOf("<"))).Replace("<", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim(); checkgrplist.Add(Grp); checkgrplist.Distinct().ToList(); } catch { } } } catch { } } foreach (string item8 in checkgrplist) { if (string.IsNullOrEmpty(Skill)) { Skill = item8; } else { Skill = Skill + " - " + item8; } } } 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 item9 in checkgrplist) { if (string.IsNullOrEmpty(Skill)) { Skill = item9; } else { Skill = Skill + " - " + item9; } } } catch (Exception ex) { } } } } catch (Exception ex) { } #endregion #region Pasttitle and All Company Summary string[] pasttitles = Regex.Split(stringSource, "company_name"); string pstTitlesitem = string.Empty; string pstDescCompitem = string.Empty; LDS_PastTitles = string.Empty; pasttitles = pasttitles.Skip(1).ToArray(); foreach (string item10 in pasttitles) { if (item10.Contains("positionId")) { try { int startindex = item10.IndexOf(":"); if (startindex > 0) { string start = item10.Substring(startindex).Replace(":\"", ""); int endindex = start.IndexOf("\","); string end = start.Substring(0, endindex); pstTitlesitem = end.Replace(",", ";"); } if (string.IsNullOrEmpty(LDS_PastTitles)) { LDS_PastTitles = pstTitlesitem; } else { LDS_PastTitles = LDS_PastTitles + " : " + pstTitlesitem; } int startindex1 = item10.IndexOf("summary_lb\":\""); if (startindex > 0) { string start1 = item10.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); 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 FullUrl try { string[] UrlFull = System.Text.RegularExpressions.Regex.Split(FrnAcceptUrL, "&authType"); LDS_UserProfileLink = UrlFull[0]; LDS_UserProfileLink = UrlFull[0]; // 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 = objLinkedinUser.username; if (string.IsNullOrEmpty(firstname)) { firstname = "Linkedin Member"; } LDS_BackGround_Summary = LDS_BackGround_Summary.Replace("\n", "").Replace("-", "").Replace("d", "").Replace("•", "").Replace(";", "").Replace("\n", "").Replace(",", "").Replace("ȁ", "").Trim(); LDS_Desc_AllComp = "NA"; Skill = "NA"; string LDS_FinalData = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + LDS_Desc_AllComp + "," + 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(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID.Replace(",", ";") + ","; // AppFileHelper.AddingLinkedInGroupMemberDataToCSVFile(LDS_FinalData, SearchCriteria.FileName); } catch { } } } catch { } } } #endregion foreach (var GrpUser in RgxGroupData) { try { if (GrpUser.Contains("member")) { if (GrpUser.Contains("title=\"YOU") || GrpUser.Contains("<!DOCTYPE html>")) { if (GrpUser.Contains("title=\"YOU")) { } continue; } string profileUrl = string.Empty; try { profileUrl = Utils.getBetween(GrpUser, "<a href=\"", "\">"); } catch { } try { //data-li-fullName="Kashish Arora">Send message</a> int startindex = GrpUser.IndexOf("fullName="); if (startindex > 0) { endName = string.Empty; string start = GrpUser.Substring(startindex); int endIndex = start.IndexOf(">Send message<"); if (endIndex == -1) { endIndex = start.IndexOf(">"); } endName = start.Substring(0, endIndex).Replace("fullName=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&", "&").Replace(""", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9", "é").Trim(); } else { endName = string.Empty; int startindex1 = GrpUser.IndexOf("alt="); string start = GrpUser.Substring(startindex1).Replace("alt=\"", ""); int endIndex = start.IndexOf("\""); try { endName = start.Substring(0, endIndex).Replace("alt=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace(">", string.Empty).Replace("\"", string.Empty).Replace("&", "&").Replace(""", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9", "é").Trim(); } catch { } try { if (string.IsNullOrEmpty(endName)) { endName = start.Substring(start.IndexOf("alt="), start.IndexOf("class=", start.IndexOf("alt=")) - start.IndexOf("alt=")).Replace("alt=", string.Empty).Replace("alt=", string.Empty).Replace("\"", string.Empty).Replace(""", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9", "é").Trim(); } } catch { } } } catch { } //Deegree connection try { int startindex = GrpUser.IndexOf("<span class=\"degree-icon\">"); if (startindex > 0) { DeegreeConn = string.Empty; string start = GrpUser.Substring(startindex); int endIndex = start.IndexOf("<sup>"); DeegreeConn = start.Substring(0, endIndex).Replace("<span class=\"degree-icon\">", string.Empty); if (DeegreeConn == "1") { DeegreeConn = DeegreeConn + "st"; } else if (DeegreeConn == "2") { DeegreeConn = DeegreeConn + "nd"; } else if (DeegreeConn == "3") { DeegreeConn = DeegreeConn + "rd"; } } else { startindex = GrpUser.IndexOf("span class=\"degree-icon group\">"); DeegreeConn = string.Empty; if (startindex > 0) { DeegreeConn = string.Empty; string start = GrpUser.Substring(startindex); int endIndex = start.IndexOf("</span>"); DeegreeConn = start.Substring(0, endIndex).Replace("span class=\"degree-icon group\">", string.Empty); } if (DeegreeConn == string.Empty) { DeegreeConn = "3rd"; } } } catch { } try { int startindex2 = GrpUser.IndexOf("memberId="); if (startindex2 > 0) { endKey = string.Empty; string start1 = GrpUser.Substring(startindex2); int endIndex1 = start1.IndexOf("data-li-fullName="); endKey = start1.Substring(0, endIndex1).Replace("memberId=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Trim(); } else { endKey = string.Empty; int startindex3 = GrpUser.IndexOf("member-"); string start1 = GrpUser.Substring(startindex3); int endIndex1 = start1.IndexOf(">"); endKey = start1.Substring(0, endIndex1).Replace("member-", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace(">", string.Empty).Replace("\"", string.Empty).Trim(); } } catch { } try { GroupSpecMem.Add(endKey, " [" + GroupName.Replace(",", string.Empty) + " ] " + endName + " (" + DeegreeConn.Replace(",", string.Empty) + ")"); string item = UserID + "," + GroupName.Replace(",", string.Empty) + "," + group_Url.Replace("'", "").Replace("\r", "").Replace(" ", "").Replace("\n", " ") + "," + endName + "," + profileUrl.Replace("'", "").Replace("\r", "").Replace(" ", "").Replace("\n", " ") + "," + DeegreeConn.Replace(",", string.Empty); // AddingLinkedInDataToCSVFile1(item); if (WithGroupSearch == true) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " (" + DeegreeConn + ") with Search keyword : " + SearchKeyword + " ]"); // objfrmMain.AddLoggerLoggerForGroupScraper("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " (" + DeegreeConn + ") with Search keyword : " + SearchKeyword + " ]"); } else { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " ]"); } } catch { } } else { } } catch { } } return GroupSpecMem; } #region new code_11_26 if (GroupSpecMem.Count <= 0) { List<string> lstNewMembers = new List<string>(); bool gotScrapeUrl = false; int startPage = 10; string url = "https://www.linkedin.com/communities-api/v1/memberships/community/" + groupId + "?projection=MINI&count=20&start=0"; GetItemToScrapeUrls: List<string> lstitemForScrap = new List<string>(); // pageSource = HttpHelper.getHtmlfromUrl(new Uri(url), "https://www.linkedin.com/groups/" + groupId + "", "", ""); #region Cookie settings // string CookieDaata = "bcookie=\"v=2&e456608f-798a-4a30-8111-4abf66a2a2d2\"; bscookie=\"v=1&201504281150112c2cb966-888b-44d4-8fe3-2bed850fc88eAQH5LeTYIub6nyWgnwTdMWl9XSSvnwsJ\"; visit=\"v=1&M\"; _chartbeat2=vnNg6xd-hkBwUPD5.1439389439450.1439994463832.10000001; VID=V_2015_08_19_07_4913; ELOQUA=GUID=28AF04F863BF45A78F3AA16B2C88EFBC; BKUT=1439994600; sessionid=\"eyJkamFuZ29fdGltZXpvbmUiOiJBc2lhL0tvbGthdGEifQ:1a1DwL:Z1TtuNNPyqGqvT1Pix66crqU9RA\"; csrftoken=fGdgb242nAkaqdDI0T72TptnHK9Fq9MM; _ga=GA1.2.1307723840.1448360766; L1c=5eba1285; oz_props_fetch_size1_125011638=9; wutan=YjukjFsDQIHEoN/VG0Nwwa8w7dzs308V6oAfSeVHCY8=; L1e=4a2dae59; oz_props_fetch_size1_394473043=5; oz_props_fetch_size1_394482147=1; sl=\"v=1&y7Ik2\"; li_at=AQEDAReDUeMB8eJnAAABUXFNV2wAAAFRcbs0bEsAw1uzWq20X7lGOtdsUgxs31vuFr1q74cnHL82GBdRUIVjbPbKccr0gJVqHj9mqczMKjWVA417H7gRrQeFQARUNssZqNTx0aZZR1hyEmdxvf4iYbF1; liap=true; JSESSIONID=\"ajax:7383772031323678847\"; share_setting=PUBLIC; sdsc=1%3A1SZM1shxDNbLt36wZwCgPgvN58iw%3D; _lipt=0_0MPCZKVCxoBpoHR17D_hDUfM2NiX0FG-oN1B8U9sDtgK_Ydwh1Gw2TGDG8LSwwC-BWGgocnwaixcQM_gvLFHZRCDaMOR9vUNoFFU7Pv4sekUOXFI9ys8jl6QfmKapvABKOlY89bVv5mqx58JvuF7NyP6lyWIckctWO6k6UG0iu1y6ABeq4BLdi4Hx_r4fhtEsbUgeBtzZHE00OAoBcpWzyBorypcrsvu10vjpfQ4JrlkZcgesHUL0zqxRmg6dwbDlfWnQT0C4hwhjEdaTEVNTp; lidc=\"b=LB47:g=319:u=13:i=1449305064:t=1449390866:s=AQG1xLWNXv_mwQpQa_XpXXydwVB0xggq\"; lang=\"v=2&lang=en-us\"; RT=s=1449305300845&r=https%3A%2F%2Fwww.linkedin.com%2Fgroups%2F47307%2Fmembers"; // string[] CookieDaatalst = Regex.Split(CookieDaata, ";"); // HttpHelper.gCookies = new System.Net.CookieCollection(); // System.Net.CookieCollection CookieCollection = new System.Net.CookieCollection(); // foreach (string itemlst in CookieDaatalst) // { // try // { // string[] namevalue = Regex.Split(itemlst, "="); // string name = namevalue[0].Replace(" ",""); // string value = namevalue[1].Replace(" ", ""); // string Domain = "linkedin.com"; // System.Net.Cookie cookie = new System.Net.Cookie(); // cookie.Name = name; // cookie.Value = value; // cookie.Domain = Domain; // bool IsFound = false; // try // { // foreach (System.Net.Cookie cokieitem in HttpHelper.gCookies) // { // if (cookie == cokieitem) // { // IsFound = true; // break; // } // } // if (!IsFound) // { // HttpHelper.gCookies.Add(cookie); // } // } // catch { }; // } // catch { }; // } #endregion pageSource = HttpHelper.getHtmlfromUrl(new Uri(url), "https://www.linkedin.com/groups/" + groupId + "", "", ""); string[] arr = Regex.Split(pageSource, ".jpg\",\"name\":"); foreach (var itemArr in arr) { if (itemArr.Contains("{\"data\":[{\"profileUrl\"")) { continue; } string memberName = string.Empty; string memberId = string.Empty; memberName = Utils.getBetween(itemArr, "\"", "\",\""); memberId = Utils.getBetween(itemArr, "id\":\"", "\",\""); GroupName = GroupName.Replace(",", string.Empty); try { if (!memberName.Contains("data\":[{\"")) { GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Added Group Member : " + memberName + " ]"); GroupSpecMem.Add(memberId, " [" + GroupName + " ] " + memberName); } } catch (Exception ex) { Console.Write(ex); } //string name = Utils.getBetween(itemArr, "\"", ",").Replace("\"", ""); //string memberId = Utils.getBetween(itemArr, "nonIterableMemberId\":", ",").Replace("\"", ""); string itemToScrapUrl = "https://www.linkedin.com/profile/view?id=" + memberId + "&authType=name&authToken=2ZLd"; if (!lstitemForScrap.Contains(itemToScrapUrl)) { gotScrapeUrl = true; lstitemForScrap.Add(itemToScrapUrl); } } if (gotScrapeUrl) { //foreach (var itemForScrap in lstitemForScrap) //{ // if (!lstNewMembers.Contains(itemForScrap)) // { // if (!obj_ClsScrapGroupMember.CrawlingLinkedInPage(itemForScrap, ref HttpHelper)) // { // obj_ClsScrapGroupMember.CrawlingPageDataSource(itemForScrap, ref HttpHelper); // } // lstNewMembers.Add(itemForScrap); // } //} startPage = startPage + 10; url = "https://www.linkedin.com/communities-api/v1/memberships/community/" + groupId + "?membershipStatus=MEMBER&start=" + startPage + "&projection=FULL"; gotScrapeUrl = false; if (startPage <= 500) { goto GetItemToScrapeUrls; } } } #endregion } catch (Exception ex) { } return GroupSpecMem; }