Example #1
0
        /// <summary>
        /// Scrapes the release date value
        /// </summary>
        /// <param name="id">The MovieUniqueId for the scraper.</param>
        /// <param name="threadID">The thread MovieUniqueId.</param>
        /// <param name="output">The scraped release date value.</param>
        /// <param name="logCatagory">The log catagory.</param>
        /// <returns>Scrape succeeded [true/false]</returns>
        public new bool ScrapeReleaseDate(string id, int threadID, out DateTime output, string logCatagory)
        {
            output = new DateTime(1700, 1, 1);
            try
            {
                output = YRegex.MatchToDateTime(
                    @"(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})",
                    this.GetHtml("main", threadID, id),
                    "day",
                    "month",
                    "year");

                return(output.IsFilled());
            }
            catch (Exception ex)
            {
                Log.WriteToLog(LogSeverity.Error, threadID, logCatagory, ex.Message);
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// Scrapes the release date value
        /// </summary>
        /// <param name="id">The MovieUniqueId for the scraper.</param>
        /// <param name="threadID">The thread MovieUniqueId.</param>
        /// <param name="output">The scraped release date value.</param>
        /// <param name="logCatagory">The log catagory.</param>
        /// <returns>Scrape succeeded [true/false]</returns>
        public new bool ScrapeReleaseDate(string id, int threadID, out DateTime output, string logCatagory)
        {
            output = new DateTime(1700, 1, 1);

            var monthConvert = new Dictionary <string, int>
            {
                { "январь", 1 },
                { "февраль", 2 },
                { "март", 3 },
                { "апрель", 4 },
                { "май", 5 },
                { "июня", 6 },
                { "июль", 7 },
                { "август", 8 },
                { "сентябрь", 9 },
                { "октябрь", 10 },
                { "ноябрь", 11 },
                { "декабрь", 12 }
            };

            try
            {
                output = YRegex.MatchToDateTime(
                    @"(?<releasedate>(?<day>\d{2})\s(?<month>январь|февраль|март|апрель|май|июня|июль|август|сентябрь|октябрь|ноябрь|декабрь)\s(?<year>\d{4}))",
                    this.GetHtml("main", threadID, id),
                    "day",
                    "month",
                    "year",
                    monthConvert);

                return(output.IsFilled());
            }
            catch (Exception ex)
            {
                Log.WriteToLog(LogSeverity.Error, threadID, logCatagory, ex.Message);
                return(false);
            }
        }