Beispiel #1
0
        public virtual void execute(bool isUpdate)
        {
            HtmlDocument html = HAPUtil.D2PassRequest(startPage, webCharset);

            foreach (var e in html.DocumentNode.CssSelect(".movie-panel"))
            {
                Maker mak = getMaker(getMakerNode(e));
                if (mak.enable)
                {
                    Movie mv = new Movie();
                    mv.mvid      = getMvid(e);
                    mv.title     = getTitle(getTitleNode(e));
                    mv.thumbnail = getThumbnail(getThumbnailNode(e));
                    mv.rating    = getRating(getRatingNode(e));
                    var            xpName = getActressName(getActressNode(e));
                    List <Actress> actrs  = new List <Actress>();
                    ActressMovie   actmv  = new ActressMovie();
                    foreach (var xpA in xpName)
                    {
                        Actress actr = new Actress();
                        actr.name = xpA;
                        //actr = dao.QueryOrInsert(actr);
                        actrs.Add(actr);
                    }
                }
            }
        }
Beispiel #2
0
        protected override string getCoverHref(Movie movie)
        {
            string       attrName = "value";
            HtmlDocument html     = HAPUtil.Load(movie.pageHref, webCharset);
            HtmlNode     node     = null;
            // head swf
            var param = html.DocumentNode.SelectNodes("/html/body/table/td/table[2]//object/param");

            if (param != null)
            {
                foreach (HtmlNode p in param)
                {
                    if (p.Attributes["name"].Value == "movie")
                    {
                        node = p;
                        break;
                    }
                }
            }
            string imgUrl   = node.Attributes[attrName].Value;
            Uri    coverUri = new Uri(pageBaseUri, imgUrl);

            return(coverUri.ToString());
        }
Beispiel #3
0
        public override void execute(bool isUpdate)
        {
            HtmlDocument html = HAPUtil.Load(startPage, webCharset);
            //HtmlDocument html = HAPUtil.Load(startPage, webCharset, true);
            ArrayList selectors = new ArrayList(new string[] { "body table table", "body table table table" });

            foreach (var s in selectors)
            {
                try {
                    foreach (var e in html.DocumentNode.CssSelect((string)s))
                    {
                        var mvid = "";
                        foreach (var a in e.CssSelect("a"))
                        {
                            if (!a.Attributes.Contains("href"))
                            {
                                continue;
                            }
                            var href = a.Attributes["href"].Value;
                            mvid = RegexUtil.MatcheGroups("k[0-9]{4}", href, 0);
                            Movie mv = dao.findMovieByMvid(mvid);
                            if (mvid != "" && (mv == null || isUpdate))
                            {
                                if (mv == null)
                                {
                                    mv = new Movie();
                                }
                                List <Actress> actrs  = new List <Actress>();
                                Series         series = getSeries(e);
                                Label          label  = getLabel(getLabelNode(e));
                                mv.mvid        = mvid;
                                mv.pageHref    = getPageHref(href);
                                mv.publishDate = getPublishDate(getPublishDateNode(e));
                                mv.releaseDate = mv.publishDate;
                                mv.thumbnail   = getThumbnail(getThumbnailNode(e));
                                mv.coverHref   = getCoverHref(mv);
                                mv.title       = getTitle(getTitleNode(e));

                                var          xpName = getActressName(getActressNode(e));
                                ActressMovie actmv  = new ActressMovie();
                                foreach (var xpA in xpName)
                                {
                                    Actress actr = new Actress();
                                    actr.name = xpA;
                                    actr      = dao.QueryOrInsert(actr);
                                    actrs.Add(actr);
                                }
                                mv.Maker  = maker;
                                mv.Series = series;
                                mv.Label  = label;
                                mv        = dao.QueryOrInsert(mv);
                                var order = 0;
                                foreach (var actr in actrs)
                                {
                                    ActressMovie amv = new ActressMovie();
                                    amv.actressId    = actr.id;
                                    amv.actressOrder = order++;
                                    amv.movieId      = mv.id;
                                    dao.insertOrUpdate(amv);
                                }
                            }
                        }
                    }
                } catch (Exception) {
                    continue;
                }
            }
        }
Beispiel #4
0
        protected override string getCoverHref(Movie movie)
        {
            string       attrName = "src";
            HtmlDocument html     = HAPUtil.Load(movie.pageHref, webCharset);
            HtmlNode     node     = null;
            // swf
            var param = html.DocumentNode.SelectNodes("/html/body/table/td/table[10]//object/param");

            if (param == null)
            {
                param = html.DocumentNode.SelectNodes("/html/body/table/td/table[9]//object/param");
            }
            if (param == null)
            {
                param = html.DocumentNode.SelectNodes("/html/body/table/td/table[8]//object/param");
            }
            if (param != null)
            {
                foreach (HtmlNode p in param)
                {
                    if (p.Attributes["name"].Value == "movie")
                    {
                        node     = p;
                        attrName = "value";
                        break;
                    }
                }
            }
            // jpg
            if (node == null)
            {
                node = html.DocumentNode.SelectSingleNode("/html/body/table/td/table[9]//img[1]");
            }
            if (node == null)
            {
                node = html.DocumentNode.SelectSingleNode("/html/body/table/td/table[8]//img[1]");
            }
            if (node == null)
            {
                node = html.DocumentNode.SelectSingleNode("/html/body/table/td/table[10]//img[1]");
            }
            // head swf
            if (node == null && param == null || RegexUtil.MatcheGroups(@"\.gif$", node.Attributes[attrName].Value, 0) == ".gif")
            {
                param = html.DocumentNode.SelectNodes("/html/body/table/td/table[3]//td/td//object/param");
                if (param != null)
                {
                    foreach (HtmlNode p in param)
                    {
                        if (p.Attributes["name"].Value == "movie")
                        {
                            node     = p;
                            attrName = "value";
                            break;
                        }
                    }
                }
            }
            string imgUrl   = node.Attributes[attrName].Value;
            Uri    coverUri = new Uri(pageBaseUri, imgUrl);

            return(coverUri.ToString());
        }