import requests
from bs4 import BeautifulSoup
def get_actors():
actor_list = []
for i in range(0,10):
link = "http://movie.douban.com/top250?start="+str(i*25)
header = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 SE 2.X MetaSr 1.0","Host":"movie.douban.com" }
response = requests.get(link,headers = header)
#print(response.status_code)
soup = BeautifulSoup(response.text,"html.parser")
div_list = soup.find_all('div',class_='bd')
for each in div_list:
actor = each.p.text.strip()
actor_list.append(actor)
return actor_list
actors = get_actors()
print(actors)
第一个爬虫:获取演员表
FrankHuang8882024-04-27 15:07
相关推荐
步峰代理-盾山10 小时前
R语言爬虫实战:使用httr与XML解析网页数据并进行统计分析钱栈up14 小时前
三星盯上散热老玩家Modine:AI算力链最后一块拼图要进自家口袋tryCbest2 天前
Python 爬虫扩展篇(二):验证码的检测与人工介入——把“拦路虎”当作信号,而不是要征服的对手钱栈up3 天前
两台机器、一个 AI 记忆库:101 秒把 137 个文件对齐钱栈up3 天前
外网通、QQ 登不上:一条 workbuddy 脚本塞进去的路由三天没还回来choicesages3 天前
跑通不等于跑对:公开评论抓取里三处不报错的坐标问题钱栈up4 天前
烧结秤校准改造:一个 0.93 系数差点让整条日报线算错数Jack N4 天前
当爬虫学会“思考”:2026 数据采集的 AI 觉醒与工程突围用户738161846824 天前
换 UA 还是 403?我测了 4 个站 × 3 层,字节数一字不变钱栈up4 天前
奥迪上汽拍板「三年三款」,合资阵营的换挡节奏终于跟上了