Amazon AdSystem无响应求助:无法获取ASIN详情
解决Amazon AdSystem旧接口失效及获取ASIN详情的方案
那个ws-na.amazon-adsystem.com的旧Widget API已被Amazon官方弃用并停止服务,所以你之前的请求链接无响应是正常情况。要合法获取ASIN(如B097TVLB4F)的名称、图片、价格、评分等详情,需使用Amazon Product Advertising API(原Amazon Associates Product Advertising API),以下是具体步骤和示例:
1. 准备工作
- 注册成为Amazon Associates会员,获取你的Associate Tag
- 在AWS控制台创建IAM用户,生成对应的
AWS_ACCESS_KEY_ID和AWS_SECRET_ACCESS_KEY(需关联Product Advertising API权限)
2. API调用示例(以Python为例)
使用第三方库bottlenose简化API调用,先安装库:
pip install bottlenose
编写代码获取目标ASIN的详情:
import bottlenose from xml.etree import ElementTree # 替换为你的密钥信息 amazon = bottlenose.Amazon( AWS_ACCESS_KEY_ID='你的Access Key', AWS_SECRET_ACCESS_KEY='你的Secret Key', AWS_ASSOCIATE_TAG='你的Associate Tag', Region='US' ) # 调用ItemLookup接口,指定ASIN和需要返回的字段组 response = amazon.ItemLookup( ItemId='B097TVLB4F', ResponseGroup='Large' # Large包含商品属性、图片、价格、评分等核心信息 ) # 解析XML响应 root = ElementTree.fromstring(response) # 提取所需信息(根据实际结构调整路径) try: title = root.find('.//ItemAttributes/Title').text image_url = root.find('.//LargeImage/URL').text lowest_new_price = root.find('.//OfferSummary/LowestNewPrice/FormattedPrice').text average_rating = root.find('.//CustomerReviews/AverageRating').text print(f"商品名称: {title}") print(f"大图链接: {image_url}") print(f"最低新价: {lowest_new_price}") print(f"平均评分: {average_rating}") except AttributeError: print("部分信息未找到,请检查ASIN有效性或ResponseGroup设置")
3. 关键注意事项
- 必须使用合法的API凭证,未授权的请求会被直接拒绝
- 严格遵守Amazon的API调用限制(如每秒请求数、每日请求上限),否则会触发限流
- 可通过调整
ResponseGroup参数自定义返回字段,例如ResponseGroup='ItemAttributes,Images,Offers,CustomerReviews'仅获取指定模块数据
内容的提问来源于stack exchange,提问作者Aamir Noman
相关产品推荐
相关产品推荐

