1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
string url = "https://meteo.gc.ca/marine/marine_bulletins_f.html";
HtmlWeb web = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = web.Load(url);
var Element = doc.DocumentNode
.Element("html")
.Element("body")
.Element("main")
.Element("section")
.Element("div");
// / html / body / main / section[1] / div / div[3]
//.Element("div");
//.Element("section");
//.Element("ul");
var Info_Province = Element.SelectSingleNode("(//div[@class='hidden-xs'])[2]");
var test = Info_Province.InnerHtml;
// L_Province_Complet.Add(Info_Province.InnerText);
/*foreach (var province in test)
{
var title = province.Attributes["h2"];
if (title != null)
{
L_Province_Complet.Add(title.Value);
}
}*/
/*var title = province.Attributes["id"];
if (title != null)
{
L_Province_Complet.Add(title.Value);
}*/
/*var href = province.Attributes["href"];
if (href != null)
{
L_Site_Web.Add("https://meteo.gc.ca/" + href.Value);
} |
Partager