?
獲取訪問令牌
調(diào)用OAuth2.0認(rèn)證接口獲取access_token:
import requests auth_url = "https://oauth.jd.com/oauth/token" params = { "client_id": "YOUR_APP_KEY", "client_secret": "YOUR_SECRET", "grant_type": "access_token", "scope": "product_comment" } response = requests.post(auth_url, data=params) access_token = response.json()['access_token']

二、核心API調(diào)用
商品評論接口路徑:
https://api.jd.com/routerjson?method=jingdong.biz.product.comment.list.query
請求參數(shù)示例:
payload = { "token": access_token, "method": "jingdong.biz.product.comment.list.query", "skuId": "100000000001", # 商品編號 "page": 1, "pageSize": 10, "type": "1" # 1=全部評論 2=好評 3=中評 4=差評 } headers = {"Content-Type": "application/json"}

三、分頁處理邏輯
響應(yīng)數(shù)據(jù)結(jié)構(gòu)包含關(guān)鍵字段:
{
"result": {
"comments": [
{
"content": "質(zhì)量非常好",
"creationTime": "2023-05-20 14:30:00",
"score": 5
}
],
"total": 128 # 總評論數(shù)
}
}

分頁計算示例:
total_comments = response['result']['total'] total_pages = (total_comments + pageSize - 1) // pageSize

四、數(shù)據(jù)解析技巧
時間戳轉(zhuǎn)換
from datetime import datetime
comment_time = datetime.strptime(
comment['creationTime'],
'%Y-%m-%d %H:%M:%S'
)

評分分布統(tǒng)計
score_counts = {5:0, 4:0, 3:0, 2:0, 1:0}
for comment in comments:
score_counts[comment['score']] += 1

五、注意事項(xiàng)
頻率限制:單賬號每分鐘不超過100次請求
字段說明:
score:評分(1-5分)
usefulVoteCount:點(diǎn)贊數(shù)
replyCount:回復(fù)數(shù)
實(shí)踐提示:建議配合京東商品詳情API(jingdong.biz.product.get)構(gòu)建完整商品分析系統(tǒng),通過skuId關(guān)聯(lián)商品基礎(chǔ)信息。
?審核編輯 黃宇
-
API
+關(guān)注
關(guān)注
2文章
2387瀏覽量
66821 -
京東
+關(guān)注
關(guān)注
2文章
1116瀏覽量
50097
發(fā)布評論請先 登錄
獲取Ozon商品詳情數(shù)據(jù)的API接口技術(shù)指南
京東商品評論API(jd.item_review)開發(fā)指南
淘寶商品評論API接口(taobao.item_review)指南
1688商品評論API使用指南
淘寶商品評論電商API接口:提升銷量與用戶評論的深入解析
京東API實(shí)時接口:京東商品評論數(shù)據(jù)接口
技術(shù)探索 | 淘寶平臺商品評論數(shù)據(jù)獲取方法與接口淺析
淘寶平臺獲取商品視頻 API 接口技術(shù)指南
亞馬遜獲取商品評論的API接口
用快手電商 API 實(shí)現(xiàn)快手小店商品評論情感分析
電商 API 接口:多平臺商品評論分析的利器
產(chǎn)品評論獲取API接口
京東商品評論API接口技術(shù)實(shí)踐指南
評論