protected override IEnumDataPages <EbookdzForumData> GetDataPage(WebResult webResult) { XXElement xeSource = new XXElement(webResult.Http.zGetXDocument().Root); string url = webResult.WebRequest.HttpRequest.Url; PostHeaderDataPage <EbookdzForumData> data = new PostHeaderDataPage <EbookdzForumData>(); data.SourceUrl = url; data.LoadFromWebDate = webResult.LoadFromWebDate; data.Id = _GetKey(webResult.WebRequest.HttpRequest); data.UrlNextPage = null; List <EbookdzForumData> forums = new List <EbookdzForumData>(); Predicate <string> filter = null; // <div class="body_bd"> // <div id="forumbits" class="forumbits"> // <ol> // <li id="forum10" class="forumbit_post new L1"> // <div class="forumrow"> // <ol id="childforum_for_161" class="childsubforum"> // <div class="titleline"> foreach (XXElement xe in xeSource.XPathElements("//div[@id='forumbits']/ol/li")) { XXElement xe2 = xe.XPathElement(".//div[@class='forumrow']//a"); string category = xe2.XPathValue(".//text()"); string urlCategory = Ebookdz_MainForum.GetUrl(zurl.GetUrl(url, xe2.XPathValue("@href"))); // Forum = forum //forums.Add(new Ebookdz_Forum { Category = category, Url = urlCategory }); foreach (XXElement xe3 in xe.XPathElements(".//ol[@class='childsubforum']/li//div[@class='titleline']//a")) { string name = xe3.XPathValue(".//text()"); if (filter != null && !filter(name)) { continue; } string urlSubForum = Ebookdz_MainForum.GetUrl(zurl.GetUrl(url, xe3.XPathValue("@href"))); // Forum = forum forums.Add(new EbookdzForumData { SourceUrl = url, LoadFromWebDate = webResult.LoadFromWebDate, Category = category, Name = name, UrlDetail = urlSubForum }); } } data.Headers = forums.ToArray(); return(data); }
protected override IEnumDataPages <PostHeader> GetDataPage(WebResult webResult) { XXElement xeSource = new XXElement(webResult.Http.zGetXDocument().Root); string url = webResult.WebRequest.HttpRequest.Url; PostHeaderDataPage <PostHeader> data = new PostHeaderDataPage <PostHeader>(); data.SourceUrl = url; data.LoadFromWebDate = webResult.LoadFromWebDate; data.Id = _GetKey(webResult.WebRequest.HttpRequest); // <div class="threadpagenav"> // <span class="prev_next"> // <a rel="next" href="forumdisplay.php?f=157&page=2&s=fec27f3bac2b58debbb727ab8725c8a4" title="Page suivante - Résultats de 21 à 40 sur 61"> data.UrlNextPage = zurl.GetUrl(url, xeSource.XPathValue("//div[@class='threadpagenav']//span[@class='prev_next']//a[@rel='next']/@href")); List <PostHeader> headers = new List <PostHeader>(); // <div class="body_bd"> // <div id="threadlist" class="threadlist"> // <ol id="threads" class="threads"> // <li class="threadbit " id="thread_111977"> // <h3 class="threadtitle"> // <a title="" class="title" href="showthread.php?t=111977&s=fec27f3bac2b58debbb727ab8725c8a4" id="thread_title_111977">La Provence Marseille du lundi 26 janvier 2015</a> foreach (XXElement xeHeader in xeSource.XPathElements("//div[@id='threadlist']//ol[@id='threads']/li")) { PostHeader header = new PostHeader(); header.SourceUrl = url; header.LoadFromWebDate = webResult.LoadFromWebDate; XXElement xe = xeHeader.XPathElement(".//h3[@class='threadtitle']//a[@class='title']"); header.Title = xe.XPathValue(".//text()"); header.UrlDetail = Ebookdz_MainForum.GetUrl(zurl.GetUrl(url, xe.XPathValue("@href"))); headers.Add(header); } data.Headers = headers.ToArray(); //Trace.WriteLine(data.zToJson()); return(data); }