コード例 #1
0
ファイル: BilutvVictim.cs プロジェクト: pcb-gr/NTVideoData
        public override void doGetListItemsInfo(int pageIndex)
        {
            HtmlNodeCollection items = getItemsInPage(pageIndex);

            if (items != null)
            {
                for (int j = 0; j < items.Count; j++)
                {
                    while (stopInsertFlag)
                    {
                        Thread.Sleep(10);
                    }
                    string href          = items[j].Attributes["href"].Value;
                    movie  movieItemInfo = getMovieItemInfo(UriUtil.checkAndAddDomain(href, victimDomain, protocol));
                    if (movieItemInfo == null)
                    {
                        continue;
                    }
                    saveNewMovie(movieItemInfo);
                }
                pageIndex++;
                doGetListItemsInfo(pageIndex);
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("[" + victimDomain + "] - doGetListItemsInfo finished!!!");
            }
        }
コード例 #2
0
ファイル: BilutvVictim.cs プロジェクト: pcb-gr/NTVideoData
        public override ICollection <episode> getEpisodes(string movieHref, bool excludeGroup)
        {
            victim vtm = new victim();

            vtm.movieHref = movieHref;
            var victimWatchContent = getRootNode(UriUtil.checkAndAddDomain(vtm.movieHref, victimDomain, protocol));
            var groupMap           = new List <string>();

            groupMap.Add("default~" + vtm.movieHref);
            if (!excludeGroup)
            {
                var groups = victimWatchContent.SelectNodes("//ul[@class='choose-server'] //a");
                if (groups != null)
                {
                    groupMap.Clear();
                    foreach (var group in groups)
                    {
                        groupMap.Add(group.InnerText.Trim() + "~" + group.Attributes["href"].Value);
                    }
                }
            }


            foreach (var g in groupMap)
            {
                var ginfo        = g.Split('~');
                var href         = UriUtil.checkAndAddDomain(ginfo[1], victimDomain, protocol);
                var episodeNodes = getRootNode(href).SelectNodes(".//div[@class='list-episode'] //a");
                if (episodeNodes != null)
                {
                    foreach (var episodeNode in episodeNodes)
                    {
                        vtm.episodes.Add(newEpisodeInstance(episodeNode.InnerText.Trim(), vtm.victimId, ginfo[0], episodeNode.Attributes["href"].Value));
                    }
                }
                else
                {
                    vtm.episodes.Add(newEpisodeInstance("1", vtm.victimId, g.Split('~')[0], vtm.movieHref));
                }
            }
            return(vtm.episodes);
        }
コード例 #3
0
ファイル: BilutvVictim.cs プロジェクト: pcb-gr/NTVideoData
        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);
            }
        }
コード例 #4
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);
        }