Hi nbrege,
Here is something to get you started..
Lee
Here is something to get you started..
public string GetHtml(string url){
WebRequest wr2 = WebRequest.Create(Url);
wr2.Method = "GET";
((HttpWebRequest)wr2).UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17";
HttpWebResponse wrr = (HttpWebResponse)wr2.GetResponse();
Stream s = wrr.GetResponseStream();
HTMLReader sr = new HTMLReader(s, wrr);
string html = sr.ReadToEnd();
return html;
}
public void Start(){
string url = string.Format("http://sports.yahoo.com/nhl/stats/byposition?pos=C%2CRW%2CLW%2CD&sort=14&conference=NHL&year=season_2012");
HtmlDocument hd = new AP.HtmlDocument();
string test = GetHtml(url);
hd.LoadHtml(test);
HtmlNodeCollection nodes = hd.DocumentNode.SelectNodes("//tr[contains(@class,\"ysprow\")]");
foreach (HtmlNode node in nodes)
{
string name = node.SelectSingleNode("./td[position() = 1]/a").InnerText;
string team = node.SelectSingleNode("./td[position() = 2]/a").InnerText;
string gp = node.SelectSingleNode("./td[position() = 3]").InnerText;
}
}
this should work for you.Lee