/// <summary> /// Get movie by title value /// </summary> /// <param name="title">IMDb Title value /// for Example: "tt1371111" or "1371111" in located in url "https://www.imdb.com/title/tt1371111/"</param> /// <returns>Return Movie Class in json data format</returns> public Movie GetDetailByTitle(string title) { int titleNo = 0; string url = string.Empty; if (title.ToLower().Replace("\\", "").Replace("/", "").Replace(" ", "").Contains("tt") && title.ToLower().Replace("\\", "").Replace("/", "").Replace(" ", "").IndexOf("tt") == 0) { if (int.TryParse(title.ToLower().Replace("\\", "").Replace("/", "").Replace(" ", "").Substring(2), out titleNo)) { url = string.Format("https://www.imdb.com/title/tt{0}", titleNo); } } else { if (int.TryParse(title.ToLower().Replace("\\", "").Replace("/", "").Replace(" ", ""), out titleNo)) { url = string.Format("https://www.imdb.com/title/tt{0}", titleNo); } } if (!string.IsNullOrWhiteSpace(url)) { IMDb imdb = new IMDb(url); return(imdb.ReadWebPage()); } else { return(null); } }
/// <summary> /// Gets movie data by entering full imdb url /// </summary> /// <param name="url">full Url path /// for Example: "https://www.imdb.com/title/tt1371111/"</param> /// <returns>Return Movie Class in json data format</returns> public Movie GetDetailByUrl(string url) { IMDb imdb = new IMDb(url); return(imdb.ReadWebPage()); }