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持久化存储)!喵手11 小时前
Python爬虫实战:基于ETag/Last-Modified的智能条件请求与流量优化!小恰学逆向1 天前
【爬虫JS逆向实战】关于this指向的逆向实战——某产权交易中心数据解密喵手1 天前
Python爬虫实战:网抑云音乐热门歌单爬虫实战 - 从入门到数据分析的完整指南!喵手1 天前
Python爬虫实战:节奏律动 - Billboard Hot 100 历史榜单深度采集实战!喵手1 天前
Python爬虫实战:数字时光机 - 基于 Playwright 的网页全貌归档系统(HTML + 截图)(附CSV导出 + SQLite持久化存储)!喵手1 天前
Python爬虫实战:自动化构建 arXiv 本地知识库 - 从 PDF 下载到元数据索引!喵手2 天前
Python爬虫实战:Spotify 公开歌单爬虫实战 - 打造你的全球音乐数据库!橙露2 天前
Python 异步爬虫进阶:协程 + 代理池高效爬取实战喵手2 天前
Python爬虫实战:地图 POI + 行政区反查(合规接口) - 商圈热力数据准备等!