Beispiel #1
0
        public override ICollection <country> getCountries(HtmlNode victimDetailContent)
        {
            var dd        = victimDetailContent.SelectNodes("//ul[@class='meta-data'] //li");
            var countries = convertNodesToArray(dd[dd.Count - 7].SelectNodes("./a"));
            ICollection <country> couns = new HashSet <country>();

            foreach (var country in countries)
            {
                try
                {
                    string countryName = UnicodeUtil.uniformCountryName(country.Trim());
                    if (countryName == "")
                    {
                        continue;
                    }
                    var alias     = UnicodeUtil.convertToAlias(countryName);
                    var newEntity = new country()
                    {
                        name = countryName, alias = alias
                    };
                    if (countryExisted(countryName))
                    {
                        newEntity = findCountryByName(countryName);
                        setModified(newEntity);
                    }
                    couns.Add(newEntity);
                }
                catch
                {
                    continue;
                }
            }
            return(couns);
        }
Beispiel #2
0
        public override ICollection <category> getCategories(HtmlNode victimDetailContent)
        {
            string[] ignoreCats         = { "long-tieng", "thuyet-minh", "han-quoc", "movie-trailers", "" };
            var      dd                 = victimDetailContent.SelectNodes("//ul[@class='meta-data'] //li");
            var      genres             = convertNodesToArray(dd[dd.Count - 8].SelectNodes("./a"));
            ICollection <category> cats = new HashSet <category>();

            foreach (var genre in genres)
            {
                try
                {
                    string genreName = UnicodeUtil.uniformCatName(genre.Trim());
                    var    alias     = UnicodeUtil.convertToAlias(genreName);
                    if (ignoreCats.Contains(alias.Replace("phim-", "")))
                    {
                        continue;
                    }
                    var newEntity = new category()
                    {
                        name = genreName, alias = alias
                    };
                    if (categoryExisted(genreName))
                    {
                        newEntity = findCategoryByName(genreName);
                        setModified(newEntity);
                    }
                    cats.Add(newEntity);
                }
                catch
                {
                    continue;
                }
            }
            return(cats);
        }
Beispiel #3
0
        public override ICollection <director> getDirectors(HtmlNode victimDetailContent)
        {
            var dd        = victimDetailContent.SelectNodes("//ul[@class='meta-data'] //li");
            var directors = convertNodesToArray(dd[dd.Count - 10].SelectNodes("./a"));
            ICollection <director> dirs = new HashSet <director>();

            foreach (var director in directors)
            {
                try
                {
                    string directorName = director.Trim();
                    if (directorName == "")
                    {
                        continue;
                    }
                    var alias     = UnicodeUtil.convertToAlias(directorName);
                    var newEntity = new director()
                    {
                        name = directorName, alias = alias
                    };
                    if (directorExisted(directorName))
                    {
                        newEntity = findDirectorByName(directorName);
                        setModified(newEntity);
                    }
                    dirs.Add(newEntity);
                }
                catch
                {
                    continue;
                }
            }
            return(dirs);
        }
Beispiel #4
0
        public override ICollection <country> getCountries(HtmlNode victimDetailContent)
        {
            var dd        = getDDItems();
            var countries = dd[2].InnerText.Trim().Split(',');
            ICollection <country> couns = new HashSet <country>();

            foreach (var country in countries)
            {
                try
                {
                    string countryName = UnicodeUtil.uniformCountryName(country.Trim());
                    if (countryName == "")
                    {
                        continue;
                    }
                    var alias     = UnicodeUtil.convertToAlias(countryName);
                    var newEntity = new country()
                    {
                        name = countryName, alias = alias
                    };
                    if (countryExisted(countryName))
                    {
                        newEntity = findCountryByName(countryName);
                        setModified(newEntity);
                    }
                    couns.Add(newEntity);
                }
                catch
                {
                    continue;
                }
            }
            return(couns);
        }
Beispiel #5
0
        public override movie getMovie(HtmlNode victimDetailContent)
        {
            HtmlNodeCollection dd = victimDetailContent.SelectNodes("//ul[@class='meta-data'] //li");
            var currentMovieInfo  = dd[0].SelectSingleNode("./strong").InnerText.Trim().ToLower().Replace("bản đẹp", "HD").ToLower();
            var title             = UnicodeUtil.replaceSpecialCharacter(victimDetailContent.SelectSingleNode("//div[@class='left-content'] //h1[@class='name']").InnerText.Trim());
            var secondTitle       = UnicodeUtil.replaceSpecialCharacter(victimDetailContent.SelectSingleNode("//div[@class='left-content'] //h2[@class='real-name']").InnerText.Trim());
            var alias             = UnicodeUtil.convertToAlias(title + ((secondTitle != "") ? ("-" + secondTitle) : ""));
            int isMultipleEpisode = (currentMovieInfo.IndexOf("tập") != -1 || currentMovieInfo.IndexOf("/") != -1) ? 1 : 0;
            var publishYear       = 0;

            try {
                publishYear = Int32.Parse(dd[dd.Count - 4].SelectSingleNode("./span").InnerText.Trim().Replace("Năm xuất bản:", "").Trim());
            } catch (Exception ex) { Console.Write(ex.Message); }

            movie newMovie = new movie()
            {
                name1           = title,
                name2           = secondTitle,
                alias           = alias,
                isMultiEpisode  = isMultipleEpisode,
                dateUpdate      = DateTime.Now,
                publishYear     = publishYear,
                name1CheckField = buildNameCheckField(title),
                name2CheckField = buildNameCheckField(secondTitle),
                isPublic        = 1
            };

            return(newMovie);
        }
Beispiel #6
0
        public override ICollection <category> getCategories(HtmlNode victimDetailContent)
        {
            string[] ignoreCats         = { "long-tieng", "thuyet-minh", "han-quoc", "movie-trailers", "", "bo", "le", "bo-han-quoc", "hoi-hop-gay-can" };
            var      dd                 = getDDItems();
            var      genres             = dd[7].InnerText.Trim().Split(',');
            ICollection <category> cats = new HashSet <category>();

            foreach (var genre in genres)
            {
                try
                {
                    string genreName = UnicodeUtil.uniformCatName(genre.Trim());
                    var    alias     = UnicodeUtil.convertToAlias(genreName);
                    if (ignoreCats.Contains(alias.Replace("phim-", "")))
                    {
                        continue;
                    }
                    var newEntity = new category()
                    {
                        name = genreName, alias = alias
                    };
                    if (categoryExisted(genreName))
                    {
                        newEntity = findCategoryByName(genreName);
                        setModified(newEntity);
                    }
                    cats.Add(newEntity);
                }
                catch
                {
                    continue;
                }
            }
            return(cats);
        }
Beispiel #7
0
        public override ICollection <director> getDirectors(HtmlNode victimDetailContent)
        {
            var dd        = getDDItems();
            var directors = dd[1].InnerText.Trim().Split(',');
            ICollection <director> dirs = new HashSet <director>();

            foreach (var director in directors)
            {
                try
                {
                    string directorName = director.Trim();
                    if (directorName == "")
                    {
                        continue;
                    }
                    var alias     = UnicodeUtil.convertToAlias(directorName);
                    var newEntity = new director()
                    {
                        name = directorName, alias = alias
                    };
                    if (directorExisted(directorName))
                    {
                        newEntity = findDirectorByName(directorName);
                        setModified(newEntity);
                    }
                    dirs.Add(newEntity);
                }
                catch
                {
                    continue;
                }
            }
            return(dirs);
        }
Beispiel #8
0
        public override movie getMovie(HtmlNode victimDetailContent)
        {
            var dd = getDDItems();
            var currentMovieInfo  = dd[0].InnerText.Trim().ToLower().Replace("bản đẹp", "HD").ToLower();
            var title             = UnicodeUtil.replaceSpecialCharacter(victimDetailContent.SelectSingleNode("//a[@class='title-1']").InnerText.Trim());
            var secondTitle       = UnicodeUtil.replaceSpecialCharacter(victimDetailContent.SelectSingleNode("//span[@class='title-2']").InnerText.Trim());
            var alias             = UnicodeUtil.convertToAlias(title + ((secondTitle != "") ? ("-" + secondTitle) : ""));
            int isMultipleEpisode = (currentMovieInfo.IndexOf("tập") != -1 || currentMovieInfo.IndexOf("/") != -1) ? 1 : 0;
            var publishYear       = 0;

            try { publishYear = Int32.Parse(dd[3].InnerText.Trim()); } catch (Exception ex) { Console.Write(ex.Message); }

            movie newMovie = new movie()
            {
                name1           = title,
                name2           = secondTitle,
                alias           = alias,
                isMultiEpisode  = isMultipleEpisode,
                dateUpdate      = DateTime.Now,
                publishYear     = publishYear,
                name1CheckField = buildNameCheckField(title),
                name2CheckField = buildNameCheckField(secondTitle),
                isPublic        = 1
            };

            return(newMovie);
        }
Beispiel #9
0
        public override ICollection <actor> getActors(HtmlNode victimDetailContent)
        {
            var dd = victimDetailContent.SelectNodes("//div[@class='dinfo'] //dd");

            string[]            actors = dd[1].InnerText.Trim().Split(',');
            ICollection <actor> acts   = new HashSet <actor>();

            foreach (var actor in actors)
            {
                try {
                    string actorName = actor.Trim();
                    if (actorName == "")
                    {
                        continue;
                    }
                    var alias     = UnicodeUtil.convertToAlias(actorName);
                    var newEntity = new actor()
                    {
                        name = actorName, alias = alias
                    };
                    if (actorExisted(actorName))
                    {
                        newEntity = findActorByName(actorName);
                        setModified(newEntity);
                    }
                    acts.Add(newEntity);
                }
                catch
                {
                    continue;
                }
            }
            return(acts);
        }
Beispiel #10
0
        public episode newEpisodeInstance(string name, int victimId, string groupName, string episodeHref)
        {
            var episode = new episode()
            {
                name        = name,
                victimId    = victimId,
                groupName   = groupName,
                episodeHref = episodeHref,
                alias       = UnicodeUtil.convertToAlias(name)
            };

            return(episode);
        }
Beispiel #11
0
        public override ICollection <actor> getActors(HtmlNode victimDetailContent)
        {
            var actors = victimDetailContent.SelectNodes("//div[@class='block-actors'] //span[@class='actor-name-a']");
            ICollection <actor> acts = new HashSet <actor>();

            if (actors == null)
            {
                return(acts);
            }
            foreach (var actor in actors)
            {
                try {
                    string actorName = actor.InnerText.Trim();
                    if (actorName == "")
                    {
                        continue;
                    }
                    var alias     = UnicodeUtil.convertToAlias(actorName);
                    var newEntity = new actor()
                    {
                        name = actorName, alias = alias
                    };
                    if (actorExisted(actorName))
                    {
                        newEntity = findActorByName(actorName);
                        setModified(newEntity);
                    }
                    acts.Add(newEntity);
                }
                catch
                {
                    continue;
                }
            }
            return(acts);
        }
Beispiel #12
0
 public string buildNameCheckField(string str)
 {
     return(UnicodeUtil.convertToAlias(str.Split('(')[0].Trim()));
 }