Beispiel #1
0
        private string ParseAuthor(ScrapedTextElement authorTextElement)
        {
            Match match = Regex.Match(authorTextElement.Content, @"Dodane przez:(.+)\(2");

            if (match.Success && match.Groups?.Count > 1)
            {
                string matchedValue = match.Groups[1].Value;
                return(matchedValue.Trim()
                       .TrimStart('~')
                       .TrimEnd('\''));
            }

            return(String.Empty);
        }
Beispiel #2
0
        private DateTime ParseDate(ScrapedTextElement dateTextElement)
        {
            Match match = Regex.Match(dateTextElement.Content, @"\d{4}-\d{2}-\d{2} \d{2}:\d{2}");

            if (match.Success)
            {
                string matchedValue = match.Value;

                if (DateTime.TryParseExact(matchedValue, "yyyy-MM-dd HH:mm", null, System.Globalization.DateTimeStyles.None, out DateTime dt))
                {
                    return(dt);
                }
            }

            return(new DateTime());
        }