mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-02-03 11:56:18 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9fa83e57c |
@@ -294,9 +294,24 @@ public class LzTool extends PanBase {
|
||||
String sUrl = shareLinkInfo.getShareUrl();
|
||||
String pwd = shareLinkInfo.getSharePassword();
|
||||
|
||||
WebClient client = clientNoRedirects;
|
||||
client.getAbs(sUrl).send().onSuccess(res -> {
|
||||
webClientSession.getAbs(sUrl).send().onSuccess(res -> {
|
||||
String html = res.bodyAsString();
|
||||
// 检查是否需要 cookie 验证
|
||||
if (html.contains("var arg1='")) {
|
||||
webClientSession = WebClientSession.create(clientNoRedirects);
|
||||
setCookie(html);
|
||||
// 重新请求
|
||||
webClientSession.getAbs(sUrl).send().onSuccess(res2 -> {
|
||||
handleFileListParse(res2.bodyAsString(), pwd, sUrl, promise);
|
||||
}).onFailure(err -> promise.fail(err));
|
||||
return;
|
||||
}
|
||||
handleFileListParse(html, pwd, sUrl, promise);
|
||||
}).onFailure(err -> promise.fail(err));
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
private void handleFileListParse(String html, String pwd, String sUrl, Promise<List<FileInfo>> promise) {
|
||||
try {
|
||||
String jsText = getJsByPwd(pwd, html, "var urls =window.location.href");
|
||||
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText, "file");
|
||||
@@ -307,8 +322,27 @@ public class LzTool extends PanBase {
|
||||
MultiMap headers = getHeaders(sUrl);
|
||||
|
||||
String url = SHARE_URL_PREFIX + "/filemoreajax.php?file=" + data.get("fid");
|
||||
client.postAbs(url).putHeaders(headers).sendForm(map).onSuccess(res2 -> {
|
||||
JsonObject fileListJson = asJson(res2);
|
||||
webClientSession.postAbs(url).putHeaders(headers).sendForm(map).onSuccess(res2 -> {
|
||||
String resBody = asText(res2);
|
||||
// 再次检查是否需要 cookie 验证
|
||||
if (resBody.contains("var arg1='")) {
|
||||
setCookie(resBody);
|
||||
// 重新请求
|
||||
webClientSession.postAbs(url).putHeaders(headers).sendForm(map).onSuccess(res3 -> {
|
||||
handleFileListResponse(asText(res3), promise);
|
||||
}).onFailure(err -> promise.fail(err));
|
||||
return;
|
||||
}
|
||||
handleFileListResponse(resBody, promise);
|
||||
}).onFailure(err -> promise.fail(err));
|
||||
} catch (ScriptException | NoSuchMethodException e) {
|
||||
promise.fail(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleFileListResponse(String responseBody, Promise<List<FileInfo>> promise) {
|
||||
try {
|
||||
JsonObject fileListJson = new JsonObject(responseBody);
|
||||
if (fileListJson.getInteger("zt") != 1) {
|
||||
promise.fail(baseMsg() + fileListJson.getString("info"));
|
||||
return;
|
||||
@@ -347,12 +381,9 @@ public class LzTool extends PanBase {
|
||||
list.add(fileInfo);
|
||||
});
|
||||
promise.complete(list);
|
||||
});
|
||||
} catch (ScriptException | NoSuchMethodException e) {
|
||||
} catch (Exception e) {
|
||||
promise.fail(e);
|
||||
}
|
||||
});
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
void setFileInfo(String html, ShareLinkInfo shareLinkInfo) {
|
||||
|
||||
Reference in New Issue
Block a user