예제 #1
0
        internal static string Get_FullDetailFilm(string html)
        {
            List <Models.Actor>    listActor    = Get_ActorFilm(html);
            List <Models.FilmItem> listRelaFilm = Get_RelaFilm(html);

            detailFilm = new Models.DetailFilm();
            try
            {
                var node     = Getnode.GetOneTag(html, "div", "class", "movie-info");
                var nodeInfo = Getnode.GetListNodeToNode(node, new int[] { 0, 0, 0, 1, 0 })[0];

                int limit = node.ChildNodes.Count < 42 ? 42 - nodeInfo.ChildNodes.Count + 1 : 0;
                int l     = 5;

                detailFilm.Thumb       = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 1, 0, 0 }, "src");
                detailFilm.UrlFilm     = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 1, 0, 2, 2, 0 }, "href");
                detailFilm.Description = Getnode.GetValueHtmlToChird(node, new int[] { 3, 2 }, "");
                detailFilm.NameFilm1   = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 0, 0 }, "");
                detailFilm.NameFilm2   = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 0, 1 }, "");
                detailFilm.Status      = Getnode.GetValueHtmlToChird(nodeInfo, new int[] { 1 }, "");
                detailFilm.ImDB        = Getnode.GetValueHtmlToTag(nodeInfo, "class", "movie-dd imdb");
                if (!string.IsNullOrEmpty(detailFilm.ImDB))
                {
                    detailFilm.Votes = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 6 }, "");
                    l = 0;
                }


                detailFilm.Year         = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 15 - l }, "");
                detailFilm.OpenDate     = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 18 - l }, "");
                detailFilm.Time         = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 21 - l }, "");
                detailFilm.TotalEpisode = limit == 0 ? Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 24 - l }, "") : "";
                detailFilm.Quality      = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 30 - limit }, "");
                detailFilm.Language     = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 33 - limit }, "");
                detailFilm.Company      = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 39 - limit }, "");
                detailFilm.View         = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 42 - limit }, "");
                detailFilm.Actor        = listActor;
                detailFilm.RelaFilm     = listRelaFilm;

                var nodeDirector = Getnode.GetListNodeToTag(nodeInfo, "class", "movie-dd dd-director");
                foreach (var item in nodeDirector[0].ChildNodes)
                {
                    Models.Director i = new Models.Director();
                    if (item.Name == "#text")
                    {
                        continue;
                    }
                    var value = Getnode.GetValueHtmlToChird(item, new int[] { }, "href");
                    i.UrlDirector  = value;
                    i.DirectorName = Getnode.GetValueHtmlToChird(item, new int[] { }, "");
                    detailFilm.ArrDirector.Add(i);
                }


                var nodeCountry = Getnode.GetListNodeToTag(nodeInfo, "class", "movie-dd dd-country");
                var dCountry    = Common.AddDicCountry();
                foreach (var item in nodeCountry[0].ChildNodes)
                {
                    Models.Country iCountry = new Models.Country();
                    if (item.Name == "#text")
                    {
                        continue;
                    }
                    var value = Getnode.GetValueHtmlToChird(item, new int[] { }, "href");
                    iCountry.NameCountry = Getnode.GetValueHtmlToChird(item, new int[] { }, "");
                    iCountry.EnumCountry = dCountry.FirstOrDefault(t => t.Value == value).Key;
                    detailFilm.ArrCountry.Add(iCountry);
                }


                var nodeGenre = Getnode.GetListNodeToTag(nodeInfo, "class", "movie-dd dd-cat");
                var dGenre    = Common.AddDicGenre();
                foreach (var item in nodeGenre[0].ChildNodes)
                {
                    Models.Genre i = new Models.Genre();
                    if (item.Name == "#text")
                    {
                        continue;
                    }
                    var value = Getnode.GetValueHtmlToChird(item, new int[] { }, "href");
                    i.NameGenre = Getnode.GetValueHtmlToChird(item, new int[] { }, "");
                    i.EnumGenre = dGenre.FirstOrDefault(t => t.Value == value).Key;
                    detailFilm.ArrGenre.Add(i);
                }
                json_DetailFilm.status = true;
            }

            catch
            {
                json_DetailFilm.status = false;
            }
            return(BaseJsonDetail());
        }
예제 #2
0
        internal static string Get_FullDetailFilm(string html)
        {

            List<Models.Actor> listActor = Get_ActorFilm(html);
            List<Models.FilmItem> listRelaFilm = Get_RelaFilm(html);
            detailFilm = new Models.DetailFilm();
            try
            {

                var node = Getnode.GetOneTag(html, "div", "class", "movie-info");
                var nodeInfo = Getnode.GetListNodeToNode(node, new int[] { 0, 0, 0, 1, 0 })[0];

                int limit = node.ChildNodes.Count < 42 ? 42 - nodeInfo.ChildNodes.Count + 1 : 0;
                int l = 5;

                detailFilm.Thumb = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 1, 0, 0 }, "src");
                detailFilm.UrlFilm = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 1, 0, 2, 2, 0 }, "href");
                detailFilm.Description = Getnode.GetValueHtmlToChird(node, new int[] { 3, 2 }, "");
                detailFilm.NameFilm1 = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 0, 0 }, "");
                detailFilm.NameFilm2 = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 0, 1 }, "");
                detailFilm.Status = Getnode.GetValueHtmlToChird(nodeInfo, new int[] { 1 }, "");
                detailFilm.ImDB = Getnode.GetValueHtmlToTag(nodeInfo, "class", "movie-dd imdb");
                if (!string.IsNullOrEmpty(detailFilm.ImDB))
                {
                    detailFilm.Votes = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 6 }, "");
                    l = 0;
                }


                detailFilm.Year = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 15 - l }, "");
                detailFilm.OpenDate = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 18 - l }, "");
                detailFilm.Time = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 21 - l }, "");
                detailFilm.TotalEpisode = limit == 0 ? Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 24 - l }, "") : "";
                detailFilm.Quality = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 30 - limit }, "");
                detailFilm.Language = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 33 - limit }, "");
                detailFilm.Company = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 39 - limit }, "");
                detailFilm.View = Getnode.GetValueHtmlToChird(node, new int[] { 0, 0, 0, 1, 0, 42 - limit }, "");
                detailFilm.Actor = listActor;
                detailFilm.RelaFilm = listRelaFilm;

                var nodeDirector = Getnode.GetListNodeToTag(nodeInfo, "class", "movie-dd dd-director");
                foreach (var item in nodeDirector[0].ChildNodes)
                {
                    Models.Director i = new Models.Director();
                    if (item.Name == "#text") continue;
                    var value = Getnode.GetValueHtmlToChird(item, new int[] { }, "href");
                    i.UrlDirector = value;
                    i.DirectorName = Getnode.GetValueHtmlToChird(item, new int[] { }, "");
                    detailFilm.ArrDirector.Add(i);
                }


                var nodeCountry = Getnode.GetListNodeToTag(nodeInfo, "class", "movie-dd dd-country");
                var dCountry = Common.AddDicCountry();
                foreach (var item in nodeCountry[0].ChildNodes)
                {
                    Models.Country iCountry = new Models.Country();
                    if (item.Name == "#text") continue;
                    var value = Getnode.GetValueHtmlToChird(item, new int[] { }, "href");
                    iCountry.NameCountry = Getnode.GetValueHtmlToChird(item, new int[] { }, "");
                    iCountry.EnumCountry = dCountry.FirstOrDefault(t => t.Value == value).Key;
                    detailFilm.ArrCountry.Add(iCountry);
                }


                var nodeGenre = Getnode.GetListNodeToTag(nodeInfo, "class", "movie-dd dd-cat");
                var dGenre = Common.AddDicGenre();
                foreach (var item in nodeGenre[0].ChildNodes)
                {
                    Models.Genre i = new Models.Genre();
                    if (item.Name == "#text") continue;
                    var value = Getnode.GetValueHtmlToChird(item, new int[] { }, "href");
                    i.NameGenre = Getnode.GetValueHtmlToChird(item, new int[] { }, "");
                    i.EnumGenre = dGenre.FirstOrDefault(t => t.Value == value).Key;
                    detailFilm.ArrGenre.Add(i);
                }
                json_DetailFilm.status = true;
            }

            catch
            {
                json_DetailFilm.status = false;
            }
            return BaseJsonDetail();
        }