h5ai 抓取器
一个 CLI 工具和 Dart 包,可以从 h5ai 实例抓取文件和目录 URL。
用法
此工具需要 Dart SDK。它可以编译成本地二进制文件——我只是还没有这样做。
$ dart pub global activate --source git https://github.com/hacker1024/h5ai_scraper.git
$ h5ai-scrape --help
Usage: h5ai-scrape -u <URL> [OPTIONS] Options: -u, --url The URL of the h5ai instance. --aria2 Output an aria2 compatible URL list. -h, --help Show the usage information.
JSON 输出
默认情况下,该工具输出一个 JSON 对象列表,结构如下
| 按键 | Value |
|---|---|
| 名称 | 文件或目录的名称 |
| location | 文件或目录的 URL |
| size | 文件或目录的大小(以字节为单位) |
| iconUrl | 文件或目录的图标 URL |
| dateModified | 文件或目录的最后修改日期(ISO-8601) |
| 类型 | “file” 或 “directory” |
| children | 目录的内容(仅目录属性) |
aria2 用法
此工具可以为 aria2 生成一个 输入文件,这对于一次性下载所有抓取的文件非常有用。
Dart 包
准备工作
在您的 pubspec.yaml 中
dependencies:
h5ai_scraper:
git: https://github.com/hacker1024/h5ai_scraper.git
用法
import 'package:h5ai_scraper/h5ai_scraper.dart' as h5ai_scraper;
void main() async {
final uri = Uri.parse('http://...');
await for (final node in h5ai_scraper.scrape(uri)) {
print(node);
}
}