mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 04:13:03 +00:00
- 在JsHttpClient中添加getNoRedirect方法,支持不自动跟随重定向的HTTP请求 - 修改baidu-photo.js解析器,使用getNoRedirect获取真实的下载链接 - 更新测试用例断言,验证重定向处理功能正常工作 - 修复百度一刻相册解析器302重定向问题,现在能正确获取真实下载链接
40 lines
1.2 KiB
Java
40 lines
1.2 KiB
Java
package cn.qaiu;
|
||
|
||
import cn.qaiu.parser.CustomParserRegistry;
|
||
import io.vertx.core.Vertx;
|
||
import org.slf4j.Logger;
|
||
import org.slf4j.LoggerFactory;
|
||
|
||
public class WebClientVertxInit {
|
||
private Vertx vertx = null;
|
||
private static final WebClientVertxInit INSTANCE = new WebClientVertxInit();
|
||
|
||
private static final Logger log = LoggerFactory.getLogger(WebClientVertxInit.class);
|
||
|
||
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;
|
||
}
|
||
}
|