Amazon price in Google Spreadsheets

浪子不回头ぞ 提交于 2019-12-10 14:19:11

问题


I tried following the answers gave here, but I get the error Imported Xml content can not be parsed.

Here's what I tried:

=importXml("http://www.amazon.it/Asus-GeForce-Scheda-Display-Edition/dp/B00SKWIISQ/","//span[@id='priceblock_ourprice']")

=importxml(hyperlink(concatenate("http://www.amazon.it/Asus-GeForce-Scheda-Display-Edition/dp/B00SKWIISQ/")),"//*[@id='priceblock_ourprice']")

None of them worked..

EDIT: The functions are intermittently working. Seems there's an issue specifically with the Amazon site as sometimes this works, sometimes it doesn't (and I get "imported content cannot be parsed"). When it doesn't, sometimes if I add or remove the trailing slash it works again. No problem with other sites. Seems a known issue: https://productforums.google.com/forum/#!topic/docs/UuMGRl7Asew https://productforums.google.com/forum/#!topic/docs/yWPaNDK0Kpg What's a mistery is the cause.


回答1:


if you try //* xPath, then you'll see that Amazon is making a robot check. That is the reason of unsuccessful parsing.

Unfortunately, I can't see the obvious way to overcome this.

And, as to changing comma to semicolon and vice versa - it doesn't work, because it depends on your local settings for Google Spreadheet, which delimiter you have to use in functions. For some countries it's a comma, for others it's a semicolon.




回答2:


Try this:

=importXml("http://www.amazon.it/Asus-GeForce-Scheda-Display-Edition/dp/B00SKWIISQ";"//span[@id='priceblock_ourprice']")

I changed the colon to semicolon and removed the trailing slash of the URL to make sure that no HTTP redirects are done.



来源:https://stackoverflow.com/questions/30004222/amazon-price-in-google-spreadsheets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!