import requests import time headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', 'referer': 'http://movie.mtime.com/209164/comment'} for page in range(1, 11): params = {'tt' : ''.format(time.time()* 1000), 'movieId' : '209164', 'pageIndex' : page, 'pageSize' : 200, 'orderType' :1 } res = requests.get('http://front-gateway.mtime.com/library/movie/longCommentList.api', headers = headers, params = params) comment_lists = res.json()['data']['list'] time.sleep(1) for i in comment_lists: print('用户昵称:', i['nickname']) print('影评内容:', i['content']) print('用户打分:', i['rating'])
标签:comment,时光,爬虫,headers,params,影评,time,print From: https://www.cnblogs.com/v9193/p/17643228.html