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 void ParsingOfInBoardProGetDataMultipleInput(ref GlobusHttpHelper HttpHelper, string username, string password, string proxyaddress, string proxyport, string proxyUserName, string proxypassword, string postalcode, string distance, string industry, string lastname) { 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 UserName = string.Empty; List<String> LstUrlrecords = new List<string>(); LastName = lastname; Industry = industry; UserName = username; this.accountUser = username; this.accountPass = password; this.proxyAddress = proxyaddress; this.proxyPort = proxyport; this.proxyUserName = proxyUserName; this.proxyPassword = proxypassword; this.postalCode = postalcode; this.distance = distance; this.industryType = industry; this.lastName = lastname; string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top")); try { string[] Arr_Pst = Regex.Split(postalCode, "{"); try { Postalcode = postalCode.Substring(0, postalCode.IndexOf(" ")); Country = postalCode.Replace(Postalcode, string.Empty).Replace(")", string.Empty).Replace("(", string.Empty).Trim(); } catch { if (Postalcode == "") { Postalcode = postalCode; } Country = postalCode.Replace(Postalcode, string.Empty).Replace(")", string.Empty).Replace("(", string.Empty).Trim(); } } 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) { 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"; } try { string FirstPostUrl = "http://www.linkedin.com/search/fpsearch"; string FirstPostData = "csrfToken=" + csrfToken + "&keepFacets=true&pplSearchOrigin=ADVS&keywords=&fname=" + FirstName + "&lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycode + "&postalCode=" + Postalcode + "&distance=" + distance + "&title=" + Title + "&company=" + Company + "&school=" + school + "&facet_I=" + industrycode + "&N=&L=&sortCriteria=R&viewCriteria=2&%2Fsearch%2Ffpsearch=Search"; Firstresponse = HttpHelper.postFormData(new Uri(FirstPostUrl), FirstPostData); } catch { } 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(Firstresponse); } catch { } try { LstUrlrecords = ScarppLinkedinDataByPageNumber(RecordCount, ref HttpHelper, Firstresponse, industrycode, Postalcode, countrycode); LstUrlrecords = LstUrlrecords.Distinct().ToList(); } catch { } List<string> lstshorturl = new List<string>(); foreach (string itemurl in LstUrlrecords) { try { lstshorturl.Add(itemurl); } catch { } } lstshorturl = lstshorturl.Distinct().ToList(); LinkedinScrappDbManager objLsManager = new LinkedinScrappDbManager(); int count = 1; foreach (string LinkUrl in LstUrlrecords) { try { //string[] LinkUrll=Regex.Split(LinkUrl, "&authType"); objLsManager.InsertIntoLinkedInSearchUrlResult(postalCode, distance, industryType, lastName, accountUser, accountPass, proxyAddress, proxyPassword, RecordCount, LinkUrl); Log("[ " + DateTime.Now + " ] => [ " + count + "Url Record Insert In Table ! ]"); count++; } catch { } } foreach (string LinkUrlParse in LstUrlrecords) { lock (locker_pauseDialog) { try { CrawlingLinkedInPage(LinkUrlParse, ref HttpHelper); objLsManager.Updatetb_LinkedinSearchUrlResult(postalCode, distance, industryType, lastName, accountUser, accountPass, proxyAddress, proxyPassword, RecordCount, LinkUrlParse); counterforpause++; if (counterforpause <= processNumber) { } else { if (autopause) { DialogResult dlgResult = MessageBox.Show("Do you want to continue?", "Continue?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dlgResult == DialogResult.Yes) { foreach (Thread itempause in lstNumberOfThreads) { try { itempause.Resume(); } catch { } } Log("[ " + DateTime.Now + " ] => [ PROCESS START ]"); counterforpause = 1; } else if (dlgResult == DialogResult.No) { { foreach (Thread item in lstNumberOfThreads) { try { item.Abort(); } catch { } } Log("[ " + DateTime.Now + " ] => [ PROCESS STOP ]"); counterforpause = 1; } } } if (autopauseandresume) { try { try { int delayInSeconds = RandomNumberGenerator.GenerateRandom(Mindelay * 1000, Maxdelay * 1000); Log("[ " + DateTime.Now + " ] => [ Delaying for " + delayInSeconds / 1000 + " Seconds ]"); Thread.Sleep(delayInSeconds); } catch { } counterforpause = 1; } catch { } } } } catch { } } } } catch { } finally { Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETE ]"); } }
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 void GetRecords(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(); //Postalcode = Arr_Pst[0].Replace(" ", string.Empty).Trim(); //Country = Arr_Pst[1].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) { } //FirstGetRequestUrl = "http://www.linkedin.com/vsearch/p?lastName=" + lastName + "&postalCode=" + postalCode + "&openAdvancedForm=true&locationType=I&countryCode=" + countrycode + "&distance=" + distance + "&facet_I=" + industrycode + "&sortBy=R&rsid=" + rsid + "&orig=MDYS"; // http://www.linkedin.com/vsearch/p?lastName=James&postalCode=44101&openAdvancedForm=true&locationType=I&countryCode=us&distance=50&f_N=F,S,A&rsid=2247217581372762829704&orig=MDYS"; //http://www.linkedin.com/vsearch/p?lastName=" + lastName + "&postalCode=" + postalCode + "&openAdvancedForm=true&locationType=I&countryCode=" + countrycode + "&distance=" + distance + "&facet_I=" + industrycode + "&sortBy=R&rsid=" + rsid + "&orig=MDYS"; 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); Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Postal Code : " + postalCode.ToString() + " Distance : " + distance + " Industry : " + industrycode + " ]"); } 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 { } string CSVHeader = "PostalCode" + "," + "Distance" + "," + "IndustryType" + "," + "LastName" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd " + "," + "Number Of Result"; // + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedinLogInID" + ","; string CSV_Content = postalCode.Replace(",", ";") + "," + distance.Replace(",", ";") + "," + industryType.Replace(",", ";") + "," + lastName.Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";") + "," + RecordCount.ToString().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(",", ";") + "," + accountUser + ",";// +TypeOfProfile + ","; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCount); } catch { } } catch { } }
public void GetRecords(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(); //Postalcode = Arr_Pst[0].Replace(" ", string.Empty).Trim(); //Country = Arr_Pst[1].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) { } //FirstGetRequestUrl = "http://www.linkedin.com/vsearch/p?lastName=" + lastName + "&postalCode=" + postalCode + "&openAdvancedForm=true&locationType=I&countryCode=" + countrycode + "&distance=" + distance + "&facet_I=" + industrycode + "&sortBy=R&rsid=" + rsid + "&orig=MDYS"; // http://www.linkedin.com/vsearch/p?lastName=James&postalCode=44101&openAdvancedForm=true&locationType=I&countryCode=us&distance=50&f_N=F,S,A&rsid=2247217581372762829704&orig=MDYS"; //http://www.linkedin.com/vsearch/p?lastName=" + lastName + "&postalCode=" + postalCode + "&openAdvancedForm=true&locationType=I&countryCode=" + countrycode + "&distance=" + distance + "&facet_I=" + industrycode + "&sortBy=R&rsid=" + rsid + "&orig=MDYS"; 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); Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Postal Code : " + postalCode.ToString() + " Distance : " + distance + " Industry : " + industrycode + " ]"); } 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 { } string CSVHeader = "PostalCode" + "," + "Distance" + "," + "IndustryType" + "," + "LastName" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd " + "," + "Number Of Result";// + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedinLogInID" + ","; string CSV_Content = postalCode.Replace(",", ";") + "," + distance.Replace(",", ";") + "," + industryType.Replace(",", ";") + "," + lastName.Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";") + "," + RecordCount.ToString().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(",", ";") + "," + accountUser + ",";// +TypeOfProfile + ","; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCount); } catch { } } catch { } }