private static void FindGamesInSection(HtmlNode parsedSection, HumbleSection section) { foreach (var itemTitle in parsedSection.CssSelect(".dd-image-box-caption")) { var itemName = itemTitle.InnerText.CleanInnerText(); if (section.Items.All(x => x.Name != itemName) && !itemName.StartsWith("More in")) { section.Items.Add(new HumbleItem() { Name = itemName }); } } if (parsedSection.CssSelect(".fi-content-body").Any()) { var itemName = parsedSection.CssSelect(".fi-content-body").First().InnerText.CleanInnerText(); if (section.Items.All(x => x.Name != itemName) && !itemName.StartsWith("More in")) { section.Items.Add(new HumbleItem() { Name = itemName }); } } }
private static void ScrapeSections(HumbleBundle bundle, HtmlNode response) { foreach (var parsedSection in response.CssSelect(".dd-game-row")) { string sectionTitle; try { sectionTitle = parsedSection.CssSelect(".dd-header-headline").First().InnerText.CleanInnerText(); } catch { sectionTitle = parsedSection.CssSelect(".fi-content-header").First().InnerText.CleanInnerText(); } if (sectionTitle.Contains("average")) { sectionTitle = "Beat the Average!"; } if (string.IsNullOrEmpty(sectionTitle)) { continue; } var sectionToAdd = new HumbleSection() { Title = sectionTitle }; FindGamesInSection(parsedSection, sectionToAdd); bundle.Sections.Add(sectionToAdd); } }