Example #1
0
        //private static Ebookdz_HeaderPage GetData(WebResult webResult)
        private static IEnumDataPages <IHeaderData> GetData(WebResult webResult)
        {
            XXElement             xeSource = new XXElement(webResult.Http.zGetXDocument().Root);
            string                url      = webResult.WebRequest.HttpRequest.Url;
            Ebookdz_HeaderPage_v2 data     = new Ebookdz_HeaderPage_v2();

            data.SourceUrl       = url;
            data.LoadFromWebDate = webResult.LoadFromWebDate;
            data.Id = GetPageKey(webResult.WebRequest.HttpRequest);

            //data.UrlNextPage = zurl.GetUrl(url, xeSource.XPathValue("//div[@class='basenavi']//span[@class='nnext']//a/@href"));
            data.UrlNextPage = null;

            // <div id="vba_news4">
            IEnumerable <XXElement>   xeHeaders = xeSource.XPathElements("//div[@id='vba_news4']//div[@class='collapse']");
            List <Ebookdz_PostHeader> headers   = new List <Ebookdz_PostHeader>();

            foreach (XXElement xeHeader in xeHeaders)
            {
                Ebookdz_PostHeader header = new Ebookdz_PostHeader();
                header.SourceUrl       = url;
                header.LoadFromWebDate = webResult.LoadFromWebDate;

                //XXElement xe = xeHeader.XPathElement(".//h2[@class='blockhead']//a[@class!='mcbadge mcbadge_r']");
                XXElement xe = xeHeader.XPathElement(".//h2[@class='blockhead']//a[2]");
                header.Title     = xe.XPathValue(".//text()");
                header.UrlDetail = xe.XPathValue("./@href");

                //header.images = xeHeader.XPathImages(xeImg => new UrlImage(zurl.GetUrl(url, xeImg.zAttribValue("src")))).ToList();

                //XXElement xe = xeHeader.XPathElement(".//*[@class='shd']//a");
                //header.urlDetail = zurl.GetUrl(url, xe.XPathValue("@href"));
                //header.title = RapideDdl.ExtractTextValues(header.infos, xe.XPathValue(".//text()", RapideDdl.TrimFunc1));

                //xe = xeHeader.XPathElement(".//div[@class='shdinfo']");
                //header.postAuthor = xe.XPathValue(".//span[@class='arg']//a//text()");
                //// Aujourd'hui, 17:13
                //header.creationDate = RapideDdl.ParseDateTime(xe.XPathValue(".//span[@class='date']//text()"), loadDataFromWeb.loadFromWebDate);

                //xe = xeHeader.XPathElement(".//div[@class='maincont']");
                //header.images = xe.XPathImages(xeImg => new UrlImage(zurl.GetUrl(url, xeImg.zAttribValue("src")))).ToList();

                //RapideDdl.SetTextValues(header, xe.DescendantTextList());

                //xe = xeHeader.XPathElement(".//div[@class='morelink']//span[@class='arg']");
                //header.category = xe.DescendantTextList(".//a").Select(RapideDdl.TrimFunc1).Where(s => !s.StartsWith("Commentaires")).zToStringValues("/");

                headers.Add(header);
            }
            data.PostHeaders = headers.ToArray();
            return(data);
        }
Example #2
0
        //private static Ebookdz_HeaderPage GetData(WebResult webResult)
        private static IEnumDataPages <IHeaderData> GetData(WebResult webResult)
        {
            XXElement             xeSource = new XXElement(webResult.Http.zGetXDocument().Root);
            string                url      = webResult.WebRequest.HttpRequest.Url;
            Ebookdz_HeaderPage_v2 data     = new Ebookdz_HeaderPage_v2();

            data.SourceUrl       = url;
            data.LoadFromWebDate = webResult.LoadFromWebDate;
            //data.Id = _GetPageKey(webResult.WebRequest.HttpRequest);

            // <div class="threadpagenav">
            // <span class="prev_next">
            // <a rel="next" href="forumdisplay.php?f=157&amp;page=2&amp;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 <Ebookdz_PostHeader> headers = new List <Ebookdz_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&amp;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"))
            {
                Ebookdz_PostHeader header = new Ebookdz_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_v1.GetUrl(zurl.GetUrl(url, xe.XPathValue("@href")));

                headers.Add(header);
            }

            data.PostHeaders = headers.ToArray();

            //Trace.WriteLine(data.zToJson());

            return(data);
        }
Example #3
0
        public static IKeyData <int> GetForumHeaderPageData(LoadDataFromWeb_v4 loadDataFromWeb)
        {
            XXElement          xeSource = new XXElement(loadDataFromWeb.Http.zGetXDocument().Root);
            string             url      = loadDataFromWeb.WebRequest.HttpRequest.Url;
            Ebookdz_HeaderPage data     = new Ebookdz_HeaderPage();

            data.SourceUrl       = url;
            data.LoadFromWebDate = loadDataFromWeb.LoadFromWebDate;
            //data.Id = Ebookdz_LoadHeaderPagesManager.GetHeaderPageKey(loadDataFromWeb.WebRequest.HttpRequest);

            // <div id="above_threadlist" class="above_threadlist">
            // <div class="threadpagenav">
            // <span class="prev_next">
            // <a rel="next" href="forumdisplay.php?f=74&amp;page=2&amp;s=4807e931448c05da34dd54fbd0308479" title="Page suivante - Résultats de 21 à 40 sur 66">
            data.UrlNextPage = GetUrl(zurl.GetUrl(url, xeSource.XPathValue("//div[@id='above_threadlist']//span[@class='prev_next']//a[@rel='next']/@href")));

            // <div class="body_bd">
            XXElement xePost = xeSource.XPathElement("//div[@class='body_bd']");

            // <div id="breadcrumb" class="breadcrumb">
            // <ul class="floatcontainer">
            // <li class="navbit">
            // Forum / Journaux / Presse quotidienne / Autres Journaux

            // <div id="threadlist" class="threadlist">
            // <ol id="threads" class="threads">

            IEnumerable <XXElement>   xeHeaders = xeSource.XPathElements("//div[@id='threadlist']//ol[@id='threads']/li");
            List <Ebookdz_PostHeader> headers   = new List <Ebookdz_PostHeader>();

            foreach (XXElement xeHeader in xeHeaders)
            {
                Ebookdz_PostHeader header = new Ebookdz_PostHeader();
                header.SourceUrl       = url;
                header.LoadFromWebDate = loadDataFromWeb.LoadFromWebDate;

                // <div class="threadinfo" title="">
                // <div class="inner">
                // <a title="" class="title" href="showthread.php?t=111210&amp;s=4807e931448c05da34dd54fbd0308479" id="thread_title_111210">L'OPINION du mardi  20 janvier 2015</a>

                XXElement xe = xeHeader.XPathElement(".//div[@class='threadinfo']//a[@class='title']");
                header.Title     = xe.XPathValue(".//text()");
                header.UrlDetail = GetUrl(zurl.GetUrl(loadDataFromWeb.WebRequest.HttpRequest.Url, xe.XPathValue("@href")));

                //header.images = xeHeader.XPathImages(xeImg => new UrlImage(zurl.GetUrl(url, xeImg.zAttribValue("src")))).ToList();

                //XXElement xe = xeHeader.XPathElement(".//*[@class='shd']//a");
                //header.urlDetail = zurl.GetUrl(url, xe.XPathValue("@href"));
                //header.title = RapideDdl.ExtractTextValues(header.infos, xe.XPathValue(".//text()", RapideDdl.TrimFunc1));

                //xe = xeHeader.XPathElement(".//div[@class='shdinfo']");
                //header.postAuthor = xe.XPathValue(".//span[@class='arg']//a//text()");
                //// Aujourd'hui, 17:13
                //header.creationDate = RapideDdl.ParseDateTime(xe.XPathValue(".//span[@class='date']//text()"), loadDataFromWeb.loadFromWebDate);

                //xe = xeHeader.XPathElement(".//div[@class='maincont']");
                //header.images = xe.XPathImages(xeImg => new UrlImage(zurl.GetUrl(url, xeImg.zAttribValue("src")))).ToList();

                //RapideDdl.SetTextValues(header, xe.DescendantTextList());

                //xe = xeHeader.XPathElement(".//div[@class='morelink']//span[@class='arg']");
                //header.category = xe.DescendantTextList(".//a").Select(RapideDdl.TrimFunc1).Where(s => !s.StartsWith("Commentaires")).zToStringValues("/");

                headers.Add(header);
            }
            data.PostHeaders = headers.ToArray();
            //return (IEnumDataPages_new2<int, IHeaderData_new>)data;
            return((IKeyData <int>)data);
        }