思路:
- 数据采集
- 清洗入库
- 分析处理
1. 数据采集
接口地址
https://m.maoyan.com/mmdb/comments/movie/257706.json?_v_=yes&offset=15&startTime=
解析地址:
257706 代表电影ID 长津湖
offset=15 代表:每次加载多少条数据15条
startTime: 从什么时间段开始加载
API_URL = "https://m.maoyan.com/mmdb/comments/movie/{movie_id}.json?_v_=yes&offset=15&startTime={last_time}"
# 获取长津湖 的最新的评论数据
url = API_URL.format(movie_id=257706, last_time="")
print(url)
# 获取较早期的 评论数据
url = API_URL.format(movie_id=257706, last_time="2021-10-05 13:01:10")
print(url)
触发反爬
抱歉,您的访问请求过于频繁
解决反爬
把自己伪装一个普通用户
修改请求,把Py