private static string CleanHtmlPage(string html) { IMDbRegEx imDbRegEx = new IMDbRegEx(); imDbRegEx.SetRegExPatterns(); Debugger.LogMessageToFile ("Cleaning IMDb result html "); string trimmedHtml = imDbRegEx.GetRegExString (html, imDbRegEx.TrimmedHTMLpattern); return trimmedHtml; }
internal static Match GetMovieTitleRegexMatch (string imdbID, string trimmedHtml) { Debugger.LogMessageToFile ("[IMDb Movie Details Downloader]" + " Getting Title regex match..."); var imDbRegEx = new IMDbRegEx(); imDbRegEx.SetRegExPatterns(); Match match = imDbRegEx.GetRegExMatch (trimmedHtml, IMDbRegEx.TitlePatternOriginal); try { string filmTitle = match.Groups[1].Captures[0].Value; return match; } catch (Exception) { match = imDbRegEx.GetRegExMatch (trimmedHtml, IMDbRegEx.TitlePatternPrimary); try { string filmTitle = match.Groups[1].Captures[0].Value; return match; } catch (Exception e) { Debugger.LogMessageToFile ("[IMDb Movie Details Downloader] " + "The IMDb Movie Details Downloader was unable" + " to extract the movie title " + "for the movie with IMDb ID: " + imdbID + "."); return match; } } }
private static IMDbMovie MineFilmDetailsFromMainPage (IMDbFilmDetails filmDetails, string trimmedHtml, IMDbMovie movie ) { IMDbRegEx imDbRegEx = new IMDbRegEx(); imDbRegEx.SetRegExPatterns(); IMDbFilmDetails.MineProductionYearUsingRegex(movie, trimmedHtml, imDbRegEx); //IMDbFilmDetails.MineProductionYearUsingXpath(movie, trimmedHtml); IMDbFilmDetails.GetActorsUsingXpath(movie, trimmedHtml); IMDbFilmDetails.GetReleaseDate(movie, trimmedHtml, imDbRegEx); IMDbFilmDetails.GetTagline(movie, trimmedHtml, imDbRegEx); IMDbFilmDetails.GetRuntime(movie, trimmedHtml, imDbRegEx); IMDbFilmDetails.GetRating(movie, trimmedHtml, imDbRegEx); IMDbFilmDetails.ExtractRatingDescription(movie, trimmedHtml, imDbRegEx); IMDbFilmDetails.GetReview(movie, trimmedHtml, imDbRegEx); IMDbFilmDetails.GetStudio(movie, trimmedHtml, imDbRegEx); //IMDbFilmDetails.MineOverviewUsingRegex(movie, trimmedHtml, imDbRegEx); IMDbFilmDetails.MineOverviewUsingXpath(movie, trimmedHtml); //filmDetails.MineDirectorUsingRegex(ref movie, trimmedHtml); filmDetails.MineDirectorUsingXpath(ref movie, trimmedHtml); //filmDetails.MineWriterUsingRegex(ref movie, trimmedHtml); filmDetails.MineWriterUsingXpath(ref movie, trimmedHtml); filmDetails.GetGenres(ref movie, trimmedHtml); return movie; }