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
相关推荐
攻城狮7号2 小时前
Python爬虫第21节- 基础图形验证码识别实战顾一大人17 小时前
dp自动化登陆之hCaptcha 验证码whoarethenext20 小时前
c/c++爬虫总结Dreams°1231 天前
【Python爬虫 !!!!!!政府招投标数据爬虫项目--医疗实例项目文档(提供源码!!!)!!!学会Python爬虫轻松赚外快】API小爬虫1 天前
如何用Jsoup库提取商品名称和价格?奋斗者1号2 天前
Docker 部署 - Crawl4AI 文档 (v0.5.x)Clown952 天前
Go语言爬虫系列教程(一) 爬虫基础入门火龙谷3 天前
【爬虫】12306查票ζ小菜鸡3 天前
我用Deepseek + 亮数据爬虫神器 1小时做出輿情分析器q567315233 天前
Go语言多线程爬虫与代理IP反爬