You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
926 B

# spider_bilibili
基于 scrapy-redis 的分布式爬虫爬取B站博主视频
****
## 目录
*[快速开始](#下载安装)
*[下载安装](#下载安装)
*[创建一个分布式爬虫](#创建一个分布式爬虫)
*[修改配置文件](#修改配置文件)
*[启动爬虫](#启动爬虫)
###下载安装
1、安装redis
2、安装依赖库,pip install -r requirements.txt
###创建一个分布式爬虫
scrapy startproject XXX(项目名)
cd XXX
scrapy genspider xxx(爬虫名) www.baidu.com(域名-示例)
###修改配置文件
1、配置setting.py文件
2、根据任务需求更改items.py,middlewares.py,pipelines.py文件
###启动爬虫
1、启动redis服务,在命令行输入 redis-server
2、运行"获取所有视频的url.py"文件将视频的url加入到redis中
3、运行bilibili.py文件,你需要找到该文件并在命令行中输入 scrapy runspider bilibili.py(可以打开多个脚本任务)