【问题标题】:C# web scraping with HtmlAgilityPack [closed]使用 HtmlAgilityPack 进行 C# Web 抓取 [关闭]
【发布时间】:2020-06-05 10:33:19
【问题描述】:

I want to create application in WPF wchich will scrape information from webpage

I read link to the page from text box at the top

I want to extract company name from h6

我不明白这种格式:“//h2[@class='card__title mdc-typography--headline6']”。我找不到文档 abot 表示 @ [] 等来创建另一个过滤器以 scrape 其他数据,例如标签中的电话号码。

【问题讨论】:

  • 您可以像 Selvin 所说的那样通过 CSS 选择器,也可以使用包支持的 XPath。使用最适合您的需求。

标签: c# web-scraping html-agility-pack


【解决方案1】:

@, //, ... 表示 XPath 选择器的缩写语法。

  • @abcattribute::abc 的缩写
  • ///descendant-or-self::node()/ 的缩写

因此,换句话说,您当前的查询//h2[@class='card__title mdc-typography--headline6'] 表示查找具有class 属性为card__title mdc-typography--headline6 的第一个后代或自身节点的操作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-02
    • 2018-12-10
    • 2021-02-02
    • 1970-01-01
    • 2011-01-06
    相关资源
    最近更新 更多