Reputation: 5
I'm trying to gather the data from this website: http://services.runescape.com/m=hiscore_oldschool/index_lite.ws?player=f2pshrympy
using HtmlAgilityPack;
using System;
var webGet = new HtmlWeb();
var document = webGet.Load("http://services.runescape.com/m=hiscore_oldschool/index_lite.ws?player=f2pshrympy");
var bodyText = document.DocumentNode.SelectNodes("/html/body/text()");
Console.WriteLine(bodyText);
Console.ReadLine();
When the program is run nothing is printed to the console and there are no errors.
I'm guessing that nothing is being found with the XPath "/html/body/text()", any ideas how I can go around fixing this?
Upvotes: 0
Views: 140
Reputation: 12546
Your page is pure text. So you don't need any tool like HtmlAgilityPack to parse it. Just download it and use it.
using (var wc = new WebClient())
{
var bodyText = wc.DownloadString("http://services.runescape.com/m=hiscore_oldschool/index_lite.ws?player=f2pshrympy");
}
Upvotes: 1