import requests
import time
from lxml import etree
for a in range(3):
url = 'https://movie.douban.com/j/new_search_subjects?sort=T&range=0,10&tags=&start={}'.format(a*20)
file = requests.get(url).json()
time.sleep(3)
for i in range(20):
dict = file['data'][i]
urlname = dict['url']
title = dict['title']
rate = dict['rate']
cast = dict['casts']
print('{} {} {} {}\n'.format(title,rate,' '.join(cast),urlname))
-
输出情况如图(截取部分数据)