Exemple #1
0
        public async Task <List <ThreadPost> > ExtractPostsAsync(Uri threadpageurl, ForumUserCollection users)
        {
            Thread.Sleep(200);
            var response = await this.Client.GetAsync(threadpageurl);

            var html = await response.Content.ReadAsStringAsync();

            return(await this.ExtractPostsAsync(html, users));
        }
Exemple #2
0
        public virtual async Task <List <ThreadPost> > ExtractPostsAsync(string threadpagehtml, ForumUserCollection users)
        {
            var searchparser = new SearchPageParser(this.SearchInfo);
            var postparser   = new PostParser(this.PostInfo, searchparser, users);
            var result       = new List <ThreadPost>();

            var doc = new HtmlDocument();

            doc.LoadHtml(threadpagehtml);

            var posts = doc.DocumentNode.SelectNodes(this.ThreadInfo.XpathPosts);

            foreach (var post in posts)
            {
                result.Add(await postparser.ParseAsync(post.OuterHtml));
            }

            return(result);
        }
 public PostParser(IPostInfo info, SearchPageParser userParser, ForumUserCollection users) : base()
 {
     this.Info         = info;
     this.Users        = users;
     this.SearchParser = userParser;
 }