/// <summary> /// Scrapes the Title value /// </summary> /// <param name="id">The MovieUniqueId for the scraper.</param> /// <param name="threadID">The thread MovieUniqueId.</param> /// <param name="output">The scraped Title value.</param> /// <param name="alternatives">Alternative namings found for a title.</param> /// <param name="logCatagory">The log catagory.</param> /// <returns>Scrape succeeded [true/false]</returns> public new bool ScrapeTitle(string id, int threadID, out string output, out BindingList <string> alternatives, string logCatagory) { output = string.Empty; alternatives = new BindingList <string>(); try { var html = this.GetHtml("main", threadID, id); var releaseInfoHtml = this.GetHtml("releaseinfo", threadID, id); output = YRegex.Match("(<title>)(.*)( [(].*</title>)", html, 2, true); var titleAltHtml = YRegex.Match( @"\(AKA\)</a></h5><table\sborder=""0""\scellpadding=""2"">(?<html>.*?)</tr></table>", releaseInfoHtml, "html"); var altTitles = YRegex.Matches( @"<td>(?<name>.*?)</td><td>(?<details>.*?)</td>", titleAltHtml, "name", "details", true); alternatives.AddRange(from s in altTitles where !s.Value.ToLower().Contains(new[] { "imax ", "working ", "fake " }) select s.Key); if (html.Contains("title-extra")) { var origTitle = YRegex.Match( @"class=""title-extra"">(?<title>.*?) <i>\(original title\)</i>", html, "title"); if (origTitle.Trim().Length > 0) { output = origTitle; } } output = Regex.Replace(output, @"\(\d{4}\)", string.Empty); output = Tools.Clean.Text.ValidizeResult(output); return(output.IsFilled()); } catch (Exception ex) { Log.WriteToLog(LogSeverity.Error, threadID, logCatagory, ex.Message); return(false); } }
/// <summary> /// Scrapes the fanart image collection. /// </summary> /// <param name="id">The MovieUniqueId for the scraper.</param> /// <param name="threadID">The thread MovieUniqueId.</param> /// <param name="output">The scraped fanart image collection.</param> /// <param name="logCatagory">The log catagory.</param> /// <returns>Scrape succeeded [true/false]</returns> public new bool ScrapeFanart(string id, int threadID, out BindingList <ImageDetailsModel> output, string logCatagory) { output = new BindingList <ImageDetailsModel>(); try { var fanartDownloadHtml = Downloader.ProcessDownload(string.Format("http://www.kinopoisk.ru/level/12/film/{0}/", id), DownloadType.Html, Section.Movies). RemoveCharacterReturn(); var fanartMatches = YRegex.Matches( @"/picture/(?<fanart>\d*?)/w_size/1024/", fanartDownloadHtml, "fanart"); foreach (var s in fanartMatches) { var downloadFanartHtml = Downloader.ProcessDownload(string.Format("http://www.kinopoisk.ru/picture/{0}/w_size/1024/", s), DownloadType.Html, Section.Movies). RemoveCharacterReturn(); var match = Regex.Match( downloadFanartHtml, " src='(?<url>http://st.*?)' width='1024'"); if (match.Success) { output.Add(new ImageDetailsModel { UriFull = new Uri(match.Groups["url"].Value) }); } } return(output.IsFilled()); } catch (Exception ex) { Log.WriteToLog(LogSeverity.Error, threadID, logCatagory, ex.Message); return(false); } }