feat: 添加getNoRedirect方法支持302重定向处理

- 在JsHttpClient中添加getNoRedirect方法,支持不自动跟随重定向的HTTP请求
- 修改baidu-photo.js解析器,使用getNoRedirect获取真实的下载链接
- 更新测试用例断言,验证重定向处理功能正常工作
- 修复百度一刻相册解析器302重定向问题,现在能正确获取真实下载链接
This commit is contained in:
q
2025-10-21 17:47:22 +08:00
parent 97627b824c
commit c8a4ca7f16
25 changed files with 3613 additions and 37 deletions

View File

@@ -1,5 +1,6 @@
package cn.qaiu;
import cn.qaiu.parser.CustomParserRegistry;
import io.vertx.core.Vertx;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -12,12 +13,26 @@ public class WebClientVertxInit {
public static void init(Vertx vx) {
INSTANCE.vertx = vx;
// 自动加载JavaScript解析器脚本
try {
CustomParserRegistry.autoLoadJsScripts();
} catch (Exception e) {
log.warn("自动加载JavaScript解析器脚本失败", e);
}
}
public static Vertx get() {
if (INSTANCE.vertx == null) {
log.info("getVertx: Vertx实例不存在, 创建Vertx实例.");
INSTANCE.vertx = Vertx.vertx();
// 如果Vertx实例是新创建的也尝试加载JavaScript脚本
try {
CustomParserRegistry.autoLoadJsScripts();
} catch (Exception e) {
log.warn("自动加载JavaScript解析器脚本失败", e);
}
}
return INSTANCE.vertx;
}