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
相关推荐
codeboss6 小时前
做网页变更监控,我在“降噪”上踩过的 7 个坑MrDJun6 小时前
长期稳定跑网页监控:TLS 指纹、代理选路与请求节流的工程实践巨量HTTP1 天前
Python爬虫动态换IP实战,彻底解决IP403封禁、限流问题(附完整代码)hyf3266331 天前
泛程序哪有想象中难!小白跟着走一遍就全懂艾派森1 天前
Web Scraper API vs 自建爬虫:一次真实对比测试,结果让人震惊爱吃提升2 天前
python 分布式爬虫、爬虫合规与综合实战项目亿牛云爬虫专家2 天前
如何设计一套高可用的爬虫任务队列,保证断点续爬与故障转移?二十雨辰3 天前
[爬虫]-Urllib深蓝电商API3 天前
gRPC 数据抓取原理详解上海云盾-小余3 天前
全链路多层防护体系,一站式拦截 DDoS、CC、爬虫与注入攻击