【问题标题】:How to get the correct XPath for Google Sheets' IMPORTXML on the Steam Workshop?如何在 Steam 创意工坊上为 Google 表格的 IMPORTXML 获取正确的 XPath?
【发布时间】:2019-07-22 00:57:00
【问题描述】:

我正在尝试设置 Google 表格文档以从 Steam 创意工坊获取模组更新日期和时间。如何找到 ImportXML XPath 字段的正确值?

我已尝试为我要获取的特定值复制 XPath,但它似乎不起作用。

=IMPORTXML("https://steamcommunity.com/sharedfiles/filedetails/?id=843425103", //*[@id="mainContents"]/div[11]/div/div[2]/div[4]/div[2]/div[3]])

我希望它的输出是 Sep 16, 2018 @ 5:24pm 相反,它告诉我我有一个公式解析错误。

【问题讨论】:

    标签: xpath web-scraping google-sheets google-sheets-formula google-sheets-importxml


    【解决方案1】:

    确实你的语法是错误的。 XPath 需要引用,并且不允许在其中使用双引号,因此:

    =IMPORTXML("https://steamcommunity.com/sharedfiles/filedetails/?id=843425103", 
     "//*[@id='mainContents']")
    

    示例:

    =IMPORTxML("https://steamcommunity.com/sharedfiles/filedetails/?id=843425103", 
     "//div[@class='detailsStatRight']")
    

    【讨论】:

      猜你喜欢
      • 2022-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-15
      相关资源
      最近更新 更多