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('========================')
返回:
2 条评论
教我Python
就老师给我们找了老师专门学的网页爬虫,就博客这些了 别的也不会