Reputation:
I am a newbie trying to learn the basics on retrieving data from website using C# for universal windows applications. I am having trouble.
For instance, I tried the following code:
HtmlWeb web = new HtmlWeb();
HtmlDocument doc = await web.LoadFromWebAsync("https://uspdigital.usp.br/rucard/Jsp/cardapioSAS.jsp?codrtn=6");
var a = doc.GetElementbyId("almocoSegunda").innertext;
The problem is "a" received a null value. I think that html agility pack is not working for this webpage because I noticed it's not downloading the text in the tables.
What should I do?
Upvotes: 1
Views: 1892
Reputation: 1318
The easiest way to do this is to use the HttpClient class. Here's an example of using HttpClient. After you download the page with GetStringAsync()
, you can parse it with HtmlAgilityPack's HtmlDocument.LoadHtml()
method.
Upvotes: 0