第一个爬虫:获取演员表

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