public Hotukdeals Hotukdeal() { reader.Load(URL); // skip through rss and only head over to Item node XmlNodeList items = reader.SelectNodes("rss/channel/item"); Hotukdeals hotukdeal = new Hotukdeals(); foreach (XmlNode item in items) { hotukdeal.addDeal(Parser.parseRssItem(item)); } return(hotukdeal); }
public Hotukdeals Hotukdeal() { var deals = page.DocumentNode.SelectNodes("//*[@class='threadGrid']"); Hotukdeals hotukdeals = new Hotukdeals(); var category = page.DocumentNode.SelectSingleNode("//*[@class='size--all-xxl text--b cept-nav-subheadline']").InnerText; var categoryImage = page.DocumentNode.SelectSingleNode("//*[@class='img img--type-collection img--square-xl img--toW2-square-m img--noBorder boxShadow']").Attributes["src"].Value; foreach (var deal in deals) { // check if the title is not null otherwise skip it if (validDeal(deal)) { if (!expiredDeal(deal)) { var titleNode = deal.SelectSingleNode(".//a[@class ='cept-tt thread-link linkPlain thread-title--list' ]"); var title = HttpUtility.HtmlDecode(titleNode.InnerText).Trim(); var link = titleNode.Attributes["href"].Value; // by pass the lazy load images var imageLink = $"https://images.hotukdeals.com/threads/thread_large/default/{Parser.forumNumber(link)}_1.jpg"; var price = getPrice(deal); var description = deal.SelectSingleNode(".//div[@class='cept-description-container overflow--wrap-break width--all-12 size--all-s size--fromW3-m']").InnerText; description = description.Replace("Read more", ""); var hotMeters = hotMeter(deal); var merchantName = getMerchantName(deal); var directLink = Parser.getDirectLink(link); var commentCounts = commentCount(deal, link); var madeHotDate = deal.SelectSingleNode(".//span[@class ='hide--toW3']").InnerText; Deal aDeal = new DealBuilder() .Name(title) .Link(link) .ImageLink(imageLink) .Price(price) .Description(description) .HotMeter(hotMeters) .MerchantName(merchantName) .DirectLink(directLink) .Comment(commentCounts) .MadeHot(madeHotDate) .Category(category) .CategoryImage(categoryImage) .Build(); hotukdeals.addDeal(aDeal); } } } return(hotukdeals); }