image.png
import json
import requests
if __name__=="__main__":
url = "https://m.douban.com/rexxar/api/v2/movie/recommend?"
param = {
'refresh': '0',
'start': '0',
'count': '20',
'selected_categories': '{}',
'uncollect': 'false',
'tags': '艺术'
}
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36',
}
response = requests.get(url=url,params=param,headers=headers)
list_data = response.json()
file_path=open('./douban.json','w',encoding='utf-8')
json.dump(list_data,fp=file_path,ensure_ascii=False)
import json
import requests
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_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36',
}
response = requests.get(url=url,params=param,headers=headers)
list_data = response.json()
file_path=open('./douban.json','w',encoding='utf-8')
json.dump(list_data,fp=file_path,ensure_ascii=False)
网友评论