import requests
import json
import openpyxl
headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36'}
wk=openpyxl.Workbook()
sheet=wk.create_sheet()
resp=requests.get('https://club.jd.com/comment/productPageComments.action?callback=fetchJSON_comment98&productId=100022734401&score=0&sortType=5&page=0&pageSize=10&isShadowSku=0&fold=1',headers=headers)
content=resp.text
# print(content)
rest=content.replace('fetchJSON_comment98(','').replace(');','')
print(rest)
json_data=json.loads(rest)
comments=json_data['comments']
for item in comments:
  color=item['productColor']
  time=item['creationTime']
  print(color)
  print(time)
  sheet.append([color,time])
  wk.save('H:\excerse.xlsx')