Beispiel #1
0
        protected override void ParseImpl()
        {
            try
            {
                var root = HtmlPage.FindElements("table").Last()
                           .FindFirst("td").FindFirst("ul");
                GetPageCount(HtmlPage.FindFirst("body").FindElements("center").ElementAt(1));

                S1ListItem item = null;

                foreach (var e in root.Descendants("li"))
                {
                    item = S1ListItem.GetItem(e);
                    var replys = reply_pattern.Match(e.Element("span").InnerHtml);
                    if (replys.Success)
                    {
                        item.Subtle = replys.Value;
                    }
                    theData.Add(item);
                }
            }
            catch (System.Exception) { }
            finally
            {
                if (theData.Count == 0)
                {
                    S1Parser.User.ErrorParser.Parse(HtmlPage);
                    throw new InvalidDataException();
                }
            }
        }
        protected override void ParseImpl()
        {
            try {
                var body = HtmlPage.FindFirst("body");
                var a    = body.FindFirst("a");
                theData.Title = a.InnerHtml;

                GetReplyLink(body.Element("table"));

                GetPageCount(body.FindElements("center").ElementAt(1));

                theData.Items = new List <S1PostItem>();
                int i = 0;
                foreach (var item in body.Descendants("table"))
                {
                    var threadItem = ParseThreadItem(item);
                    if (threadItem != null)
                    {
                        threadItem.No = (theData.CurrentPage - 1) * SimpleParserFactory.ItemsPerThreadSimple + i++;
                        theData.Items.Add(threadItem);
                    }
                }
            }
            catch (System.Exception) { }
            finally
            {
                if (theData.Items == null || theData.Items.Count == 0)
                {
                    S1Parser.User.ErrorParser.Parse(HtmlPage);
                    throw new InvalidDataException();
                }
            }
        }