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
相关推荐
喵手6 小时前
Python爬虫实战:电商问答语料构建完整实战 - 从爬取到检索语料的工程化实现(附CSV导出 + SQLite持久化存储)!yq19820430115611 小时前
基于Python爬虫原理的Pinterest视频资源获取技术解析与工具实践喵手11 小时前
Python爬虫实战:自动化质量护航 - 构建爬虫数据的“熔断与巡检”规则引擎实战!嚯嚯歪1 天前
攻克腾讯 TCaptcha 滑块验证码:纯 HTTP 协议逆向实战喵手1 天前
Python爬虫实战:构建一个高健壮性的图书数据采集器!喵手1 天前
Python爬虫实战:监控型爬虫实战 - 从结构检测到智能告警的完整方案(附CSV导出 + SQLite持久化存储)!深蓝电商API1 天前
爬虫中 Cookie 池维护与自动刷新喵手1 天前
Python爬虫实战:开放数据多格式入仓 - 构建统一数据管道(附CSV导出 + SQLite持久化存储)!流烟默1 天前
Python爬虫之下载豆瓣电影图片到本地喵手1 天前
Python爬虫实战:构建“时光机”——网站数据增量监控与差异分析系统!