static public HitomiArticle ParseGallery(string source) { HitomiArticle article = new HitomiArticle(); HtmlDocument document = new HtmlDocument(); document.LoadHtml(source); HtmlNode nodes = document.DocumentNode.SelectNodes("//div[@class='cover-column']")[0]; article.Thumbnail = nodes.SelectSingleNode(".//div//img").GetAttributeValue("src", "").Substring("//tn.hitomi.la/".Length); return(article); }
static public List <HitomiArticle> ParseArticles(string source) { List <HitomiArticle> result = new List <HitomiArticle>(); // Get total blocks Regex regex = new Regex(article_block, RegexOptions.Multiline); Match match = regex.Match(source); while (match.Success) { HitomiArticle article = new HitomiArticle(); string block1 = match.Groups[1].Value; article.Magic = getMatch1(block1_magic, block1); article.Thumbnail = getMatch1(block1_thumbnail, block1); string block2 = match.Groups[2].Value; article.Title = replaceEntity(getMatch1(block2_title, block2)); article.Artists = new string[] { artist_legalize(getMatch1(block2_artist, block2)) }; // get only first artist string block3 = match.Groups[3].Value; article.Series = new string[] { series_legalize(getMatch1(block3_series, block3)) }; article.Types = getMatch1(block3_type, block3); article.Language = getMatch1(block3_language, block3); Regex regex_tags = new Regex(block3_tags, RegexOptions.Multiline); Match match_tags = regex_tags.Match(block3); List <string> tags = new List <string>(); while (match_tags.Success) { tags.Add(match_tags.Groups[1].Value); match_tags = match_tags.NextMatch(); } article.Tags = tags.ToArray(); result.Add(article); match = match.NextMatch(); } return(result); }