怎么爬取豆瓣电影信息

import requests

hearders = {
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"
}
url = 'https://movie.douban.com/j/chart/top_list?type=24&interval_id=100%3A90&action=&start=0&limit=20'
params = {'type': '24',
'interval_id': '100:90',
'action': "",
'start': '0',
'limit': '20'}
response = requests.get(url=url, headers=hearders, params=params)
page_text = response.json()
for dic in page_text:
name = dic['title']
score = dic['score']
print(name, score)

 

posted @ 2020-05-17 17:50  大魔头的取经故事  阅读(272)  评论(0编辑  收藏  举报