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
相关推荐
用户199701080181 小时前
深入解析淘宝商品详情 API 接口:功能、使用与实践指南西柚小萌新4 小时前
【Python爬虫实战篇】--Selenium爬取Mysteel数据Auroral1564 小时前
【Python爬虫详解】第四篇:使用解析库提取网页数据——XPathAuroral1564 小时前
【Python爬虫详解】第四篇:使用解析库提取网页数据——PyQueryAuroral1564 小时前
【Python爬虫详解】第四篇:使用解析库提取网页数据——BeautifuSoupkadog5 小时前
《Python3网络爬虫开发实战(第二版)》配套案例 spa6徒慕风流5 小时前
利用Python爬虫实现百度图片搜索的PNG图片下载用户199701080187 小时前
深入研究:Shopee商品列表API接口详解攻城狮7号7 小时前
Python爬虫第19节-动态渲染页面抓取之Splash使用下篇用户199701080181 天前
深入研究:Shopee商品详情API接口详解