无法从Dynamic Web Page使用importXML获取数据? [英] Can't get the data using importXML from Dynamic Web Page?

查看:91
本文介绍了无法从Dynamic Web Page使用importXML获取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该网站为: https://www.futbin.com/18/播放器/2600/Ayhan/

我检查元素并获得XPath,它是://*[@id="ps-lowest-1"]

I inspect the element and get the XPath which is: //*[@id="ps-lowest-1"]

然后我使用:

=IMPORTXML("https://www.futbin.com/18/player/2600/Ayhan/","//*[@id='ps-lowest-1']")

要获取应为2000

但是,它仅在工作表上显示:-.没有错误只是不显示我想要的数据.无论如何,有没有要获取我需要的数据?

But instead it only shows: - on the sheet. No errors just doesn't show the data that I want it to. Is there anyway to get the data that I need?

谢谢

推荐答案

Sheets命令importXML仅读取页面的HTML源,而不在页面上执行任何JavaScript.正如您在浏览器中使用查看源代码"所看到的那样,该源代码在该范围内确实具有-":

The Sheets command importXML reads only the HTML source of the page without executing any JavaScript on it. As you can see yourself by using "view source" in the browser, the source indeed has "-" in that span:

 <span class="price_big_right">
     <span id="ps-lowest-1">-</span>
 </span>

实际数字由某个JavaScript文件加载,然后将其插入该跨度中. importXML和其他Sheets函数都无法检索动态插入的数据.

The actual numbers are loaded by some JavaScript file which then inserts them in that span. Neither importXML nor other Sheets functions can retrieve dynamically inserted data.

有时,在检查了JS文件之后,您可以发现数据源的URL并尝试将其导入;但这对于每个特定站点来说都是繁琐的逆向工程.

Sometimes, after inspecting the JS files, one can uncover the URL of source of data and try to import that; but this is a tedious reverse engineering exercise for each particular site.

这篇关于无法从Dynamic Web Page使用importXML获取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆