parser v10.1.17发布到maven central 允许开发者依赖

1. 添加自定义解析器扩展和相关示例
2. 优化pom结构
This commit is contained in:
q
2025-10-17 15:50:45 +08:00
parent c16bde6bb8
commit 5e09b8e92a
33 changed files with 2421 additions and 93 deletions

View File

@@ -4,7 +4,7 @@ NFD 解析器模块:聚合各类网盘/分享页解析,统一输出文件列
- 语言Java 17
- 构建Maven
- 模块版本10.1.9
- 模块版本10.1.17
## 依赖Maven Central
- Maven无需额外仓库配置
@@ -12,19 +12,19 @@ NFD 解析器模块:聚合各类网盘/分享页解析,统一输出文件列
<dependency>
<groupId>cn.qaiu</groupId>
<artifactId>parser</artifactId>
<version>10.1.9</version>
<version>10.1.17</version>
</dependency>
```
- Gradle Groovy DSL
```groovy
dependencies {
implementation 'cn.qaiu:parser:10.1.9'
implementation 'cn.qaiu:parser:10.1.17'
}
```
- Gradle Kotlin DSL
```kotlin
dependencies {
implementation("cn.qaiu:parser:10.1.9")
implementation("cn.qaiu:parser:10.1.17")
}
```
@@ -32,12 +32,14 @@ dependencies {
- WebClientVertxInit注入/获取 Vert.x 实例(内部 HTTP 客户端依赖)。
- ParserCreate从分享链接或类型构建解析器生成短链 path。
- IPanTool统一解析接口parse、parseFileList、parseById
- **CustomParserRegistry**:自定义解析器注册中心(支持扩展)。
- **CustomParserConfig**:自定义解析器配置类(支持扩展)。
## 使用示例(极简)
```java
Vertx vx = Vertx.vertx();
WebClientVertxInit.init(vx);
IPanTool tool = ParserCreate.fromShareUrl("https://www.ilanzou.com/s/xxxx").createTool();
IPanTool tool = ParserCreate.fromShareUrl("https://www.lanzoui.com/xxx").createTool();
List<FileInfo> list = tool.parseFileList().toCompletionStage().toCompletableFuture().join();
```
完整示例与调试脚本见 parser/doc/README.md。
@@ -54,8 +56,37 @@ mvn -pl parser -am install
mvn -pl parser test
```
## 自定义解析器扩展
本模块支持用户自定义解析器扩展。通过简单的配置和注册,你可以添加自己的网盘解析实现:
```java
// 1. 实现 IPanTool 接口
public class MyPanTool implements IPanTool {
public MyPanTool(ShareLinkInfo info) { /* 必须提供此构造器 */ }
@Override
public Future<String> parse() { /* 实现解析逻辑 */ }
}
// 2. 注册到系统
CustomParserConfig config = CustomParserConfig.builder()
.type("mypan")
.displayName("我的网盘")
.toolClass(MyPanTool.class)
.build();
CustomParserRegistry.register(config);
// 3. 使用自定义解析器(仅支持 fromType 方式)
IPanTool tool = ParserCreate.fromType("mypan")
.shareKey("abc123")
.createTool();
String url = tool.parseSync();
```
**详细文档:** [自定义解析器扩展指南](doc/CUSTOM_PARSER_GUIDE.md)
## 文档
开发者请阅读 parser/doc/README.md(含解析约定、示例、IDEA `.http` 调试)。
- parser/doc/README.md解析约定、示例、IDEA `.http` 调试
- **parser/doc/CUSTOM_PARSER_GUIDE.md自定义解析器扩展完整指南**
## 目录
- src/main/java/cn/qaiu/entity通用实体如 FileInfo