0

I want to retrieve my Bitcoin mining hashrate from my pool webpage and store it as an int so that I can print it to the console. I tried using the HtmlAgilityPack which never seemed to have worked while using this code:

protected void Page_Load(object sender, EventArgs e)
{
    string Url = "http://www.metacritic.com/game/pc/halo-spartan-assault";
    HtmlWeb web = new HtmlWeb();
    HtmlDocument doc = web.Load(Url);

    string metascore = doc.DocumentNode.SelectNodes("//*[@id=\"main\"]/div[3]/div/div[2]/div[1]/div[1]/div/div/div[2]/a/span[1]")[0].InnerText;
    string userscore = doc.DocumentNode.SelectNodes("//*[@id=\"main\"]/div[3]/div/div[2]/div[1]/div[2]/div[1]/div/div[2]/a/span[1]")[0].InnerText;
    string summary = doc.DocumentNode.SelectNodes("//*[@id=\"main\"]/div[3]/div/div[2]/div[2]/div[1]/ul/li/span[2]/span/span[1]")[0].InnerText;
}

From this Stack Exchange question. This ended up being confusing and I couldn't figure out how to make it return the desired value.

Is there any simpler or more intuitive way of getting this value?

Community
  • 1
  • 1
Philip Becker
  • 21
  • 1
  • 8

0 Answers0