import requests import json headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 UBrowser/6.2.4098.3 Safari/537.36'} url = 'https://movie.douban.com/j/chart/top_list' params = { 'type':'24', 'interval_id':'100:90', 'action':'', 'start':'0', 'limit':'20'} response = requests.get(url=url,params=params,headers=headers) obj = response.json() fp = open('./douban.json','w',encoding='UTF-8') json.dump(obj,fp=fp,ensure_ascii=False) print('战斗结束')