예제 #1
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);
        }
예제 #2
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);
        }