在C#中从web获取HTML字符串,但不包含数据部分
我正在尝试从我的UWP应用程序中的网页()获取数据。在C#中从web获取HTML字符串,但不包含数据部分,c#,html,parsing,uwp,web-crawler,C#,Html,Parsing,Uwp,Web Crawler,我正在尝试从我的UWP应用程序中的网页()获取数据。 我在我的项目中编写了以下源代码 public class MainPageViewModel : Observable { public string urlAddress = "https://finance.naver.com/sise/sise_trans_style.nhn"; public string data { get; set; } public MainPageViewModel() {
我在我的项目中编写了以下源代码
public class MainPageViewModel : Observable
{
public string urlAddress = "https://finance.naver.com/sise/sise_trans_style.nhn";
public string data { get; set; }
public MainPageViewModel()
{
ButtonClick = new RelayCommand(Click);
}
public async void Click()
{
HttpClient httpClient = new HttpClient();
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
var result = await httpClient.GetStringAsync(new Uri(urlAddress));
data = result;
OnPropertyChanged("data");
}
public RelayCommand ButtonClick { get; set; }
}
但是,问题是,我没有得到文档的数据部分。下图描述了我想要获取的部分文档。在“数据”变量中,我得到了没有数据的文档,这是我最重要的部分。我只能得到其他html部分 我试图找出数据来自哪里,或者哪个来源帮助我获取数据。但我失败了。
数据是由javascript生成的吗。。AJAX还有,我如何从该网页获取数据。。如果我下次遇到这种问题,我怎么才能找出原因呢 (编辑)添加了HTML源代码。而且更具体。 当我看到HTML文档与我的源代码,我可以得到以下内容
<div class="box_type_m">
<iframe name="time" src="/sise/investorDealTrendTime.nhn?bizdate=20181005&sosok=" width="100%" height="380" marginheight="0" bottommargin="0" topmargin="0" SCROLLING="no" frameborder="0" title="시간별 순매수"></iframe>
</div>
但是iframe还有另一个html源(包括头部和身体)。您需要的数据在iframe中。这些将作为页面中的页面加载。您可以在源代码中看到这一点 您应该签出的实际URL是: