mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-07-13 15:01:13 +00:00
Compare commits
356 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ecb60b1fae | |||
| 1b357de2f3 | |||
| cf76a5ddd6 | |||
| 4e27bf0dc4 | |||
| 39c082e4ee | |||
| 95193fc8f9 | |||
| 4f3131979f | |||
| ad9a8ab0b0 | |||
| 1f3161216a | |||
| e5f7b164a3 | |||
| 7974c92382 | |||
| b51add45f1 | |||
| cb132359fd | |||
| b58b3658b5 | |||
| 9f25aca242 | |||
| 343c017c79 | |||
| 83af09cf58 | |||
| 449475785f | |||
| 047a8eab89 | |||
| 93835bd990 | |||
| 93ab3f3f3f | |||
| de7703be83 | |||
| ce1c4ee669 | |||
| c60d9fdd61 | |||
| 2033542f49 | |||
| 3775cd0259 | |||
| bec342d778 | |||
| 6305d805dd | |||
| 2ada2fddf7 | |||
| 66ba8b7ee8 | |||
| 2edf235941 | |||
| 57ef723368 | |||
| 366658b471 | |||
| 2a3244a8fa | |||
| 9912e6fef1 | |||
| d475dcbcdc | |||
| 5ffe94e3a4 | |||
| 5809d3b664 | |||
| 2bed42a088 | |||
| 97e912c216 | |||
| f657aa183c | |||
| cf634c4464 | |||
| a9b5d9ab57 | |||
| f82267f8a7 | |||
| 46bd5819b3 | |||
| d10a55d8cb | |||
| e74d5ea97e | |||
| 1dfdff7024 | |||
| f5c81e1b8e | |||
| 804b8853d9 | |||
| f87a66bc79 | |||
| 74b9cc438c | |||
| 7829174cc0 | |||
| 2e558df96b | |||
| 474eea5f80 | |||
| fc50d1f5ba | |||
| 3b63f48dfa | |||
| 95697de1d0 | |||
| 1aa9ecdc45 | |||
| 0a3dbc6342 | |||
| 72f215c301 | |||
| add90984a5 | |||
| 857ac7a2c9 | |||
| b807223614 | |||
| c775dabd7e | |||
| 5ee0aae6e1 | |||
| 5c8e4d7754 | |||
| 79123448f6 | |||
| 8e4328f1eb | |||
| 63c810dcbb | |||
| c71d4cfa87 | |||
| 2b17567a1d | |||
| ba5f88af43 | |||
| 782f47c7c5 | |||
| 8f92ce9292 | |||
| 1c3b5082a2 | |||
| 8535f49786 | |||
| 92043cf415 | |||
| c97a235e23 | |||
| 97c2fe6784 | |||
| 1baa6e36b8 | |||
| 9dbc8718a8 | |||
| 3107281cdc | |||
| c5b2340fe6 | |||
| 2f6f977adb | |||
| 902443b511 | |||
| 322f173104 | |||
| c61ba45d59 | |||
| 684e8d4c84 | |||
| a96bde812d | |||
| c0276f97d6 | |||
| f60d2573e6 | |||
| 7e746ded60 | |||
| 11669c07ed | |||
| 0c0e4c9cc1 | |||
| a3ab467c74 | |||
| acb646ee2d | |||
| 5a02c38d57 | |||
| bd9ac79ec9 | |||
| d6c8b2f476 | |||
| b616c59f1b | |||
| c6603c0d83 | |||
| ae0a5644b5 | |||
| d87ab43a9b | |||
| cfe084cb07 | |||
| 75521c87ba | |||
| 67042b39b3 | |||
| c65b55d0c6 | |||
| 8e938acdb2 | |||
| 5db5b3c75a | |||
| 291df9d984 | |||
| 323c62f4e6 | |||
| 03e2bbbb91 | |||
| 4b8660932a | |||
| 35c7746e38 | |||
| e2155aec45 | |||
| aaf34a460e | |||
| 1bb30a9ed2 | |||
| b1c68aa865 | |||
| 8b57d04a2e | |||
| 1a57bddef7 | |||
| 1d30716aa6 | |||
| a2aabfc601 | |||
| f7040a3c1c | |||
| 40d4a1fcb5 | |||
| e01bb2d8d7 | |||
| d8a4d2e39f | |||
| dbbd5759ab | |||
| 0a59ff2357 | |||
| 4e1eb6654d | |||
| b588ba740f | |||
| af605a2be7 | |||
| b2630a7e35 | |||
| 211fe92a35 | |||
| be168a9f0d | |||
| 977f5dc6dd | |||
| 131cb7085d | |||
| 7fbd446a2a | |||
| 7b64699782 | |||
| bad56037c4 | |||
| 180e54f278 | |||
| ae89e0be26 | |||
| f19b366b1b | |||
| 6b1bd573c8 | |||
| 43c82f2f16 | |||
| e478486d73 | |||
| 32e5c69735 | |||
| 4ec5b491c5 | |||
| 6a0e4a695d | |||
| e6d69331be | |||
| f16e196040 | |||
| 2f67e3b04d | |||
| 4663751924 | |||
| e6ae7e2545 | |||
| 74ec248b8c | |||
| cd04eead07 | |||
| 2b4340a5d6 | |||
| ff6913264f | |||
| ffd88841d5 | |||
| 0ed0d2ed82 | |||
| c2387c47ee | |||
| 65cc78de7d | |||
| 8bedfcf794 | |||
| 1cd059f842 | |||
| 42438f2bbd | |||
| 1fb6e5d660 | |||
| 3fa0588e03 | |||
| 5a008f4ddd | |||
| 1a0b3a75c3 | |||
| c5ad19881c | |||
| 6188e5f2c6 | |||
| 6f19fbd300 | |||
| 5307da24ed | |||
| e65da6fe4a | |||
| 7ed83e9437 | |||
| f008f490d9 | |||
| 01109dedbd | |||
| f2a78d8937 | |||
| eef56b308c | |||
| c9ca47b27d | |||
| 35e54f5ad5 | |||
| 310d516aac | |||
| aee84e3cb3 | |||
| f9fd68c0f4 | |||
| 9761a9e2d9 | |||
| 8bed7487de | |||
| 2b084a3cc8 | |||
| 1caabd1368 | |||
| b5397ba303 | |||
| 36f9b53f9b | |||
| 26fcbaa9a6 | |||
| a8a5b6e3ab | |||
| 588e087941 | |||
| fe71db0967 | |||
| 9436575dcb | |||
| 4ea380d28e | |||
| 1f46b477e3 | |||
| f7e17a10b5 | |||
| 6e19e29857 | |||
| f6b5d72784 | |||
| 68f1334907 | |||
| a83f4e9a2f | |||
| fcd8709c7d | |||
| 854d0ea241 | |||
| cff223ecd2 | |||
| 8f14762f43 | |||
| c37ae638d2 | |||
| bcfa46ec43 | |||
| 42cfe4aacf | |||
| 64dba88881 | |||
| 3f300ded96 | |||
| 1ceafc5c08 | |||
| 93adb06083 | |||
| 3ef1c81d13 | |||
| 84b4deffc6 | |||
| 2e7f1a7e52 | |||
| 59bea226e5 | |||
| 0bbef0c7a9 | |||
| fc91192d0e | |||
| 8dbcaed813 | |||
| 577ec46f71 | |||
| 65bf4534c7 | |||
| 5b666e1fec | |||
| e839f56a91 | |||
| c5a327e2e0 | |||
| 5b5a11ac36 | |||
| 0c3efe326f | |||
| b9100fb934 | |||
| 74a98713c1 | |||
| 339b80bbea | |||
| ce0c3b3a1e | |||
| 1e611dd85b | |||
| 0791114e92 | |||
| c85b9a01fd | |||
| 9c2a0e7f46 | |||
| 8699aef0da | |||
| 749bc67212 | |||
| 67e24e846b | |||
| 091def569a | |||
| fb0cf9102b | |||
| 69ce48adb4 | |||
| 6c3ab975cc | |||
| f501935365 | |||
| c3593f335e | |||
| 351bdd9c58 | |||
| 812042b95e | |||
| 9957fcbce8 | |||
| acb2c00cca | |||
| 9655b8715e | |||
| 13de30e8b5 | |||
| 1cfeae2ad2 | |||
| 31b4190eaf | |||
| 380e1c7482 | |||
| f202800a0a | |||
| 96d246e64f | |||
| 75b460f4b0 | |||
| 1ba7af485d | |||
| 76c16c6312 | |||
| 66a09a8f1c | |||
| 235fed1b4e | |||
| f75921ba03 | |||
| 202b261a53 | |||
| 95c39d258e | |||
| 71b35e4651 | |||
| 2465a4d6d3 | |||
| 30d4ce4781 | |||
| 27be70ea00 | |||
| 0c22267eaa | |||
| d4f4ec67c3 | |||
| df74d9a117 | |||
| 2fc7556f39 | |||
| 418dcde15f | |||
| 59db290cae | |||
| 2992d3586f | |||
| 7b8eea4865 | |||
| 6b2bba2854 | |||
| 4666e942b4 | |||
| daa3c940ee | |||
| e54c15dad1 | |||
| 054024e3e8 | |||
| 5be8c4548f | |||
| 60bd8ecf21 | |||
| 25edeaf709 | |||
| 1e7525f908 | |||
| 341e33a845 | |||
| f5ef8c07a5 | |||
| 76da12da65 | |||
| dacf93bd06 | |||
| 498bce5255 | |||
| d67df58bc6 | |||
| 751c7163fe | |||
| 9bd5da8ac3 | |||
| 769e8545b6 | |||
| a30c037138 | |||
| 3c7fc752fc | |||
| 54576e8cbc | |||
| f2bac57ed3 | |||
| a3220c36c1 | |||
| 821fc945cf | |||
| 784b3334f4 | |||
| 57c3355d3e | |||
| 9275e28e15 | |||
| a82596dc70 | |||
| add27186bc | |||
| 087ad0c120 | |||
| 5cd1db7e4b | |||
| 3cdbac1603 | |||
| 7402dd76cc | |||
| de2e47628a | |||
| aad0098169 | |||
| 922ce84000 | |||
| aabfcd8c8b | |||
| 0e15d9f309 | |||
| 5ac89ac085 | |||
| b3ec433d33 | |||
| 207b4cf6b3 | |||
| 03fbb3ef15 | |||
| 4ce62d6b98 | |||
| 1f504a8cd5 | |||
| dd52f5a61f | |||
| 8369212bd3 | |||
| c67911f1bb | |||
| af95de8d15 | |||
| ba2bfbd11a | |||
| cc4b0ae90e | |||
| 399f55cae6 | |||
| 981513a557 | |||
| 326cfa838c | |||
| b576e06099 | |||
| 1ad788c63f | |||
| faf4d8e7ef | |||
| d77095fe87 | |||
| 1bd1f611fe | |||
| 38f13524a1 | |||
| d5588e3850 | |||
| b7c2887d0c | |||
| 1cba9df571 | |||
| 32fc530a17 | |||
| c9436f0a47 | |||
| b8174a16f4 | |||
| 2a44a55764 | |||
| 0ad72c9108 | |||
| b8340949d5 | |||
| 6c3433595f | |||
| 3e5e42fef9 | |||
| c19f584b0d | |||
| 0bbf022c5d | |||
| 4516aa8300 | |||
| 30a53dd47c | |||
| 6e77c21021 | |||
| f035cf4088 | |||
| af5cba5ed6 | |||
| 8bb3d26b4c | |||
| ef0829ab8f | |||
| 13f3546700 | |||
| 0cccba7b3b |
@@ -4,13 +4,15 @@ import cn.qaiu.entity.FileInfo;
|
|||||||
import cn.qaiu.entity.ShareLinkInfo;
|
import cn.qaiu.entity.ShareLinkInfo;
|
||||||
import cn.qaiu.parser.PanBase;
|
import cn.qaiu.parser.PanBase;
|
||||||
import cn.qaiu.util.AESUtils;
|
import cn.qaiu.util.AESUtils;
|
||||||
|
import cn.qaiu.util.AcwScV2Generator;
|
||||||
import cn.qaiu.util.FileSizeConverter;
|
import cn.qaiu.util.FileSizeConverter;
|
||||||
import cn.qaiu.util.UUIDUtil;
|
import io.netty.handler.codec.http.cookie.DefaultCookie;
|
||||||
import io.vertx.core.Future;
|
import io.vertx.core.Future;
|
||||||
import io.vertx.core.MultiMap;
|
import io.vertx.core.MultiMap;
|
||||||
import io.vertx.core.Promise;
|
import io.vertx.core.Promise;
|
||||||
import io.vertx.core.json.JsonArray;
|
import io.vertx.core.json.JsonArray;
|
||||||
import io.vertx.core.json.JsonObject;
|
import io.vertx.core.json.JsonObject;
|
||||||
|
import io.vertx.ext.web.client.WebClientSession;
|
||||||
import io.vertx.uritemplate.UriTemplate;
|
import io.vertx.uritemplate.UriTemplate;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -18,10 +20,12 @@ import java.util.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 蓝奏云优享
|
* 蓝奏云优享
|
||||||
*
|
* v019b22
|
||||||
*/
|
*/
|
||||||
public class IzTool extends PanBase {
|
public class IzTool extends PanBase {
|
||||||
|
|
||||||
|
WebClientSession webClientSession = WebClientSession.create(clientNoRedirects);
|
||||||
|
|
||||||
private static final String API_URL_PREFIX = "https://api.ilanzou.com/unproved/";
|
private static final String API_URL_PREFIX = "https://api.ilanzou.com/unproved/";
|
||||||
|
|
||||||
private static final String FIRST_REQUEST_URL = API_URL_PREFIX + "recommend/list?devType=6&devModel=Chrome" +
|
private static final String FIRST_REQUEST_URL = API_URL_PREFIX + "recommend/list?devType=6&devModel=Chrome" +
|
||||||
@@ -70,6 +74,19 @@ public class IzTool extends PanBase {
|
|||||||
super(shareLinkInfo);
|
super(shareLinkInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setCookie(String html) {
|
||||||
|
int beginIndex = html.indexOf("arg1='") + 6;
|
||||||
|
String arg1 = html.substring(beginIndex, html.indexOf("';", beginIndex));
|
||||||
|
String acw_sc__v2 = AcwScV2Generator.acwScV2Simple(arg1);
|
||||||
|
// 创建一个 Cookie 并放入 CookieStore
|
||||||
|
DefaultCookie nettyCookie = new DefaultCookie("acw_sc__v2", acw_sc__v2);
|
||||||
|
nettyCookie.setDomain(".ilanzou.com"); // 设置域名
|
||||||
|
nettyCookie.setPath("/"); // 设置路径
|
||||||
|
nettyCookie.setSecure(false);
|
||||||
|
nettyCookie.setHttpOnly(false);
|
||||||
|
webClientSession.cookieStore().put(nettyCookie);
|
||||||
|
}
|
||||||
|
|
||||||
public Future<String> parse() {
|
public Future<String> parse() {
|
||||||
String shareId = shareLinkInfo.getShareKey();
|
String shareId = shareLinkInfo.getShareKey();
|
||||||
|
|
||||||
@@ -80,70 +97,100 @@ public class IzTool extends PanBase {
|
|||||||
// POST https://api.ilanzou.com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
|
// POST https://api.ilanzou.com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
|
||||||
String url = StringUtils.isBlank(shareLinkInfo.getSharePassword()) ? FIRST_REQUEST_URL
|
String url = StringUtils.isBlank(shareLinkInfo.getSharePassword()) ? FIRST_REQUEST_URL
|
||||||
: (FIRST_REQUEST_URL + "&code=" + shareLinkInfo.getSharePassword());
|
: (FIRST_REQUEST_URL + "&code=" + shareLinkInfo.getSharePassword());
|
||||||
client.postAbs(UriTemplate.of(VIP_REQUEST_URL))
|
webClientSession.postAbs(UriTemplate.of(VIP_REQUEST_URL))
|
||||||
.setTemplateParam("uuid", uuid)
|
.setTemplateParam("uuid", uuid)
|
||||||
.setTemplateParam("ts", tsEncode)
|
.setTemplateParam("ts", tsEncode)
|
||||||
.send().onSuccess(r0 -> { // 忽略res
|
.send().onSuccess(r0 -> { // 忽略res
|
||||||
// 第一次请求 获取文件信息
|
// 第一次请求 获取文件信息
|
||||||
// POST https://api.feijipan.com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
|
// POST https://api.feijipan.com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
|
||||||
client.postAbs(UriTemplate.of(url))
|
webClientSession.postAbs(UriTemplate.of(url))
|
||||||
.putHeaders(header)
|
.putHeaders(header)
|
||||||
.setTemplateParam("shareId", shareId)
|
.setTemplateParam("shareId", shareId)
|
||||||
.setTemplateParam("uuid", uuid)
|
.setTemplateParam("uuid", uuid)
|
||||||
.setTemplateParam("ts", tsEncode)
|
.setTemplateParam("ts", tsEncode)
|
||||||
.send().onSuccess(res -> {
|
.send().onSuccess(res -> {
|
||||||
JsonObject resJson = asJson(res);
|
String resBody = asText(res);
|
||||||
if (resJson.getInteger("code") != 200) {
|
// 检查是否包含 cookie 验证
|
||||||
fail(FIRST_REQUEST_URL + " 返回异常: " + resJson);
|
if (resBody.contains("var arg1='")) {
|
||||||
|
webClientSession = WebClientSession.create(clientNoRedirects);
|
||||||
|
setCookie(resBody);
|
||||||
|
// 重新请求
|
||||||
|
webClientSession.postAbs(UriTemplate.of(url))
|
||||||
|
.putHeaders(header)
|
||||||
|
.setTemplateParam("shareId", shareId)
|
||||||
|
.setTemplateParam("uuid", uuid)
|
||||||
|
.setTemplateParam("ts", tsEncode)
|
||||||
|
.send().onSuccess(res2 -> {
|
||||||
|
handleParseResponse(asText(res2), shareId);
|
||||||
|
}).onFailure(handleFail(FIRST_REQUEST_URL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (resJson.getJsonArray("list").isEmpty()) {
|
handleParseResponse(resBody, shareId);
|
||||||
fail(FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!resJson.containsKey("list") || resJson.getJsonArray("list").isEmpty()) {
|
|
||||||
fail(FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 文件Id
|
|
||||||
JsonObject fileInfo = resJson.getJsonArray("list").getJsonObject(0);
|
|
||||||
// 如果是目录返回目录ID
|
|
||||||
if (!fileInfo.containsKey("fileList") || fileInfo.getJsonArray("fileList").isEmpty()) {
|
|
||||||
fail(FIRST_REQUEST_URL + " 文件列表为空: " + fileInfo);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JsonObject fileList = fileInfo.getJsonArray("fileList").getJsonObject(0);
|
|
||||||
if (fileList.getInteger("fileType") == 2) {
|
|
||||||
promise.complete(fileList.getInteger("folderId").toString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String fileId = fileInfo.getString("fileIds");
|
|
||||||
String userId = fileInfo.getString("userId");
|
|
||||||
// 其他参数
|
|
||||||
// String fidEncode = AESUtils.encrypt2HexIz(fileId + "|");
|
|
||||||
String fidEncode = AESUtils.encrypt2HexIz(fileId + "|" + userId);
|
|
||||||
String auth = AESUtils.encrypt2HexIz(fileId + "|" + nowTs);
|
|
||||||
// 第二次请求
|
|
||||||
clientNoRedirects.getAbs(UriTemplate.of(SECOND_REQUEST_URL))
|
|
||||||
.setTemplateParam("fidEncode", fidEncode)
|
|
||||||
.setTemplateParam("uuid", uuid)
|
|
||||||
.setTemplateParam("ts", tsEncode)
|
|
||||||
.setTemplateParam("auth", auth)
|
|
||||||
.setTemplateParam("shareId", shareId)
|
|
||||||
.putHeaders(header).send().onSuccess(res2 -> {
|
|
||||||
MultiMap headers = res2.headers();
|
|
||||||
if (!headers.contains("Location")) {
|
|
||||||
fail(SECOND_REQUEST_URL + " 未找到重定向URL: \n" + headers);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
promise.complete(headers.get("Location"));
|
|
||||||
}).onFailure(handleFail(SECOND_REQUEST_URL));
|
|
||||||
}).onFailure(handleFail(FIRST_REQUEST_URL));
|
}).onFailure(handleFail(FIRST_REQUEST_URL));
|
||||||
});
|
});
|
||||||
return promise.future();
|
return promise.future();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleParseResponse(String resBody, String shareId) {
|
||||||
|
JsonObject resJson;
|
||||||
|
try {
|
||||||
|
resJson = new JsonObject(resBody);
|
||||||
|
} catch (Exception e) {
|
||||||
|
fail(FIRST_REQUEST_URL + " 解析JSON失败: " + resBody);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (resJson.isEmpty()) {
|
||||||
|
fail(FIRST_REQUEST_URL + " 返回内容为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (resJson.getInteger("code") != 200) {
|
||||||
|
fail(FIRST_REQUEST_URL + " 返回异常: " + resJson);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (resJson.getJsonArray("list").isEmpty()) {
|
||||||
|
fail(FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!resJson.containsKey("list") || resJson.getJsonArray("list").isEmpty()) {
|
||||||
|
fail(FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 文件Id
|
||||||
|
JsonObject fileInfo = resJson.getJsonArray("list").getJsonObject(0);
|
||||||
|
// 如果是目录返回目录ID
|
||||||
|
if (!fileInfo.containsKey("fileList") || fileInfo.getJsonArray("fileList").isEmpty()) {
|
||||||
|
fail(FIRST_REQUEST_URL + " 文件列表为空: " + fileInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JsonObject fileList = fileInfo.getJsonArray("fileList").getJsonObject(0);
|
||||||
|
if (fileList.getInteger("fileType") == 2) {
|
||||||
|
promise.complete(fileList.getInteger("folderId").toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String fileId = fileInfo.getString("fileIds");
|
||||||
|
String userId = fileInfo.getString("userId");
|
||||||
|
// 其他参数
|
||||||
|
// String fidEncode = AESUtils.encrypt2HexIz(fileId + "|");
|
||||||
|
String fidEncode = AESUtils.encrypt2HexIz(fileId + "|" + userId);
|
||||||
|
String auth = AESUtils.encrypt2HexIz(fileId + "|" + nowTs);
|
||||||
|
// 第二次请求
|
||||||
|
webClientSession.getAbs(UriTemplate.of(SECOND_REQUEST_URL))
|
||||||
|
.setTemplateParam("fidEncode", fidEncode)
|
||||||
|
.setTemplateParam("uuid", uuid)
|
||||||
|
.setTemplateParam("ts", tsEncode)
|
||||||
|
.setTemplateParam("auth", auth)
|
||||||
|
.setTemplateParam("shareId", shareId)
|
||||||
|
.putHeaders(header).send().onSuccess(res2 -> {
|
||||||
|
MultiMap headers = res2.headers();
|
||||||
|
if (!headers.contains("Location")) {
|
||||||
|
fail(SECOND_REQUEST_URL + " 未找到重定向URL: \n" + headers);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
promise.complete(headers.get("Location"));
|
||||||
|
}).onFailure(handleFail(SECOND_REQUEST_URL));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Future<List<FileInfo>> parseFileList() {
|
public Future<List<FileInfo>> parseFileList() {
|
||||||
Promise<List<FileInfo>> promise = Promise.promise();
|
Promise<List<FileInfo>> promise = Promise.promise();
|
||||||
@@ -174,7 +221,7 @@ public class IzTool extends PanBase {
|
|||||||
log.debug("开始解析目录: {}, shareId: {}, uuid: {}, ts: {}", id, shareId, uuid, tsEncode);
|
log.debug("开始解析目录: {}, shareId: {}, uuid: {}, ts: {}", id, shareId, uuid, tsEncode);
|
||||||
// 开始解析目录: 164312216, shareId: bPMsbg5K, uuid: 0fmVWTx2Ea4zFwkpd7KXf, ts: 20865d7b7f00828279f437cd1f097860
|
// 开始解析目录: 164312216, shareId: bPMsbg5K, uuid: 0fmVWTx2Ea4zFwkpd7KXf, ts: 20865d7b7f00828279f437cd1f097860
|
||||||
// 拿到目录ID
|
// 拿到目录ID
|
||||||
client.postAbs(UriTemplate.of(FILE_LIST_URL))
|
webClientSession.postAbs(UriTemplate.of(FILE_LIST_URL))
|
||||||
.putHeaders(header)
|
.putHeaders(header)
|
||||||
.setTemplateParam("shareId", shareId)
|
.setTemplateParam("shareId", shareId)
|
||||||
.setTemplateParam("uuid", uuid)
|
.setTemplateParam("uuid", uuid)
|
||||||
@@ -264,7 +311,7 @@ public class IzTool extends PanBase {
|
|||||||
public Future<String> parseById() {
|
public Future<String> parseById() {
|
||||||
// 第二次请求
|
// 第二次请求
|
||||||
JsonObject paramJson = (JsonObject)shareLinkInfo.getOtherParam().get("paramJson");
|
JsonObject paramJson = (JsonObject)shareLinkInfo.getOtherParam().get("paramJson");
|
||||||
clientNoRedirects.getAbs(UriTemplate.of(SECOND_REQUEST_URL))
|
webClientSession.getAbs(UriTemplate.of(SECOND_REQUEST_URL))
|
||||||
.setTemplateParam("fidEncode", paramJson.getString("fidEncode"))
|
.setTemplateParam("fidEncode", paramJson.getString("fidEncode"))
|
||||||
.setTemplateParam("uuid", paramJson.getString("uuid"))
|
.setTemplateParam("uuid", paramJson.getString("uuid"))
|
||||||
.setTemplateParam("ts", paramJson.getString("ts"))
|
.setTemplateParam("ts", paramJson.getString("ts"))
|
||||||
|
|||||||
@@ -294,67 +294,98 @@ public class LzTool extends PanBase {
|
|||||||
String sUrl = shareLinkInfo.getShareUrl();
|
String sUrl = shareLinkInfo.getShareUrl();
|
||||||
String pwd = shareLinkInfo.getSharePassword();
|
String pwd = shareLinkInfo.getSharePassword();
|
||||||
|
|
||||||
WebClient client = clientNoRedirects;
|
webClientSession.getAbs(sUrl).send().onSuccess(res -> {
|
||||||
client.getAbs(sUrl).send().onSuccess(res -> {
|
|
||||||
String html = res.bodyAsString();
|
String html = res.bodyAsString();
|
||||||
try {
|
// 检查是否需要 cookie 验证
|
||||||
String jsText = getJsByPwd(pwd, html, "var urls =window.location.href");
|
if (html.contains("var arg1='")) {
|
||||||
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText, "file");
|
webClientSession = WebClientSession.create(clientNoRedirects);
|
||||||
Map<String, Object> data = CastUtil.cast(scriptObjectMirror.get("data"));
|
setCookie(html);
|
||||||
MultiMap map = MultiMap.caseInsensitiveMultiMap();
|
// 重新请求
|
||||||
data.forEach((k, v) -> map.set(k, v.toString()));
|
webClientSession.getAbs(sUrl).send().onSuccess(res2 -> {
|
||||||
log.debug("解析参数: {}", map);
|
handleFileListParse(res2.bodyAsString(), pwd, sUrl, promise);
|
||||||
MultiMap headers = getHeaders(sUrl);
|
}).onFailure(err -> promise.fail(err));
|
||||||
|
return;
|
||||||
String url = SHARE_URL_PREFIX + "/filemoreajax.php?file=" + data.get("fid");
|
|
||||||
client.postAbs(url).putHeaders(headers).sendForm(map).onSuccess(res2 -> {
|
|
||||||
JsonObject fileListJson = asJson(res2);
|
|
||||||
if (fileListJson.getInteger("zt") != 1) {
|
|
||||||
promise.fail(baseMsg() + fileListJson.getString("info"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<FileInfo> list = new ArrayList<>();
|
|
||||||
fileListJson.getJsonArray("text").forEach(item -> {
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
"icon": "apk",
|
|
||||||
"t": 0,
|
|
||||||
"id": "iULV2n4361c",
|
|
||||||
"name_all": "xx.apk",
|
|
||||||
"size": "49.8 M",
|
|
||||||
"time": "2021-03-19",
|
|
||||||
"duan": "in4361",
|
|
||||||
"p_ico": 0
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
JsonObject fileJson = (JsonObject) item;
|
|
||||||
FileInfo fileInfo = new FileInfo();
|
|
||||||
String size = fileJson.getString("size");
|
|
||||||
Long sizeNum = FileSizeConverter.convertToBytes(size);
|
|
||||||
String panType = shareLinkInfo.getType();
|
|
||||||
String id = fileJson.getString("id");
|
|
||||||
fileInfo.setFileName(fileJson.getString("name_all"))
|
|
||||||
.setFileId(id)
|
|
||||||
.setCreateTime(fileJson.getString("time"))
|
|
||||||
.setFileType(fileJson.getString("icon"))
|
|
||||||
.setSizeStr(fileJson.getString("size"))
|
|
||||||
.setSize(sizeNum)
|
|
||||||
.setPanType(panType)
|
|
||||||
.setParserUrl(getDomainName() + "/d/" + panType + "/" + id)
|
|
||||||
.setPreviewUrl(String.format("%s/v2/view/%s/%s", getDomainName(),
|
|
||||||
shareLinkInfo.getType(), id));
|
|
||||||
log.debug("文件信息: {}", fileInfo);
|
|
||||||
list.add(fileInfo);
|
|
||||||
});
|
|
||||||
promise.complete(list);
|
|
||||||
});
|
|
||||||
} catch (ScriptException | NoSuchMethodException e) {
|
|
||||||
promise.fail(e);
|
|
||||||
}
|
}
|
||||||
});
|
handleFileListParse(html, pwd, sUrl, promise);
|
||||||
|
}).onFailure(err -> promise.fail(err));
|
||||||
return promise.future();
|
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");
|
||||||
|
Map<String, Object> data = CastUtil.cast(scriptObjectMirror.get("data"));
|
||||||
|
MultiMap map = MultiMap.caseInsensitiveMultiMap();
|
||||||
|
data.forEach((k, v) -> map.set(k, v.toString()));
|
||||||
|
log.debug("解析参数: {}", map);
|
||||||
|
MultiMap headers = getHeaders(sUrl);
|
||||||
|
|
||||||
|
String url = SHARE_URL_PREFIX + "/filemoreajax.php?file=" + data.get("fid");
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
List<FileInfo> list = new ArrayList<>();
|
||||||
|
fileListJson.getJsonArray("text").forEach(item -> {
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"icon": "apk",
|
||||||
|
"t": 0,
|
||||||
|
"id": "iULV2n4361c",
|
||||||
|
"name_all": "xx.apk",
|
||||||
|
"size": "49.8 M",
|
||||||
|
"time": "2021-03-19",
|
||||||
|
"duan": "in4361",
|
||||||
|
"p_ico": 0
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
JsonObject fileJson = (JsonObject) item;
|
||||||
|
FileInfo fileInfo = new FileInfo();
|
||||||
|
String size = fileJson.getString("size");
|
||||||
|
Long sizeNum = FileSizeConverter.convertToBytes(size);
|
||||||
|
String panType = shareLinkInfo.getType();
|
||||||
|
String id = fileJson.getString("id");
|
||||||
|
fileInfo.setFileName(fileJson.getString("name_all"))
|
||||||
|
.setFileId(id)
|
||||||
|
.setCreateTime(fileJson.getString("time"))
|
||||||
|
.setFileType(fileJson.getString("icon"))
|
||||||
|
.setSizeStr(fileJson.getString("size"))
|
||||||
|
.setSize(sizeNum)
|
||||||
|
.setPanType(panType)
|
||||||
|
.setParserUrl(getDomainName() + "/d/" + panType + "/" + id)
|
||||||
|
.setPreviewUrl(String.format("%s/v2/view/%s/%s", getDomainName(),
|
||||||
|
shareLinkInfo.getType(), id));
|
||||||
|
log.debug("文件信息: {}", fileInfo);
|
||||||
|
list.add(fileInfo);
|
||||||
|
});
|
||||||
|
promise.complete(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
promise.fail(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void setFileInfo(String html, ShareLinkInfo shareLinkInfo) {
|
void setFileInfo(String html, ShareLinkInfo shareLinkInfo) {
|
||||||
// 写入 fileInfo
|
// 写入 fileInfo
|
||||||
FileInfo fileInfo = new FileInfo();
|
FileInfo fileInfo = new FileInfo();
|
||||||
|
|||||||
Reference in New Issue
Block a user