web-scraping - (明智的价格比较)IMPORTXML - 导入的内容为空

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

开始我作为数据分析师的旅程。我正在尝试从 Transferwise(Wise 的)价格比较网站上抓取一张表格。我尝试过:

  • 将网址复制并粘贴到 Google 表格的 A1 单元格中
  • 检查网站上的表格行
  • 将完整的 Xpath 复制并粘贴到 Google 表格的 A2 单元格中
  • 编写公式:=importxml(A1,A2)
  • 收到错误

Inspecting table row on Wise price comparison website

Google Sheets error

如果网站使用 API 填充表格,IMPORTXML 通常不起作用吗?例如,这些表格与维基百科上的表格似乎有所不同。

最佳答案

无法通过 importxml 检索信息,因为该页面是由客户端而不是服务器端的 javascript 构建的。您正在寻找的实际上是一个脚本!

<script>
          (function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s);
            js.id = id;
            js.src = "https://widgets.wise.com/widgets.js";
            fjs.parentNode.insertBefore(js, fjs);
          }(document, "script", "transferwise-wjs"));
</script>

在这里查看其他评论https://webapps.stackexchange.com/questions/115664/how-to-know-if-google-sheets-importdata-importfeed-importhtml-or-importxml-fun

关于web-scraping - (明智的价格比较)IMPORTXML - 导入的内容为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69349558/

相关文章:

javascript - 如何定位重复的 JS 元素 BeautifulSoup Python

python - 使用scrapy分页

arrays - Brain Bender ...数组公式不使用 FILTER 函数填充单元格

javascript - jQuery 通过 XPath 选择元素

c# - 如何从 XDocument 中获取 NameTable?

Python Beautiful Soup 只抓取页面的下半部分

python - 尝试通过 Chromedriver 2.34、Selenium 3.8 和 Python 3.6.2 登录 Wells Fargo 时出错

javascript - 在 Google 脚本 If 语句中运行 RegEx

javascript - Google 表格、脚本在制作副本后停止工作。

c# - 如何从一个xml文件中读取多个属性