コード例 #1
0
        private void GetMovies(string url)
        {
            if (logging())
            {
                logInfo("Busca customizada, URL: " + url);
            }
            string htmlPage = WebAO.CodeHtml(url);

            List <Movie> movies = Movie.ReadMoviesFromUrl(htmlPage);

            if (logging())
            {
                logInfo("Filmes encontrados: " + movies.Count);
            }

            moviesMutex.WaitOne();
            foreach (Movie movie in movies)
            {
                if (!hashMovies.ContainsKey(movie.NameUrl))
                {
                    hashMovies.Add(movie.NameUrl, movie);
                }
            }

            updateMoviesCount(hashMovies.Count);
            moviesMutex.Release();
        }
コード例 #2
0
        public void GetBusinessInfo()
        {
            string url = "http://www.imdb.com/title/@/business?ref_=ttco_ql_4";

            url = url.Replace("@", nameUrl);
            string htmlPage = WebAO.CodeHtml(url);

            string[] pageLines = htmlPage.Split('\n');

            EnglishName = "";
            int i = 0;

            for (i = 0; i < pageLines.Length; i++)
            {
                string line = pageLines[i].Trim();
                if (line.Contains("Budget"))
                {
                    line = pageLines[++i].Trim();

                    Budget = (line.Substring(1, line.IndexOf(" ("))).Replace(",", "");
                    Budget = Budget.Trim();
                }

                if (line.Contains("<span class=\"title-extra\""))
                {
                    //Pode ser que o nome nacional seja igual ao nome original
                    int indexItalic = line.IndexOf("<i>(or");
                    if (indexItalic != -1)
                    {
                        int jump = line.IndexOf("<span class=\"title-extra\">") + "<span class=\"title-extra\">".Length;

                        EnglishName = line.Substring(jump, line.IndexOf("<i>(or") - (jump + 1));
                        EnglishName = EnglishName.Trim();
                    }
                }
            }
            if (EnglishName.Length == 0)
            {
                EnglishName = Name;
            }
        }
コード例 #3
0
        public void GetInfo()
        {
            string url = "http://www.imdb.com/name/n@/awards?ref_=nm_ql_2";

            url = url.Replace("@", nameUrl);
            string htmlPage = WebAO.CodeHtml(url);

            string[] pageLines = htmlPage.Split('\n');

            int i = 0;

            for (i = 0; i < pageLines.Length; i++)
            {
                string line = pageLines[i].Trim();
                if (line.Contains("<div class=\"desc\">Showing"))
                {
                    int index1 = line.IndexOf(" all ");
                    int index2 = line.IndexOf(" wins ");

                    awards = int.Parse(line.Substring(index1 + " all ".Length, index2 - (index1 + " all ".Length)));
                }
                if (line.Contains("<td class=\"award_outcome\" rowspan=\"2\">"))
                {
                    i++;
                    line = pageLines[i].Trim();
                    bool won = false;
                    if (line.Contains("Won"))
                    {
                        won = true;
                    }
                    i++;
                    line = pageLines[i].Trim();
                    Console.WriteLine(line);
                    if (line.Contains("Oscar") && won)
                    {
                        Oscar = true;
                    }
                }
            }
        }
コード例 #4
0
        public List <string> GetTags()
        {
            List <string> tags = new List <string>();

            string htmlPage = WebAO.CodeHtml("http://www.imdb.com/title/" + NameUrl + "/keywords?ref_=ttpl_sa_3");

            string[] pageLines = htmlPage.Split('\n');

            for (int i = 0; i < pageLines.Length; i++)
            {
                string line = pageLines[i].Trim();
                if (line.Contains("<a href=\"/keyword"))
                {
                    i++;
                    line = pageLines[i].Trim();

                    string tag = line.Substring(1);
                    int    pos = tag.IndexOf("</");
                    tag = tag.Substring(0, pos);
                    tags.Add(tag);
                    Console.WriteLine();
                }
            }

            if (tags.Count > 0)
            {
                foreach (string tag in tags)
                {
                    if (violent.Contains(tag))
                    {
                        IsViolent = true;
                    }
                    if (firegun.Contains(tag))
                    {
                        hasFireguns = true;
                    }
                    if (gore.Contains(tag))
                    {
                        isGoreViolent = true;
                    }
                    if (sex.Contains(tag))
                    {
                        hasSex = true;
                    }
                    if (nude.Contains(tag))
                    {
                        hasNudeScenes = true;
                    }
                    if (relationship.Contains(tag))
                    {
                        aboutRelationships = true;
                    }
                    if (family.Contains(tag))
                    {
                        aboutFamily = true;
                    }
                    if (tag.Contains("flashback"))
                    {
                        hasFlashbacks = true;
                    }
                    if (tag.Contains("surprise ending"))
                    {
                        hasSurpriseEnding = true;
                    }
                    if (humandrama.Contains(tag))
                    {
                        aboutHumanDrama = true;
                    }
                    if (nowadaystechnology.Contains(tag))
                    {
                        hasNowadaysTechnology = true;
                    }
                    if (tag.Contains("sequel"))
                    {
                        isSequel = true;
                    }
                    if (tag.Contains("based on novel"))
                    {
                        isBasedOnNovel = true;
                    }
                    if (tag.Contains("written by director"))
                    {
                        isWrittenByDirector = true;
                    }
                    if (tag.Contains("independent"))
                    {
                        isIndependent = true;
                    }
                    if (camerawork.Contains(tag))
                    {
                        hasCameraWorks = true;
                    }
                }
            }

            return(tags);
        }