本文整理汇总了C#中GlobusHttpHelper.getHtmlfromUrl1方法的典型用法代码示例。如果您正苦于以下问题:C# GlobusHttpHelper.getHtmlfromUrl1方法的具体用法?C# GlobusHttpHelper.getHtmlfromUrl1怎么用?C# GlobusHttpHelper.getHtmlfromUrl1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlobusHttpHelper
的用法示例。
在下文中一共展示了GlobusHttpHelper.getHtmlfromUrl1方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Pagination
public void Pagination(ref GlobusHttpHelper objHttpHelper, string mainUrl)
{
int PageCunt = 1;
try
{
string totalResults = string.Empty;
bool dispTotalResults = true;
string mainPageResponse = string.Empty;
int paginationCounter = 0;
do
{
//mainUrl = mainUrl.Replace("replaceVariableCounter", paginationCounter.ToString());
//if (SalesNavigatorGlobals.isStop)
//{
// return;
//}
///string hoMEuRL = "https://www.linkedin.com/sales/search/?facet=N&facet.N=O&facet=G&facet.G=in:7350&facet=I&facet.I=96&facet=FA&facet.FA=12&defaultSelection=false&start=0&count=10&searchHistoryId=1540160093&keywords=ITIL&trk=lss-search-tab";
// string Url = mainUrl.Replace("replaceVariableCounter", paginationCounter.ToString());
mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl));
if (string.IsNullOrEmpty(mainPageResponse))
{
mainPageResponse = objHttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/sales/?trk=nav_responsive_sub_nav_upgrade"));
mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl));
}
//if (mainPageResponse.Contains("We'll be back soon.")&&(mainPageResponse.Contains("We're getting things cleaned up.")))
//{
// string unwatedStr = "https://www.linkedin.com/sales/search/?facet=N&facet.N=O&facet=G&facet.G=in:7350&facet=I&facet.I=96&facet=FA&facet.FA=12&defaultSelection=false&start=0&count=10&searchHistoryId=1540160093&keywords="+""+"&trk=lss-search-tab";// "&countryCode=" + Utils.getBetween(mainUrl, "&countryCode=", "&");
// mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl.Replace(unwatedStr, paginationCounter.ToString())));
//}
if (string.IsNullOrEmpty(mainPageResponse))
{
if (string.IsNullOrEmpty(mainPageResponse))
{
//MessageBox.Show("Null response from internet. Please check your internet connection and restart the software.");
GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ No response from internet. Please check your internet connection. ] ");
}
Thread.Sleep(2000);
mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl.Replace("replaceVariableCounter", paginationCounter.ToString())));
}
try
{
if (dispTotalResults)
{
totalResults = Utils.getBetween(mainPageResponse, "\"total\":", ",\"").Trim();
GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total results found : " + totalResults + " ]");
GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Scraping profile Url ]");
dispTotalResults = false;
}
}
catch
{ }
int checkCountUrls = 0;
string[] profileUrl_Split = Regex.Split(mainPageResponse, "\"profileUrl\"");
List<string> ProfileList = new List<string>();
foreach (string profileUrlItem in profileUrl_Split)
{
if (!profileUrlItem.Contains("<!DOCTYPE"))
{
checkCountUrls++;
string profileUrl = Utils.getBetween(profileUrlItem, ":\"", "\",\"");
lstProfileUrls.Add(profileUrl);
GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Scraped Url : " + profileUrl + " ] ");
ProfileList.Add(profileUrl);
}
}
Thread.Sleep(1000);
ScrapeProfileDetails(ref objHttpHelper, ProfileList);
int startindex = paginationCounter;
paginationCounter = paginationCounter + 100;
mainUrl = CreatePaginationUrl(mainUrl, startindex, paginationCounter);
} while (mainPageResponse.Contains("\"profileUrl\":\""));
}
catch (Exception ex)
{
}
}
示例2: Connect
private void Connect(ref GlobusHttpHelper httpHelper, string profileURL)
{
try
{
Log("[ " + DateTime.Now + " ] => [ Start Sending Connect With Username >>> " + _UserName + " ]");
string key = string.Empty;
string firstName_Guest = string.Empty;
string lastName_Guest = string.Empty;
string authToken = string.Empty;
string goback = string.Empty;
string fullName = string.Empty;
string pageSource = httpHelper.getHtmlfromUrl1(new Uri(profileURL));
//if (!pageSource.Contains("\"i18n__Connect\":\"Connect\",\"deferImg\":true"))
//{
// Log("[ " + DateTime.Now + " ] => [ You can not send invitation to profile url >>> " + profileURL + " with username >>> " + _UserName + " ]");
// return;
//}
if (string.IsNullOrEmpty(pageSource))
{
Thread.Sleep(1 * 1000);
pageSource = httpHelper.getHtmlfromUrl1(new Uri(profileURL));
}
if (string.IsNullOrEmpty(pageSource))
{
Log("[ " + DateTime.Now + " ] => [ Page Source Is Null ! ]");
Log("[ " + DateTime.Now + " ] => [ Process Completed With Username >>> " + _UserName + " ]");
return;
}
if (pageSource.Contains("memberId:"))
{
key = pageSource.Substring(pageSource.IndexOf("memberId:"), pageSource.IndexOf("</script>", pageSource.IndexOf("memberId:")) - pageSource.IndexOf("memberId:")).Replace("memberId:", string.Empty).Replace("\"", string.Empty).Replace("};", string.Empty).Trim();
}
if (pageSource.Contains("snapshotID=&authToken="))
{
authToken = pageSource.Substring(pageSource.IndexOf("snapshotID=&authToken=") + 22, pageSource.IndexOf("&", (pageSource.IndexOf("snapshotID=&authToken=") + 22)) - (pageSource.IndexOf("snapshotID=&authToken=") + 22)).Replace("snapshotID=&authToken=", string.Empty).Replace("\"", string.Empty).Trim();
}
if (String.IsNullOrEmpty(authToken) && pageSource.Contains("authToken="))
{
authToken = pageSource.Substring(pageSource.IndexOf("authToken="), pageSource.IndexOf(",", (pageSource.IndexOf("authToken="))) - (pageSource.IndexOf("authToken="))).Replace("authToken=", string.Empty).Replace("\"", string.Empty).Trim();
if (authToken.Contains("authType"))
{
try
{
authToken = authToken.Split('&')[0];
}
catch { }
}
if (authToken.Contains("&"))
{
try
{
authToken = authToken.Split('&')[0];
}
catch { }
}
}
if (pageSource.Contains("goback="))
{
goback = pageSource.Substring(pageSource.IndexOf("goback="), pageSource.IndexOf("\"", pageSource.IndexOf("goback=")) - pageSource.IndexOf("goback=")).Replace("goback=", string.Empty).Replace("\"", string.Empty).Trim();
}
if (string.IsNullOrEmpty(goback))
{
string[] gobck = Regex.Split(pageSource, "&goback=");
int startindex = gobck[2].IndexOf("");
string start = gobck[2].Substring(startindex);
int endindex = start.IndexOf(",");
string end = start.Substring(0, endindex).Replace("\"",string.Empty);
goback = end.Trim();
}
if (pageSource.Contains("class=\"full-name\""))
{
fullName = pageSource.Substring(pageSource.IndexOf("class=\"full-name\""), pageSource.IndexOf("<", pageSource.IndexOf("class=\"full-name\"")) - pageSource.IndexOf("class=\"full-name\"")).Replace("class=\"full-name\"", string.Empty).Replace("\"", string.Empty).Replace("dir=auto>", string.Empty).Trim();
}
if (string.IsNullOrEmpty(fullName))
{
try
{
int startindex = pageSource.IndexOf("<span class=\"full-name\">");
string start = pageSource.Substring(startindex).Replace("<span class=\"full-name\">", string.Empty);
int endindex = start.IndexOf("</span>");
string end = start.Substring(0, endindex).Replace("</span>", string.Empty);
fullName = end.Trim();
}
//.........这里部分代码省略.........
示例3: StartAcceptInvitations
public void StartAcceptInvitations(ref GlobusHttpHelper httpHelper)
{
try
{
string csrfToken = string.Empty;
string userFirstName = string.Empty;
string UserLastName = string.Empty;
string SenderName = string.Empty;
string newPagesource = string.Empty;
bool isTrue = false;
int startRow = 1;
string pageSource = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/inbox/invitations/pending"));
var resultForUserDetails = FindTheUserName(pageSource);
try
{
resultForUserDetails = resultForUserDetails.Substring(resultForUserDetails.IndexOf("alt="), resultForUserDetails.IndexOf("height") - resultForUserDetails.IndexOf("alt=")).Replace("alt=", string.Empty).Replace("/", string.Empty).Trim();
userFirstName = resultForUserDetails.Split(' ')[0].Replace("\"", string.Empty);
UserLastName = resultForUserDetails.Split(' ')[1].Replace("\"", string.Empty);
}
catch { }
if (pageSource.Contains("csrfToken"))
{
csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 100);
string[] Arr = csrfToken.Split('"');
try
{
foreach (string item in Arr)
{
try
{
if (item.Contains("csrfToken="))
{
csrfToken = item.Substring(item.IndexOf("csrfToken="), item.IndexOf("&", item.IndexOf("csrfToken=")) - item.IndexOf("csrfToken=")).Replace("csrfToken=", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim();//Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty);
break;
}
}
catch (Exception ex)
{
}
if (item.Contains("csrfToken="))
{
csrfToken = item.Replace("csrfToken=", string.Empty).Trim();
break;
}
}
}
catch (Exception ex)
{
//csrfToken = Arr[0].Replace("csrfToken=", "").Replace("\\", "");
}
}
// For Show More
//string postData1 = "pkey=inbox-invitations-pending&tcode=%5Bobject%20Arguments%5D&plist=";
//string response1 = httpHelper.postFormData(new Uri("http://www.linkedin.com/lite/web-action-track?csrfToken="+csrfToken+""),postData1);
//string pageSource2=httpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/inbox/invitations/pending/more?sinceDate=1366351490125&startRow=6&count=20&showBlocked=false&ctx=inbox&rnd=1366353236172"));
//*** Conver HTML to XML *******************************//
#region Convert HTML to XML
ChilkatHttpHelpr objhelper = new ChilkatHttpHelpr();
//xHtml contain xml data
string xHtml = objhelper.ConvertHtmlToXml(pageSource);
Chilkat.Xml xml = new Chilkat.Xml();
xml.LoadXml(xHtml);
//xHtml.
//// Iterate over all h1 tags:
Chilkat.Xml xNode = default(Chilkat.Xml);
Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml);
#endregion
#region Invitatin count
xBeginSearchAfter = null;
xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "invitation-count count ");
try
{
while ((xNode != null))
{
string strvalue = xNode.AccumulateTagContent("text", "script|style");
string Invitatincount = strvalue;
Log("[ " + DateTime.Now + " ] => [ Invitation Count = " + Invitatincount + " UserName = " + _UserName + " ]");
Log("-----------------------------------------------------------------------------------------------------------------------------------");
break;
}
}
catch (Exception ex)
{
}
#endregion
//.........这里部分代码省略.........
示例4: FromName
public string FromName(ref GlobusHttpHelper HttpHelper)
{
string FromNm = string.Empty;
try
{
string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/edit?trk=nav_responsive_sub_nav_edit_profile"));
string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "fmt_full_display_name");
foreach (var fromname in RgxGroupData)
{
if (fromname.Contains("\":\""))
{
try
{
if (!(fromname.Contains("<!DOCTYPE html>")))
{
try
{
int StartIndex = fromname.IndexOf("\":\"");
string start = fromname.Substring(StartIndex);
int endIndex = start.IndexOf("i18n_optional_not_pinyin");
FromNm = start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("\":\"", string.Empty);
FromNm = FromNm.Split(',')[0].Replace(":", string.Empty).Replace("\\u002d", "-");
}
catch
{ }
try
{
if (string.IsNullOrEmpty(FromNm) || FromNm.Contains("LastName"))
{
int StartIndex = fromname.IndexOf("\":\"");
string start = fromname.Substring(StartIndex);
int endIndex = start.IndexOf(",");
FromNm = start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("\":\"", string.Empty);
FromNm = FromNm.Split(',')[0].Replace(":", string.Empty);
}
}
catch
{ }
}
}
catch { }
}
}
return FromNm;
}
catch (Exception ex)
{
//return FromNm;
}
return FromNm;
}
示例5: FromEmailCodeComposeMsg
public string FromEmailCodeComposeMsg(ref GlobusHttpHelper HttpHelper, string email)
{
string FromId = string.Empty;
//string FromNm = string.Empty;
string namewithid = string.Empty;
string pageSource = string.Empty;
string[] RgxGroupData = new string[] { };
if (string.IsNullOrEmpty(namewithid))
{
try
{
pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/inbox/compose?trk=inbox_messages-comm-left_nav-compose"));
RgxGroupData = Regex.Split(pageSource, "\"name\":\"senderEmail\"");
try
{
if (RgxGroupData[1].Contains("\"value\":"))
{
try
{
int StartIndex = RgxGroupData[1].IndexOf("\"value\":");
string start = RgxGroupData[1].Substring(StartIndex);
int endIndex = start.IndexOf(",");
FromId = start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("value:", string.Empty).Replace("}", string.Empty).Trim();
}
catch
{
}
}
//namewithid = FromId + ":" + FromNm;
namewithid = FromId;
}
catch { }
}
catch (Exception ex)
{
return namewithid;
}
}
return namewithid;
}
示例6: GetEmployeeDataFromCompanyURL
private void GetEmployeeDataFromCompanyURL(ref GlobusHttpHelper HttpHelper, List<string> lstCompanyUrls)
{
try
{
if (!GlobalsScraper.isSearchByCompanyNamesToGetEmailId)
{
foreach (string item in lstCompanyUrls)
{
try
{
GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Starting Parsing With UserName : " + SearchCriteria.LoginID + " ]");
//Log("Url >>> " + item);
string compCode = Regex.Split(item, "company/")[1];
compCode = compCode.Split('?')[0];
string EmployeeUrl = "https://www.linkedin.com/vsearch/p?keywords=" + SearchCriteria.Keyword + "&openAdvancedForm=true&locationType=" + SearchCriteria.Country + "&countryCode=" + SearchCriteria.Country + "&f_CC=" + compCode + "&rsid=&orig=ADVS";
string LinkPagesourceCompEmp = HttpHelper.getHtmlfromUrl1(new Uri(EmployeeUrl));
try
{
int pagenumber = 0;
string strPageNumber = string.Empty;
string[] Arr12 = Regex.Split(LinkPagesourceCompEmp, "<p class=\"summary\">");
if (Arr12.Count() == 1)
{
Arr12 = Regex.Split(LinkPagesourceCompEmp, "formattedResultCount");
}
foreach (string item1 in Arr12)
{
try
{
if (!item1.Contains("<!DOCTYPE"))
{
if (item1.Contains("<strong>"))
{
try
{
//":"15,439","i18n_survey_feedback_thanks":
string pageNO = Regex.Split(item1, "i18n_survey")[0].Replace(":", string.Empty).Replace(",", string.Empty).Replace("\"", string.Empty);
string[] arrPageNO = Regex.Split(pageNO, "[^0-9]");
foreach (string item2 in arrPageNO)
{
try
{
if (!string.IsNullOrEmpty(item2))
{
strPageNumber = item2;
}
}
catch
{
}
}
}
catch
{
}
}
}
}
catch
{
}
}
try
{
strPageNumber = strPageNumber.Replace(".", string.Empty);
if (strPageNumber != string.Empty || strPageNumber == "0")
{
GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total Results found: " + strPageNumber + " ]");
}
pagenumber = int.Parse(strPageNumber);
}
catch (Exception)
{
}
pagenumber = (pagenumber / 10) + 1;
LinkedInScraper obj_LinkedInScraper = new LinkedInScraper();
EmployeeUrl = EmployeeUrl + "##CompanyEmployeeScraper";
obj_LinkedInScraper.StartCompanyEmployeeScraperWithPagination(ref HttpHelper, EmployeeUrl, pagenumber);
}
catch
{ }
}
catch
{ }
}
//.........这里部分代码省略.........