标签:header params int 爬取 https user like ons param
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 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2626.106 Safari/537.36‘
}
response = requests.get(url=url,params=param,headers=headers)
list_data = response.json()
fp = open(‘./douban.json‘, ‘w‘, encoding=‘utf-8‘)
json.dump(list_data,fp=fp,ensure_ascii=False)
print(‘over!!!‘)
标签:header params int 爬取 https user like ons param
原文地址:https://www.cnblogs.com/gerenboke/p/13388980.html