看起来我的amazon associates帐户可能会被禁止。无论我等待多长时间,我都会收到503错误提示:“您提交请求的速度太快了。请以较慢的速度重试您的请求。”
我只是使用此API从ASIN获取标题和图像。
有没有更好的方法来获取这些信息?看起来协会api可能会禁止我,因为我没有任何与我的帐户相关的广告收入。
发布于 2019-02-16 01:01:39
信息很容易获取,只需抓取页面即可,而且没有节流。
我现在使用的是xpath:
<?php
$doc = new DOMDocument();
@$doc->loadHTMLFile('https://amazon.com/dp/' . $_GET['asin']);
$xpath = new DOMXPath($doc);
$title = $xpath->evaluate('//*[@id="productTitle"]');
$title = trim($title[0]->nodeValue);
$image = $xpath->evaluate('//*[@id="landingImage"]');
$image = trim($image[0]->getAttribute('src'));
$buybox = $xpath->evaluate('//*[@id="price_inside_buybox"]');
$buybox = trim($buybox[0]->nodeValue);
die(json_encode([
'asin' => $_GET['asin'],
'title' => $title,
'buybox' => str_replace('$', '', $buybox),
'image' => "<img src=\"" . $image . "\" />",
]));https://stackoverflow.com/questions/54712687
复制相似问题