【发布时间】:2016-07-22 22:34:53
【问题描述】:
我想为某些 Quora 答案投票并查看数据。我正在尝试使用 Google 电子表格的 IMPORTXML 函数来执行此操作。要获取 Upvotes 数据,这是我正在使用的代码:
=IMPORTXML("https://www.quora.com/What-are-the-good-online-tutorials-and-books-to-learn-Android-development/answer/Pushpa-Latha-38","//span[@class='count']")
由于某种原因,这显示#N/A(导入的内容为空)消息。当我在 Chrome 的 XPath Helper 插件上使用相同的 XPath 查询时,我确实得到了数据。在执行此操作之前,我还使用类似代码获得了此答案的总视图:
=IMPORTXML("https://www.quora.com/What-are-the-good-online-tutorials-and-books-to-learn-Android-development/answer/Pushpa-Latha-38","//div[@class='CredibilityFact']")
这似乎工作正常。但不是第一个。那个有什么问题?
【问题讨论】:
标签: xml xpath xml-parsing google-sheets