Created
February 10, 2012 14:40
-
-
Save pinscript/1789954 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * HtmlAgilityPack | |
| */ | |
| using System; | |
| using System.Net; | |
| using HtmlAgilityPack; | |
| public class Program { | |
| public static void Main(string[] args) { | |
| var client = new WebClient(); | |
| var html = client.DownloadString("http://www.dennissangmo.se"); | |
| var doc = new HtmlDocument() { | |
| OptionAddDebuggingAttributes = false, | |
| OptionAutoCloseOnEnd = true, | |
| OptionFixNestedTags = true, | |
| OptionReadEncoding = true | |
| }; | |
| doc.LoadHtml(html); | |
| var titles = doc.DocumentNode.SelectNodes("//h2/a"); | |
| foreach (var title in titles) { | |
| var node = title; | |
| Console.WriteLine("{0}: {1}", node.InnerText, node.Attributes["href"].Value); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment