Reputation: 551
I am actually trying to parse the content of this webpage, http://www.cryptocoincharts.info/v2/coins/show/tips
In particular I'd need to get the numbers, like "Current Difficulty", "Mined coins till now" etc
I am not actually sure how to do that, I actually located the section where my numbers are, yet I am not able to write the code to actually get those numbers out :(
Thanks in advance for any help!
EDIT: This is the code I have so far:
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string htmlPage = "";
using (var client = new HttpClient())
{
try
{
htmlPage = await client.GetStringAsync("http://www.cryptocoincharts.info/v2/coins/show/tips");
}
catch (HttpRequestException exc) { }
}
HtmlDocument htmlDocument = new HtmlDocument();
htmlDocument.LoadHtml(htmlPage);
Upvotes: 0
Views: 1737
Reputation: 35363
HttpClient client = new HttpClient();
var doc = new HtmlAgilityPack.HtmlDocument();
var html = await client.GetStringAsync("http://www.cryptocoincharts.info/v2/coins/show/tips");
doc.LoadHtml(html);
var result = doc.DocumentNode.SelectSingleNode("//table[@class='table table-striped']")
.Descendants("tr")
.Skip(1)
.Select(tr => new
{
Desc = tr.SelectSingleNode("td[1]").InnerText,
Val = WebUtility.HtmlDecode(tr.SelectSingleNode("td[2]").InnerText)
})
.ToList();
Upvotes: 2