Esempio n. 1
0
        public override victim getVictim(HtmlNode victimDetailContent)
        {
            try
            {
                if (checkIgnoreMovie(victimDetailContent))
                {
                    return(null);
                }
                var dd = victimDetailContent.SelectNodes("//ul[@class='meta-data'] //li");
                var currentMovieInfo = dd[0].SelectSingleNode("./strong").InnerText.Trim().ToLower().Replace("bản đẹp", "HD").ToLower();
                var smallImage       = victimDetailContent.SelectSingleNode("//div[@class='poster'] //img").Attributes["src"].Value;
                if (smallImage.IndexOf(victimDomainNoExt) != -1)
                {
                    smallImage = UriUtil.getUrlNoDomain(smallImage);
                }
                var movieHref         = UriUtil.checkAndAddDomain(victimDetailContent.SelectSingleNode(".//a[@class='btn-see btn btn-danger']").Attributes["href"].Value, victimDomain, protocol);
                var totalEpisode      = 1;
                var isContinue        = 0;
                var duration          = dd[dd.Count - 6].SelectSingleNode("./span").InnerText.Trim();
                int isMultipleEpisode = (duration.IndexOf("tập") != -1 || duration.IndexOf("/") != -1) ? 1 : 0;
                int currentEpisode    = 0;
                int viewed            = 999;
                try { viewed = Int32.Parse(dd[dd.Count - 5].SelectSingleNode("./span").InnerText.Trim().Replace(".", "").Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                var rating = 9D;
                try { rating = NumberUtil.GetDouble(victimDetailContent.SelectSingleNode("//span[@itempop='ratingValue']").InnerText.Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                var schedule = victimDetailContent.SelectSingleNode("//div[@class='broadcast']");
                var priority = Int32.Parse(smallImage.Split('/')[3]);

                if (isMultipleEpisode == 1)
                {
                    var infoArray = currentMovieInfo.Split(' ');
                    isContinue   = 1;
                    totalEpisode = 0;
                    foreach (var info in infoArray)
                    {
                        if (info.IndexOf("/") != -1)
                        {
                            var episodeInfo = info.Split('/');
                            try { currentEpisode = Int32.Parse(episodeInfo[0].Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                            try { totalEpisode = Int32.Parse(episodeInfo[1].Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                            if (currentEpisode == totalEpisode)
                            {
                                isContinue = 0;
                            }
                            break;
                        }
                        else if (IsNumber(info))
                        {
                            currentEpisode = Int32.Parse(info);
                            break;
                        }
                    }
                }
                var description = victimDetailContent.SelectSingleNode("//div[@class='film-content']");
                description.InnerHtml = removeTextNodes(description, "h3");
                enhanceDescription(description);
                var playListHtml = getPlayListHtml(movieHref);
                if (playListHtml == null)
                {
                    return(null);
                }
                victim vtm = new victim()
                {
                    name           = victimDomain,
                    movieHref      = movieHref,
                    thumb          = CryptoUtil.encrypt(smallImage),
                    poster         = CryptoUtil.encrypt(smallImage.Replace("/240/", "/600/")),
                    smallImage     = CryptoUtil.encrypt(smallImage.Replace("/240/", "/150/")),
                    description    = description.InnerHtml,
                    currentEpisode = currentEpisode,
                    totalEpisode   = totalEpisode,
                    duration       = duration.Replace(" / tập", "").Trim(),
                    quality        = getQuality(currentMovieInfo),
                    hasSub         = (currentMovieInfo.IndexOf("vietsub") != -1) ? 1 : 0,
                    hasDubbing     = (currentMovieInfo.IndexOf("lồng tiếng") != -1) ? 1 : 0,
                    hasTrans       = (currentMovieInfo.IndexOf("thuyết minh") != -1) ? 1 : 0,
                    isContinue     = isContinue,
                    dateUpdate     = DateTime.Now,
                    updateState    = 1,
                    viewed         = viewed,
                    rating         = rating,
                    schedule       = (schedule != null) ? replaceDomain(schedule.InnerHtml) : "",
                    victimTypeNo   = victimTypeNo,
                    priority       = priority,
                    isTrailer      = isTrailer(victimDetailContent) ? 1 : 0,
                    playListHtml   = playListHtml[0],
                    playListHtmlBk = playListHtml[1]
                };
                return(vtm);
            }
            catch (Exception ex)
            {
                Console.Write(ex.InnerException);
                return(null);
            }
        }
Esempio n. 2
0
        public override victim getVictim(HtmlNode victimDetailContent)
        {
            if (checkIgnoreMovie(victimDetailContent))
            {
                return(null);
            }
            var dd = getDDItems();
            var currentMovieInfo = dd[0].InnerText.Trim().ToLower().Replace("bản đẹp", "HD").ToLower();
            var smallImage       = victimDetailContent.SelectSingleNode("//div[@class='movie-l-img'] //img").Attributes["src"].Value;

            if (smallImage.IndexOf(victimDomainNoExt) != -1)
            {
                smallImage = UriUtil.getUrlNoDomain(smallImage);
            }
            var movieHref         = UriUtil.checkAndAddDomain(victimDetailContent.SelectSingleNode("//a[@id='btn-film-watch']").Attributes["href"].Value, victimDomain, protocol);
            var totalEpisode      = 1;
            var isContinue        = 0;
            int isMultipleEpisode = (currentMovieInfo.IndexOf("tập") != -1 || currentMovieInfo.IndexOf("/") != -1) ? 1 : 0;
            int currentEpisode    = 0;
            int viewed            = Int32.Parse(dd[dd.Count() - 1].InnerText.Trim().Replace(",", "").Trim());
            var rating            = NumberUtil.GetDouble(victimDetailContent.SelectSingleNode("//div[@id='star']").Attributes["data-score"].Value);
            var schedule          = victimDetailContent.SelectSingleNode("//div[@class='show-time']");
            var priority          = Int32.Parse(smallImage.Split('/')[2]);

            if (isMultipleEpisode == 1)
            {
                var infoArray = currentMovieInfo.Replace("(", "").Replace(")", "").Split(' ');
                isContinue   = 1;
                totalEpisode = 0;
                foreach (var info in infoArray)
                {
                    if (info.IndexOf("/") != -1)
                    {
                        var episodeInfo = info.Split('/');
                        try { currentEpisode = Int32.Parse(episodeInfo[0].Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                        try { totalEpisode = Int32.Parse(episodeInfo[1].Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                        if (currentEpisode == totalEpisode)
                        {
                            isContinue = 0;
                        }
                        break;
                    }
                    else if (IsNumber(info))
                    {
                        currentEpisode = Int32.Parse(info);
                        break;
                    }
                }
            }
            var description = victimDetailContent.SelectSingleNode("//div[@id='film-content']");

            description.InnerHtml = removeTextNodes(description, "h3");
            enhanceDescription(description);
            var caption      = dd[6].InnerText.Trim().ToLower();
            var playListHtml = getPlayListHtml(movieHref);

            if (playListHtml == null)
            {
                return(null);
            }
            victim vtm = new victim()
            {
                name           = victimDomain,
                movieHref      = movieHref,
                thumb          = CryptoUtil.encrypt(smallImage),
                poster         = CryptoUtil.encrypt(smallImage.Replace("/medium/", "/large/")),
                smallImage     = CryptoUtil.encrypt(smallImage.Replace("/medium/", "/small/")),
                description    = description.InnerHtml,
                currentEpisode = currentEpisode,
                totalEpisode   = totalEpisode,
                duration       = dd[4].InnerText.Trim().Replace(" / tập", "").Trim(),
                quality        = dd[5].InnerText.Trim(),
                hasSub         = (caption.IndexOf("phụ đề") != -1) ? 1 : 0,
                hasDubbing     = (caption.IndexOf("lồng tiếng") != -1) ? 1 : 0,
                hasTrans       = (caption.IndexOf("thuyết minh") != -1) ? 1 : 0,
                isContinue     = isContinue,
                dateUpdate     = DateTime.Now,
                updateState    = 1,
                viewed         = viewed,
                rating         = rating,
                schedule       = (schedule != null) ? replaceDomain(schedule.InnerHtml) : "",
                victimTypeNo   = victimTypeNo,
                priority       = priority,
                isTrailer      = isTrailer(victimDetailContent) ? 1 : 0,
                playListHtml   = playListHtml[0],
                playListHtmlBk = playListHtml[1]
            };

            return(vtm);
        }