Esempio n. 1
0
        public List <Trailer> GetTrailers(ImdbResult imdbResult)
        {
            List <Trailer> trailers = new List <Trailer>();

            foreach (var imdb in imdbResult.TitlePopular)
            {
                Trailer trailer = new Trailer();

                trailer = FillTrailerData(imdb);

                trailers.Add(trailer);
            }

            return(trailers);
        }
Esempio n. 2
0
        public ImdbResult GetImdbResult(string keyword)
        {
            var imdbAPI = "http://www.imdb.com/";
            var url     = string.Format("xml/find?json=1&nr=1&tt=on&q={0}", keyword);

            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri(imdbAPI);

            var        imdbResponse = client.GetAsync(url);
            ImdbResult imdbResult   = new ImdbResult();

            if (imdbResponse.Result.IsSuccessStatusCode)
            {
                string responseContent = imdbResponse.Result.Content.ReadAsStringAsync().Result;
                imdbResult = JsonConvert.DeserializeObject <ImdbResult>(responseContent);
            }

            return(imdbResult);
        }