使用importXML导致“导入的内容为空". Google Spreadsheets上的错误 [英] Using importXML results in "Imported Content is Empty" error on Google Spreadsheets
问题描述
我要做什么:
从 https://www.luno.com/en动态导入比特币/BTC价格/price/,或 https://www.luno.com/en/price/BTC .
因此,我已阅读(无论如何在此站点上)有关importXML
的所有内容,但找不到我在做什么.我的方法在其他网站上也可以使用,但在该网站上可以获得预期的结果,但是使用importXML
无效.请参阅下面我正在使用的代码(我使用了其他变体,但这是使用SelectorGadget
建议的代码:
So I've read everything there is to read (on this site anyway) about importXML
, and cannot find what I'm doing wrong. My method works on other websites, where I get a list of expected results, however, using importXML
is not working. See below code I'm using (I've used other variants, but this is the one suggested using SelectorGadget
:
=IMPORTXML("https://www.luno.com/en/price/", "//*[contains(concat( ' ', @class, ' ' ), concat( ' ', 'ng-binding', ' ' ))]")
当然,我收到了可怕的"导入的内容为空"错误.
Of course, I get the dreaded " Imported Content is Empty " error.
有帮助吗?
推荐答案
您可以加载此ajax端点以获取当前的USD:
You can load this ajax endpoint to get the current USD:
https://www.luno.com/ajax/1/display_ticker
或对于所有货币对:
https://www.luno.com/ajax/1/price_chart?currency=
如果您想解析json-有一个很棒的-已经编写了importJson脚本(
if your want to parse the json - there is a wonderful - already written importJson script (https://github.com/bradjasper/ImportJSON/blob/master/ImportJSON.gs), you literally just copy paste it into your apps script and then call the url directly as such:
=importJSON("https://www.luno.com/ajax/1/price_chart?currency=")
或
=importJSON("https://www.luno.com/ajax/1/display_ticker?currency=XBT")
这篇关于使用importXML导致“导入的内容为空". Google Spreadsheets上的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!