Hero scripts of machete.
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.
 
 
filesite de8541ea02 disable chrome show 10 months ago
bot douyin livestream support 10 months ago
bypass bot lib for douyin done 2 years ago
data Readme update 2 years ago
lib douyin livestream support 10 months ago
log add task log, max run time 11 months ago
plugin change log time's format 2 years ago
test douyin livestream support 10 months ago
tmp bot kuaishou support share url 2 years ago
todo Readme update 2 years ago
.gitignore add bot for all websites 10 months ago
LICENSE Initial commit 2 years ago
README.md spider config update to support any website url 10 months ago
cloud.mjs add bot for all websites 10 months ago
config.mjs disable chrome show 10 months ago
install_cloud.sh add bot for all websites 10 months ago
install_hero.sh cloud and hero install script ready 2 years ago
package.json project name change 11 months ago
spider.mjs douyin livestream support 10 months ago
start_cloud.sh add bot for all websites 10 months ago

README.md

machete的hero爬虫脚本库

Hero scripts of machete.

本项目基于Node.js和开源工具Hero(Ulixee官网)。

支持以下平台视频分享网页数据抓取:

  • bilibili - Bilibili,B站
  • douyin - 抖音网页版
  • kuaishou - 快手网页版
  • xigua - 西瓜视频网页版
  • website - 任意网页

爬虫采集到的数据结构见Machete项目的TaJian皮肤文档,目前实现了以下几个属性:

  • 视频标题
  • 视频封面图(含图片网址和base64格式数据)

目录/文件说明

  • bot - 针对各大平台的网页HTML解析类
  • bypass - 针对各大平台的常用域名收集
  • lib - 公用类
  • plugin - Hero插件
  • data - TaJian爬虫数据保存目录
  • todo - TaJian爬虫任务保存目录
  • test - 类库测试代码
  • tmp - 临时文件保存目录
  • install_cloud.sh - hero服务端安装(非必需)
  • install_hero.sh - hero客户端安装
  • start_cloud.sh - hero服务端启动
  • config.mjs - 爬虫配置文件
  • spider.mjs - TaJian爬虫主程序

使用方法

  1. 下载本源码到本地后,进入项目根目录
git clone "https://git.filesite.io/filesite/machete_hero.git"
cd machete_hero/
  1. 执行下面命令安装依赖包
npm install

如果你对npm和node不熟悉,请自行了解。

  1. 执行下面命令启动Hero Cloud
./start_cloud.sh
  1. 执行下面命令启动爬虫spider.mjs
npm start

带参数启动,设置自定义配置文件,覆盖默认的config.mjs

npm start -- config_custom.json

在目录todo/里创建任务文件,爬虫检测到新任务后自动抓取数据并保存到data/目录下。

手动添加任务命令示例:

echo "https://tajian.tv" > todo/test_01.task

二次开发

写一个.mjs脚本,调用bot/下的类库,实现目标网页访问和解析获取所需数据。

还可以参考bot/下的类库,实现对任意网站的数据抓取。

bot/目录下的类库调用方法,可参考test/scrap_test.mjs测试脚本, 测试脚本使用方法见test/README.md文档。