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
相关推荐
菩提树下的凡夫14 小时前
利用Python实现获取无人机图片并自动下载保存的简易爬虫码界奇点14 小时前
基于Python的微信公众号爬虫系统设计与实现小白学大数据16 小时前
抖音搜索页数据批量爬取,多关键词同步采集实现tang7778917 小时前
爬虫爬公开数据被封?实测有效!从原因排查到落地解决全指南Jelena1577958579220 小时前
Python 爬虫获取淘宝商品详情(标题、主图、SKU、价格)实战指南上海云盾-小余20 小时前
游戏业务接口防护:防爬虫、防刷量、防恶意请求一体化方案星空椰2 天前
从零到实战:一套完整的 Python 爬虫技术体系(requests + BeautifulSoup + 正则 + JSON)zhangfeng11333 天前
合法爬虫四底线 法律边界S1998_1997111609•X3 天前
论恶意注入污染蜜罐进程函数值取仺⺋以集团犯罪获取数据爬虫的轮系依据大邳草民3 天前
Python 爬虫:从 HTTP 请求到接口分析