我需要来自另一个Hadoop API URL的数据。 但是我只能得到没有数据的HTML源代码。 我正在使用下面的代码。
using (var client = new WebClient()) { String downloadedString = client.DownloadString("http:........"); }实际结果:
<tr><th> Configured Capacity:</th><td> *{Total|fmt_bytes}* </td></tr>期望
<tr><th> Configured Capacity:</th><td> 55 </td></tr>我需要55我的C#代码。
我的期望可能吗? 如果是这样,请指导我。
I need data from another Hadoop API URL. But I only get the HTML source code without the data. I am using the following code.
using (var client = new WebClient()) { String downloadedString = client.DownloadString("http:........"); }Actual Result:
<tr><th> Configured Capacity:</th><td> *{Total|fmt_bytes}* </td></tr>Expectation
<tr><th> Configured Capacity:</th><td> 55 </td></tr>I need 55 in my c# code.
Is my expectation possible? If so, please guide me.
最满意答案
您看到的问题是您的C#客户端不运行Javascript,这是从Hadoop网络服务器将该值加载到占位符{Total|fmt_bytes}
也可以用cURL显示
$ curl -s http://hadoop-nn1:50070/dfshealth.html#tab-overview | grep Configured <tr><th> Configured Capacity:</th><td>{Total|fmt_bytes}</td></tr> <th>Configured Capacity</th>所以这不是Hadoop问题。 这是你的WebClient ...你需要使用Selenum WebDriver或PhantomJS。
The issue you are seeing is that your C# client does not run Javascript, which is what is loading that value from the Hadoop webserver into the placeholder of {Total|fmt_bytes}
Also showable with cURL
$ curl -s http://hadoop-nn1:50070/dfshealth.html#tab-overview | grep Configured <tr><th> Configured Capacity:</th><td>{Total|fmt_bytes}</td></tr> <th>Configured Capacity</th>So this is not a Hadoop problem. It's your WebClient... You need to use something like Selenum WebDriver or PhantomJS instead.
更多推荐
发布评论