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 小时前
【爬虫】- 爬虫原理及其入门datascome18 小时前
文章发布易优CMS(Eyoucms)网站技巧傻啦嘿哟1 天前
Python爬虫动态IP代理报错全解析:从问题定位到实战优化用户668578810681 天前
使用 Python 编写一个简单的网页爬虫q567315231 天前
Koa+Puppeteer爬虫教程页面设计傻啦嘿哟2 天前
长效住宅代理IP:反爬虫战场上的隐形盾牌华科云商xiao徐2 天前
冷门但好用的Python库写个爬虫代码华科云商xiao徐2 天前
Koa+Puppeteer爬虫教程页面设计Python×CATIA工业智造2 天前
列表页与详情页的智能识别:多维度判定方法与工业级实现失败又激情的man3 天前
python之requests库解析