mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-17 04:43:02 +00:00
feat: 添加getNoRedirect方法支持302重定向处理
- 在JsHttpClient中添加getNoRedirect方法,支持不自动跟随重定向的HTTP请求 - 修改baidu-photo.js解析器,使用getNoRedirect获取真实的下载链接 - 更新测试用例断言,验证重定向处理功能正常工作 - 修复百度一刻相册解析器302重定向问题,现在能正确获取真实下载链接
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user