当前位置: 首页>>代码示例>>C#>>正文


C# HtmlNode.QuerySelector方法代码示例

本文整理汇总了C#中HtmlAgilityPack.HtmlNode.QuerySelector方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlNode.QuerySelector方法的具体用法?C# HtmlNode.QuerySelector怎么用?C# HtmlNode.QuerySelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlAgilityPack.HtmlNode的用法示例。


在下文中一共展示了HtmlNode.QuerySelector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildDescription

 /// <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;
 }
开发者ID:scottheckel,项目名称:mobile-tv-guide,代码行数:11,代码来源:DiscoveryChannelParser.cs

示例2: GetReviewBody

        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;
        }
开发者ID:Havret,项目名称:CeneoETL,代码行数:10,代码来源:CeneoProductReviewsProvider.cs

示例3: parseMember

        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)
            };
        }
开发者ID:asthomas,项目名称:Fayde,代码行数:20,代码来源:SLForumScraper.cs

示例4: QuerySelector

 /// <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);
 }
开发者ID:Alchemy86,项目名称:DAS-Desktop,代码行数:10,代码来源:HtmlParser.cs

示例5: GetScoreMark

 private short GetScoreMark(HtmlNode reviewNode)
 {
     return (short) (int.Parse(reviewNode.QuerySelector(".summary").InnerText.Trim().Substring(0,1)) * 2);
 }
开发者ID:Havret,项目名称:CeneoETL,代码行数:4,代码来源:KomputronikProductReviewProvider.cs

示例6: GetReviewBody

 private string GetReviewBody(HtmlNode reviewNode)
 {
     return reviewNode.QuerySelector(".opinionContent p").InnerText;
 }
开发者ID:Havret,项目名称:CeneoETL,代码行数:4,代码来源:KomputronikProductReviewProvider.cs

示例7: GetAddedOn

 private DateTime GetAddedOn(HtmlNode reviewNode)
 {
     return DateTime.Parse(reviewNode.QuerySelector(".addDate").InnerText);
 }
开发者ID:Havret,项目名称:CeneoETL,代码行数:4,代码来源:KomputronikProductReviewProvider.cs

示例8: QuerySelector

 public HtmlNode QuerySelector(HtmlNode node, string query)
 {
     return node.QuerySelector(query);
 }
开发者ID:Alchemy86,项目名称:GD_BackOrders,代码行数:4,代码来源:HtmlParser.cs

示例9: SelectItem

 protected HtmlNode SelectItem(HtmlNode cq, string css)
 {
     return cq.QuerySelector(css);
 }
开发者ID:huoxudong125,项目名称:VideoSearch,代码行数:4,代码来源:ScraperBase.cs

示例10: GetRecommendation

        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;
        }
开发者ID:Havret,项目名称:CeneoETL,代码行数:11,代码来源:CeneoProductReviewsProvider.cs

示例11: GetUsefulnessBaseCount

 private static int GetUsefulnessBaseCount(HtmlNode reviewNode, int productReviewId)
 {
     return int.Parse(reviewNode.QuerySelector(string.Format(".product-review-usefulness-stats #votes-{0}", productReviewId)).InnerText);
 }
开发者ID:Havret,项目名称:CeneoETL,代码行数:4,代码来源:CeneoProductReviewsProvider.cs

示例12: GetScoreMark

 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);
 }
开发者ID:Havret,项目名称:CeneoETL,代码行数:6,代码来源:CeneoProductReviewsProvider.cs

示例13: GetReviewer

 private static string GetReviewer(HtmlNode reviewNode)
 {
     return reviewNode.QuerySelector(".product-reviewer").InnerText.Trim();
 }
开发者ID:Havret,项目名称:CeneoETL,代码行数:4,代码来源:CeneoProductReviewsProvider.cs

示例14: GetAddedOn

 private static DateTime GetAddedOn(HtmlNode reviewNode)
 {
     return DateTime.Parse(reviewNode.QuerySelector(".review-time time").Attributes["datetime"].Value);
 }
开发者ID:Havret,项目名称:CeneoETL,代码行数:4,代码来源:CeneoProductReviewsProvider.cs

示例15: GetReview

        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;
        }
开发者ID:Havret,项目名称:CeneoETL,代码行数:19,代码来源:CeneoProductReviewsProvider.cs


注:本文中的HtmlAgilityPack.HtmlNode.QuerySelector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。