Skip to content

Instantly share code, notes, and snippets.

@rvvvt
Forked from vainolo/Method2.cs
Created February 23, 2021 22:43
Show Gist options
  • Save rvvvt/333e4a67c2324db90edd83bf48a43aae to your computer and use it in GitHub Desktop.
Save rvvvt/333e4a67c2324db90edd83bf48a43aae 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