import requests
import json

url = 'https://club.jd.com/comment/productPageComments.action?productId=100026667884&score=0&sortType=5&page=0&pageSize=10&isShadowSku=0&fold=1'

headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36'
}

r = requests.get(url=url, headers=headers)
# print(r.text)
json_dict = json.loads(r.text)
json_list = json_dict['comments']

for data in json_list:
    print(data['content'])
    print('========================')

返回:

image.png

最后修改:2021 年 12 月 21 日
如果觉得我的文章对你有用,请随意赞赏