Skip to content

Instantly share code, notes, and snippets.

@vainolo
Last active February 23, 2021 22:43
Show Gist options
  • Save vainolo/1d487a1deacf4c8262e146b5cba60831 to your computer and use it in GitHub Desktop.
Save vainolo/1d487a1deacf4c8262e146b5cba60831 to your computer and use it in GitHub Desktop.
public static void Scrape()
{
var scraper = new HtmlWeb();
var page = scraper.Load("https://vainolo.z14.web.core.windows.net/WebScraping.html");
var nodes = page.DocumentNode.Descendants().SkipWhile(e => e.Id != "Techniques").Skip(1).TakeWhile(e => e.Name != "h2");
foreach (var currNode in nodes)
{
if(currNode.GetClasses().Contains("mw-headline"))
{
var headline = currNode.InnerText;
Console.WriteLine(headline);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment