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
相关推荐
sugar椰子皮5 小时前
【web补环境篇-0】document.allinterception6 小时前
js逆向之京东原型链补环境h5st半路_出家ren8 小时前
17.python爬虫基础,基于正则表达式的爬虫,基于BeautifulSoup的爬虫我想吃烤肉肉1 天前
Playwright中page.locator和Selenium中find_element区别lbb 小魔仙1 天前
【Python】零基础学 Python 爬虫:从原理到反爬,构建企业级爬虫系统努力变大白1 天前
借助AI零基础快速学会Python爬取网页信息-以天眼查爬虫为例AC赳赳老秦1 天前
Unity游戏开发实战指南:核心逻辑与场景构建详解小花皮猪2 天前
LLM驱动智能数据采集:2026年10大AI网络爬虫工具对比评测