Exemple #1
0
        public string GetMovieDescription(string movieName)
        {
            var match = Regex.Match(movieName, @"\(\d{4}\)");
            var year  = "";

            if (match.Success)
            {
                year = match.Value.Replace("(", "");
                year = year.Replace(")", "");
                cl("year is " + year);
                movieName = movieName.Replace(match.Value, "");
            }
            var         url         = $@"{baseMovieUrl}/search/movie/?query={movieName}&{movieAuth}&year={year}";
            var         description = "";
            MovieResult x           = JsonConvert.DeserializeObject <MovieResult>(WebCall.GetRequest(url));

            if (x.total_results == 0)
            {
                description = "No description found";
            }
            else
            {
                description = x.results[0].overview;
            }
            return(description);
        }
        public string GetMoviePosterUrl(string movieName)
        {
            var match = Regex.Match(movieName, @"\(\d{4}\)");
            var year  = "";

            if (match.Success)
            {
                year = match.Value.Replace("(", "");
                year = year.Replace(")", "");
                cl("year is " + year);
                movieName = movieName.Replace(match.Value, "");
            }
            var         url       = $@"{baseMovieUrl}/search/movie/?query={movieName}&{movieAuth}&year={year}";
            var         posterUrl = "";
            MovieResult x         = JsonConvert.DeserializeObject <MovieResult>(WebCall.GetRequest(url));

            if (x.total_results == 0)
            {
                return("");
            }
            posterUrl = posterBaseUrl + x.results[0].poster_path;
            return(posterUrl);
        }