I'm trying to get text from another site using C # (HtmlAgilityPack).
I can find the div, but when I try to display the value on the screen, it shows the path of the function.
I think I'm forgetting some code snippet.
Follow my Controller:
public class TesteDeScrapingController : Controller
{
// GET: TesteDeScraping
public ActionResult Index()
{
HtmlWeb web = new HtmlWeb();
HtmlDocument html = web.Load("https://www.climatempo.com.br/previsao-do-tempo/cidade/583/araguaina-to");
var div = html.DocumentNode.SelectNodes("//p[@id='tempMax0']");
ViewBag.Div = div;
return View();
}
}
Follow my HTML:
<h2>Teste</h2>
<div>
@ViewBag.Div
</div>