yggverse / gemini-dl
Gemini 协议的 CLI 下载器
dev-main
2024-06-28 19:10 UTC
Requires
- codedungeon/php-cli-colors: ^1.12
- yggverse/gemini: ^1.0
- yggverse/gemtext: ^1.0
- yggverse/net: ^1.8
This package is auto-updated.
Last update: 2024-09-28 19:42:13 UTC
README
为Gemini 协议设计的 CLI 批量下载器,灵感来自 wget
和 yt-dlp
工具
目前,项目处于开发中,一些 功能 已实现并正在测试(反馈 | PR)
界面
组件
- gemini-php - Gemini 协议客户端
- gemtext-php - Gemtext 解析器
- net-php - URL 操作的网络工具包
- php-cli-colors - CLI 颜色
功能
- 抓取单个 URL 或
--crawl
整个胶囊 - 多种 MIME 类型下载(例如内联图像和其他媒体)
- 每个请求的详细爬虫日志 + 总计
- 灵活的选项
- 自定义请求间的
--delay
- 自定义目录的
--index
文件名 - 自定义存储位置
- 文件系统
- FTP
- 可选的本地导航链接替换
- 相对(默认)
- 绝对(
--absolute
) - 原始(
--keep
)
-
--match
正则表达式 URL -
--unique
快照版本或与现有副本同步 - 可配置的重定向级别到
--follow
- 爬虫深度
--level
限制 - 下载的文档大小限制
- 在爬虫时跟随
--external
链接
- 自定义请求间的
环境
apt install git composer php-fpm php-mbstring
安装
git clone https://github.com/YGGverse/gemini-dl.git
cd gemini-dl
composer update
chmod +x src/gemini-dl.php
(仅限直接执行)
用法
src/gemini-dl.php --source gemini://.. --target /path/to/download
- 或者,使用指定的 PHP 版本启动
/path/to/php src/gemini-dl.php
选项
# Required -s, --source - string, gemini protocol address -t, --target - string, absolute path to destination folder # Optional -a, --absolute - no value, links to absolute filepath (ignored on --keep), disabled by default -c, --crawl - no value, crawl document links (entire capsule download), disabled by default -d, --delay - integer, pause between requests to prevent abuse (seconds), 1 by default -i, --index - string, index filename of directory listing, index.gmi by default -h, --help - no value, show available commands -k, --keep - no value, keep original links (--crawl mode only), disabled by default -m, --match - string, collect links match regex rule, /.*/ by default -r, --raw - no value, include meta headers (--keep option ignored), disabled by default -u, --unique - no value, append snap version as folder timestamp, disabled by default # Experimental (in development) -e, --external - no value, follow external hosts, disabled by default -f, --follow - integer, follow redirects on --crawl, 0 by default -l, --level - integer, depth to --crawl, 0 by default
- 在 CLI 中显示:
gemini-dl.php --help