import requests
import json
if __name__ =='__main__':
url ='https://movie.douban.com/j/chart/top_list'
param = {
'type':'24',
'interval_id':'100:90',
'action':'',
'start':'0',#从库中的第几部电影去取
'limit':'20'#一次请求取出的个数
}
headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15'}
resp = requests.get(url=url,params=param,headers=headers)
list_data = resp.json()
fp =open('./douban.json','w',encoding='utf-8')
json.dump(list_data,fp=fp,ensure_ascii=False)
print('over!!!!')
豆瓣电影名称,主演等信息
把爬取到的json文件内容用json在线解析和格式化一下,就得到
网友评论