我想获取具有特定属性的表格的HTML源代码。下面的代码将帮助您了解更多信息。获取具有特定属性的表格的HTML源代码
public static async Task GetCldInfos()
{
string sURL = @"https://www.investing.com/economic-calendar/";
using (HttpClient clientduplicate = new HttpClient())
{
clientduplicate.DefaultRequestHeaders.Add("User-Agent",
"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)");
using (HttpResponseMessage responseduplicate = await clientduplicate.GetAsync(sURL))
using (HttpContent contentduplicate = responseduplicate.Content)
{
try
{
string resultduplicate = await contentduplicate.ReadAsStringAsync();
//var websiteduplicate = new HtmlDocument();
//websiteduplicate.LoadHtml(resultduplicate);
Debug.WriteLine(resultduplicate);
}
catch (Exception ex1)
{
throw ex1.InnerException;
}
}
}
}
当我们访问here时,我们可以选择设置时间范围。 我们选择的时间表会相应地修改表格。 当我做一个http请求来获取源码时,它会自动给我格林威治标准时间GMT -5:00。
我怎样才能得到源例如格林威治标准时间0:00?
正如我告诉你前一个问题中,敏捷性包不能运行JavaScript和除了HTTP单一调用HTML返回的默认值之外,没有办法获取任何数据。为了做到这一点,你需要一个无头浏览器或'WebView',就像我们在上一个答案中使用的那样。考虑使用* Awesomium *(http://www.awesomium.com/)。它是免费的,并且有一些用于无头浏览的好用工具,就像一个'WebView'独立类。 –