import requests
import json
# 第四次作业:获取简书某一关注的文章首页标题列表
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like xxxxxxxxxxxxxxxxxxxxxx/74.0.3729.169 Safari/537.36',
'cookie':'__yadk_uid=asM6WB6ORE5yzvlMoUPhIrDyEwx13Nlt; remember_user_token=W1sxNDU5MTQ5Nl0sIiQyYSQxMSQuUUgvbmtaaC9lc1F6QlFFYUhvbnxxxxxxxxxuxxxxxxxxxxxxxxxxxxx=1'
}
url ='https://www.jianshu.com/subscriptions/3788725'
def get_info(url):
res = requests.get(url,headers=headers)
json_data = json.loads(res.text)
#print(json_data)
sources = json_data['source']
nickname = sources['nickname']
print(nickname)
for iin range(0,20):
note = sources['notes'][i]['title']
print(note)
else:
pass
get_info(url)