1

我最近发现了一段代码,可以帮助我将实时价格输入 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]"))

但是,当我在脚本编辑器中编写 xml 请求时,我无法发出成功的请求。

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

我尝试了几种不同的方法,但一直被 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>

难道我做错了什么?有没有解决的办法?

4

1 回答 1

0

您应该寻求利用他们的 API 而不是直接抓取网站,因为这是访问定价数据的首选方式。

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

于 2017-03-17T23:05:56.420 回答