/// <summary>Build's a description from a show row</summary>
 /// <param name="showRow">Show Row Node</param>
 /// <returns>Description Text</returns>
 private string BuildDescription(HtmlNode showRow)
 {
     // HACK: They don't stick the description in it's own element, so you need to grab it out from inside of the table cell
     var description = showRow.QuerySelector("td:nth-child(3) div").InnerHtml;
     description = description.Substring(description.IndexOf("<br class=\"lineHeight5\">", StringComparison.CurrentCulture) + 24);
     description = description.Substring(0, description.Length - 6); // remove the final <br> tag
     return description;
 }
        private static string GetReviewBody(HtmlNode reviewNode)
        {
            var reviewBody = reviewNode.QuerySelector(".product-review-body").InnerText;
            if (reviewBody.Length > 4000)
            {
                reviewBody = reviewBody.Substring(0, 4000);
            }

            return reviewBody;
        }
Esempio n. 3
0
        private static SLForumMember parseMember(HtmlNode node)
        {
            string USERNAME_SEARCH = "h3.post-title a";
            string POST_LEVEL_SEARCH = "p.post-level";
            string POST_POINTS_SEARCH = "p.post-points";
            string POST_COUNT_SEARCH = "p.post-count";

            string ppString = node.QuerySelector(POST_POINTS_SEARCH).InnerText;
            ppString = ppString.Substring(0, ppString.IndexOf(' '));
            string pcString = node.QuerySelector(POST_COUNT_SEARCH).InnerText;
            pcString = pcString.Substring(0, pcString.IndexOf(' '));

            return new SLForumMember()
            {
                Username = node.QuerySelector(USERNAME_SEARCH).InnerText,
                PostLevel = node.QuerySelector(POST_LEVEL_SEARCH).InnerText,
                PostPoints = int.Parse(ppString),
                PostCount = int.Parse(pcString)
            };
        }
Esempio n. 4
0
 /// <summary>
 /// Css selector for a single result
 /// </summary>
 /// <param name="node">Node to query</param>
 /// <param name="query">Css selector query</param>
 /// <returns>HtmlNode result</returns>
 protected HtmlNode QuerySelector(HtmlNode node, string query)
 {
     return node.QuerySelector(query);
 }
 private short GetScoreMark(HtmlNode reviewNode)
 {
     return (short) (int.Parse(reviewNode.QuerySelector(".summary").InnerText.Trim().Substring(0,1)) * 2);
 }
 private string GetReviewBody(HtmlNode reviewNode)
 {
     return reviewNode.QuerySelector(".opinionContent p").InnerText;
 }
 private DateTime GetAddedOn(HtmlNode reviewNode)
 {
     return DateTime.Parse(reviewNode.QuerySelector(".addDate").InnerText);
 }
Esempio n. 8
0
 public HtmlNode QuerySelector(HtmlNode node, string query)
 {
     return node.QuerySelector(query);
 }
Esempio n. 9
0
 protected HtmlNode SelectItem(HtmlNode cq, string css)
 {
     return cq.QuerySelector(css);
 }
        private Recommendation GetRecommendation(HtmlNode reviewNode)
        {
            var productReviewSummary = reviewNode.QuerySelector(".product-review-summary em");
            if (productReviewSummary == null)
                return Recommendation.LackOfInformation;

            if (productReviewSummary.Attributes.First(x => x.Name == "class").Value == "product-recommended")
                return Recommendation.ProductRecommended;
            else
                return Recommendation.ProductNotRecommended;
        }
 private static int GetUsefulnessBaseCount(HtmlNode reviewNode, int productReviewId)
 {
     return int.Parse(reviewNode.QuerySelector(string.Format(".product-review-usefulness-stats #votes-{0}", productReviewId)).InnerText);
 }
 private static short GetScoreMark(HtmlNode reviewNode)
 {
     var scoreRate = Regex.Match(reviewNode.QuerySelector(".review-score-count").InnerText, "[\\d,]+").Value;
     var scoreMark = double.Parse(scoreRate.Replace(',', '.'), CultureInfo.InvariantCulture) * 2;
     return Convert.ToInt16(scoreMark);
 }
 private static string GetReviewer(HtmlNode reviewNode)
 {
     return reviewNode.QuerySelector(".product-reviewer").InnerText.Trim();
 }
 private static DateTime GetAddedOn(HtmlNode reviewNode)
 {
     return DateTime.Parse(reviewNode.QuerySelector(".review-time time").Attributes["datetime"].Value);
 }
        private ProductReview GetReview(HtmlNode reviewNode)
        {
            var productReviewId = int.Parse(reviewNode.QuerySelector(".product-review-vote").Attributes["data-review-id"].Value);

            var productReview = new ProductReview
            {
                Reviewer = GetReviewer(reviewNode),
                AddedOn = GetAddedOn(reviewNode),
                Body = GetReviewBody(reviewNode),
                Recommendation = GetRecommendation(reviewNode),
                ScoreMark = GetScoreMark(reviewNode),
                ConsideredAsUsefulCount = GetConsideredAsUsefulCount(reviewNode, productReviewId),
                UsefulnessBaseCount = GetUsefulnessBaseCount(reviewNode, productReviewId),
                ProductAdventages = GetProductAdventages(reviewNode),
                ProductDisadvantages = GetProductDisadvantages(reviewNode)
            };

            return productReview;
        }
Esempio n. 16
0
 protected virtual DateTime GetDate(HtmlNode tweetNode)
 {
     return new DateTime(new DateTime(1970, 1, 1, 0, 0, 0).Ticks + long.Parse(tweetNode.QuerySelector(".js-short-timestamp").Attributes["data-time"].Value) * 10000 * 1000);
 }