20 lines
529 B
C#
20 lines
529 B
C#
using ProSol.WebScrap;
|
|
|
|
var request = "https://en.wikipedia.org/wiki/Food_energy";
|
|
|
|
// Download the html:
|
|
using var client = new HttpClient();
|
|
using var response = await client.GetAsync(request);
|
|
var html = await response.Content.ReadAsStringAsync();
|
|
|
|
// Run the WebScrapper:
|
|
var css = "#firstHeading";
|
|
var result = WebScrapper
|
|
.Run(html, css)
|
|
.ToJsonString();
|
|
|
|
// Get the results:
|
|
Console.WriteLine(result);
|
|
// OUTPUT:
|
|
// [{"key":"#firstHeading","values":[{"value":"Food energy"}]}]
|
|
Console.Read(); |