简体   繁体   English

这两个xml请求有何不同?

[英]How are these two xml requests different?

I found a piece of code recently to help me get live prices into Google Sheets and wanted to expand upon it: 我最近发现了一段代码,以帮助我将实时价格纳入Google表格,并希望对其进行扩展:

=min(importxml("http://shop.tcgplayer.com/productcatalog/product/show?IsProductNameExact=true&ProductName="&A5, "//div[contains(@class, 'scCardContent')]/span[@*] | //div[contains(@class, 'priceGuidePricePointDiv')][1]//tr[2]/td[contains(@class, 'priceGuidePricePointData')][1]"))

However, when I wrote an xml request in the script editor I was not able to make a successful request. 但是,当我在脚本编辑器中编写xml请求时,我无法成功发出请求。

  var xml = UrlFetchApp.fetch(tcgUrl).getContentText();

I tried several different ways but kept getting blocked(?) by Incapsula. 我尝试了几种不同的方式但是被Incapsula阻止了(?)。

 <html style="height:100%"><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><meta name="format-detection" content="telephone=no"><meta name="viewport" content="initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"></head><body style="margin:0px;height:100%"><iframe src="/_Incapsula_Resource?CWUDNSAI=9&xinfo=5-85037313-0 0NNN RT(1489553959732 1) q(0 -1 -1 -1) r(0 -1) B12(4,315,0) U18&incident_id=490000360254449935-589713359258649157&edet=12&cinfo=04000000" frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">Request unsuccessful. Incapsula incident ID: 490000360254449935-589713359258649157</iframe></body></html> 

Am I doing something wrong? 难道我做错了什么? Is there a way around this? 有没有解决的办法?

You should look to leverage their API instead of scraping the site directly, as that is the preferred way to access pricing data. 您应该利用他们的API而不是直接抓取网站,因为这是访问定价数据的首选方式。

https://help.tcgplayer.com/hc/en-us/articles/201577976-How-can-I-get-access-to-your-card-pricing-data- https://help.tcgplayer.com/hc/en-us/articles/201577976-How-can-I-get-access-to-your-card-pricing-data-

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM