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
相关推荐
一晌小贪欢17 小时前
Python爬虫第6课:Selenium自动化浏览器与动态内容抓取B站_计算机毕业设计之家2 天前
计算机毕业设计:Python农业数据可视化分析系统 气象数据 农业生产 粮食数据 播种数据 爬虫 Django框架 天气数据 降水量(源码+文档)✅爬虫程序猿2 天前
把 1688 商品详情搬进 MySQL:PHP 爬虫全链路实战(2025 版)一晌小贪欢2 天前
Python爬虫第7课:多线程与异步爬虫技术一百天成为python专家3 天前
python爬虫入门(小白五分钟从入门到精通)wanfeng_093 天前
python爬虫学习濑户川3 天前
基于DDGS实现图片搜索,文本搜索,新闻搜索Moniane3 天前
Web爬虫指南深蓝电商API3 天前
快速上手 Scrapy:5 分钟创建一个可扩展的爬虫项目直有两条腿3 天前
【爬虫】浏览器插件