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
相关推荐
喵手8 小时前
Python爬虫实战:节奏律动 - Billboard Hot 100 历史榜单深度采集实战!喵手9 小时前
Python爬虫实战:数字时光机 - 基于 Playwright 的网页全貌归档系统(HTML + 截图)(附CSV导出 + SQLite持久化存储)!喵手10 小时前
Python爬虫实战:自动化构建 arXiv 本地知识库 - 从 PDF 下载到元数据索引!喵手11 小时前
Python爬虫实战:Spotify 公开歌单爬虫实战 - 打造你的全球音乐数据库!橙露1 天前
Python 异步爬虫进阶:协程 + 代理池高效爬取实战喵手1 天前
Python爬虫实战:地图 POI + 行政区反查(合规接口) - 商圈热力数据准备等!l1t1 天前
DeepSeek总结的DuckDB爬虫(crawler)扩展喵手1 天前
Python爬虫实战:电商问答/FAQ 语料构建 - 去重、分句、清洗,做检索语料等!喵手1 天前
Python爬虫实战:同名实体消歧 - 店铺/公司名规则合并与标准化等!喵手2 天前
Python爬虫实战:增量爬虫实战 - 利用 HTTP 缓存机制实现“极致减负”(附CSV导出 + SQLite持久化存储)!