本文整理汇总了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;
}
示例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;
}
示例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)
};
}
示例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);
}
示例5: GetScoreMark
private short GetScoreMark(HtmlNode reviewNode)
{
return (short) (int.Parse(reviewNode.QuerySelector(".summary").InnerText.Trim().Substring(0,1)) * 2);
}
示例6: GetReviewBody
private string GetReviewBody(HtmlNode reviewNode)
{
return reviewNode.QuerySelector(".opinionContent p").InnerText;
}
示例7: GetAddedOn
private DateTime GetAddedOn(HtmlNode reviewNode)
{
return DateTime.Parse(reviewNode.QuerySelector(".addDate").InnerText);
}
示例8: QuerySelector
public HtmlNode QuerySelector(HtmlNode node, string query)
{
return node.QuerySelector(query);
}
示例9: SelectItem
protected HtmlNode SelectItem(HtmlNode cq, string css)
{
return cq.QuerySelector(css);
}
示例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;
}
示例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);
}
示例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);
}
示例13: GetReviewer
private static string GetReviewer(HtmlNode reviewNode)
{
return reviewNode.QuerySelector(".product-reviewer").InnerText.Trim();
}
示例14: GetAddedOn
private static DateTime GetAddedOn(HtmlNode reviewNode)
{
return DateTime.Parse(reviewNode.QuerySelector(".review-time time").Attributes["datetime"].Value);
}
示例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;
}