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
相关推荐
深蓝电商API12 小时前
直播电商弹幕实时抓取:WebSocket协议分析与数据解析weixin199701080161 天前
[特殊字符] 人工抓取数据革命:从“人肉爬虫”到“智能数据工厂”全面转型指南川冰ICE1 天前
Python爬虫实战㉘|综合实战3,新闻热点追踪与舆情分析系统devnullcoffee2 天前
亚马逊Browse Node类目树数据采集实战:从PA-API到分布式爬虫aP8PfmxS22 天前
网络爬虫是自动从互联网上采集数据的程序Serendipity_Carl2 天前
爬虫实战进阶-穷游论坛网清洗与可视化分析深蓝电商API2 天前
爬虫代理IP智能调度:基于响应速度的实时评分算法深蓝电商API2 天前
爬虫数据质量监控:完整性校验+异常检测+自动重试机制WL_Aurora2 天前
Python爬虫实战(九):百度百聘招聘数据采集