本帖最后由 xiaosi4081 于 2020-6-7 20:36 编辑
是储存数据的文件,你可以去抓取那里
代码:import requests
import json
import re
url = 'https://book.douban.com/ithil_j/activity/book_annual2016/widget/4'
headers = {
"User-Agent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'
}
response = requests.get(url=url,headers=headers)
target = json.loads(response.text)
html_url = []
title = []
for i in range(0,9+1):
html_url.append(target['res']['subjects'][i]['m_url'])
title.append(target['res']['subjects'][i]['title'])
for each in range(0,9+1):
print(title[each],html_url[each],sep = ':')
如果帮助到你了,记得设置最佳哈
|