Esempio n. 1
0
        private Discussion GetDiscussion(IE ie, string url)
        {
            var disc = new Discussion();

            ie.GoTo(url);
            ie.WaitForComplete();

            var hDiv = ie.Div(Find.ByClass("ViewThread"));
            var h    = hDiv.Elements.First();

            disc.Title = h.InnerHtml.Replace("\n", "").Trim();

            var tDiv = ie.Div(Find.ByClass("Posts"));

            foreach (var tr in tDiv.TableRows)
            {
                if (tr.Id == "PostPanel")
                {
                    var p       = new Post();
                    var details = tr.TableCells[0];
                    p.From = details.Div(Find.ByClass("UserName")).Elements.First().InnerHtml;
                    p.When = details.Span(Find.ByClass("smartDate")).Title;
                    var content = tr.TableCells[1];
                    p.Html = content.InnerHtml;
                    disc.Posts.Add(p);
                }
            }

            return(disc);
        }