mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 20:33:03 +00:00
1. 修复 小飞机解析错误#106
2. 添加 123云盘文件夹分享下解析为压缩包下载直链 3. 添加 123云盘全部域名支持: "www.123pan.com","www.123pan.cn","www.123865.com","www.123684.com","www.123912.com","www.123pan.cn"
This commit is contained in:
@@ -72,7 +72,7 @@ public enum PanDomainTemplate {
|
|||||||
WsTool.class),
|
WsTool.class),
|
||||||
// https://www.123pan.com/s/
|
// https://www.123pan.com/s/
|
||||||
YE("123网盘",
|
YE("123网盘",
|
||||||
compile("https://www\\.(123pan|123865|123684)\\.com/s/(?<KEY>.+)(.html)?"),
|
compile("https://www\\.(123pan\\.com|123865\\.com|123684\\.com|123912\\.com|123pan\\.cn)/s/(?<KEY>.+)(.html)?"),
|
||||||
"https://www.123pan.com/s/{shareKey}",
|
"https://www.123pan.com/s/{shareKey}",
|
||||||
YeTool.class),
|
YeTool.class),
|
||||||
// https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data={code}&isShare=1
|
// https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data={code}&isShare=1
|
||||||
|
|||||||
@@ -15,15 +15,9 @@ import io.vertx.core.json.JsonObject;
|
|||||||
import io.vertx.ext.web.client.HttpRequest;
|
import io.vertx.ext.web.client.HttpRequest;
|
||||||
import io.vertx.uritemplate.UriTemplate;
|
import io.vertx.uritemplate.UriTemplate;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.zip.GZIPInputStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小飞机网盘
|
* 小飞机网盘
|
||||||
@@ -108,33 +102,7 @@ public class FjTool extends PanBase {
|
|||||||
.setTemplateParam("uuid", uuid)
|
.setTemplateParam("uuid", uuid)
|
||||||
.setTemplateParam("ts", tsEncode)
|
.setTemplateParam("ts", tsEncode)
|
||||||
.send().onSuccess(res -> {
|
.send().onSuccess(res -> {
|
||||||
// 处理GZ压缩
|
JsonObject resJson = asJson(res);
|
||||||
// 使用GZIPInputStream来解压数据
|
|
||||||
String decompressedString;
|
|
||||||
try (ByteArrayInputStream bais = new ByteArrayInputStream(res.body().getBytes());
|
|
||||||
GZIPInputStream gzis = new GZIPInputStream(bais);
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(gzis, StandardCharsets.UTF_8))) {
|
|
||||||
|
|
||||||
// 用于存储解压后的字符串
|
|
||||||
StringBuilder decompressedData = new StringBuilder();
|
|
||||||
|
|
||||||
// 逐行读取解压后的数据
|
|
||||||
String line;
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
decompressedData.append(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 此时decompressedData.toString()包含了解压后的字符串
|
|
||||||
decompressedString = decompressedData.toString();
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
// 处理可能的IO异常
|
|
||||||
fail(FIRST_REQUEST_URL + " 响应异常");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 处理GZ压缩结束
|
|
||||||
|
|
||||||
JsonObject resJson = new JsonObject(decompressedString);
|
|
||||||
if (resJson.getInteger("code") != 200) {
|
if (resJson.getInteger("code") != 200) {
|
||||||
fail(FIRST_REQUEST_URL + " 返回异常: " + resJson);
|
fail(FIRST_REQUEST_URL + " 返回异常: " + resJson);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import cn.qaiu.util.CommonUtils;
|
|||||||
import cn.qaiu.util.JsExecUtils;
|
import cn.qaiu.util.JsExecUtils;
|
||||||
import io.vertx.core.Future;
|
import io.vertx.core.Future;
|
||||||
import io.vertx.core.MultiMap;
|
import io.vertx.core.MultiMap;
|
||||||
|
import io.vertx.core.json.JsonArray;
|
||||||
import io.vertx.core.json.JsonObject;
|
import io.vertx.core.json.JsonObject;
|
||||||
|
import io.vertx.core.json.pointer.JsonPointer;
|
||||||
import io.vertx.ext.web.client.WebClient;
|
import io.vertx.ext.web.client.WebClient;
|
||||||
import io.vertx.uritemplate.UriTemplate;
|
import io.vertx.uritemplate.UriTemplate;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -33,6 +35,7 @@ public class YeTool extends PanBase {
|
|||||||
"&shareKey={shareKey}&SharePwd={pwd}&ParentFileId=0&Page=1&event=homeListFile&operateType=1";
|
"&shareKey={shareKey}&SharePwd={pwd}&ParentFileId=0&Page=1&event=homeListFile&operateType=1";
|
||||||
private static final String DOWNLOAD_API_URL = "https://www.123pan.com/a/api/share/download/info?{authK}={authV}";
|
private static final String DOWNLOAD_API_URL = "https://www.123pan.com/a/api/share/download/info?{authK}={authV}";
|
||||||
|
|
||||||
|
private static final String BATCH_DOWNLOAD_API_URL = "https://www.123pan.com/b/api/file/batch_download_share_info?{authK}={authV}";
|
||||||
private final MultiMap header = MultiMap.caseInsensitiveMultiMap();
|
private final MultiMap header = MultiMap.caseInsensitiveMultiMap();
|
||||||
|
|
||||||
public YeTool(ShareLinkInfo shareLinkInfo) {
|
public YeTool(ShareLinkInfo shareLinkInfo) {
|
||||||
@@ -41,8 +44,8 @@ public class YeTool extends PanBase {
|
|||||||
header.set("App-Version", "3");
|
header.set("App-Version", "3");
|
||||||
header.set("Cache-Control", "no-cache");
|
header.set("Cache-Control", "no-cache");
|
||||||
header.set("Connection", "keep-alive");
|
header.set("Connection", "keep-alive");
|
||||||
header.set("DNT", "1");
|
//header.set("DNT", "1");
|
||||||
header.set("Host", "www.123pan.com");
|
//header.set("Host", "www.123pan.com");
|
||||||
header.set("LoginUuid", gen36String());
|
header.set("LoginUuid", gen36String());
|
||||||
header.set("Pragma", "no-cache");
|
header.set("Pragma", "no-cache");
|
||||||
header.set("Referer", shareLinkInfo.getStandardUrl());
|
header.set("Referer", shareLinkInfo.getStandardUrl());
|
||||||
@@ -103,9 +106,23 @@ public class YeTool extends PanBase {
|
|||||||
fail("{} 状态码异常 {}", dataKey, infoJson);
|
fail("{} 状态码异常 {}", dataKey, infoJson);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonObject getFileInfoJson =
|
JsonObject getFileInfoJson =
|
||||||
infoJson.getJsonObject("data").getJsonArray("InfoList").getJsonObject(0);
|
infoJson.getJsonObject("data").getJsonArray("InfoList").getJsonObject(0);
|
||||||
getFileInfoJson.put("ShareKey", shareKey);
|
getFileInfoJson.put("ShareKey", shareKey);
|
||||||
|
|
||||||
|
// 判断是否为文件夹: data->InfoList->0->Type: 1为文件夹, 0为文件
|
||||||
|
try {
|
||||||
|
int type = (Integer)JsonPointer.from("/data/InfoList/0/Type").queryJson(infoJson);
|
||||||
|
if (type == 1) {
|
||||||
|
getZipDownUrl(client, getFileInfoJson);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (Exception exception) {
|
||||||
|
fail("该分享[{}]解析异常: {}", dataKey, exception.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
getDownUrl(client, getFileInfoJson);
|
getDownUrl(client, getFileInfoJson);
|
||||||
}).onFailure(this.handleFail(GET_FILE_INFO_URL));
|
}).onFailure(this.handleFail(GET_FILE_INFO_URL));
|
||||||
} else {
|
} else {
|
||||||
@@ -116,6 +133,11 @@ public class YeTool extends PanBase {
|
|||||||
|
|
||||||
JsonObject reqBodyJson = resListJson.getJsonObject("data").getJsonArray("InfoList").getJsonObject(0);
|
JsonObject reqBodyJson = resListJson.getJsonObject("data").getJsonArray("InfoList").getJsonObject(0);
|
||||||
reqBodyJson.put("ShareKey", shareKey);
|
reqBodyJson.put("ShareKey", shareKey);
|
||||||
|
if (reqBodyJson.getInteger("Type") == 1) {
|
||||||
|
// 文件夹
|
||||||
|
getZipDownUrl(client, reqBodyJson);
|
||||||
|
return;
|
||||||
|
}
|
||||||
getDownUrl(client, reqBodyJson);
|
getDownUrl(client, reqBodyJson);
|
||||||
}).onFailure(this.handleFail(FIRST_REQUEST_URL));
|
}).onFailure(this.handleFail(FIRST_REQUEST_URL));
|
||||||
|
|
||||||
@@ -134,6 +156,21 @@ public class YeTool extends PanBase {
|
|||||||
jsonObject.put("Etag", reqBodyJson.getString("Etag"));
|
jsonObject.put("Etag", reqBodyJson.getString("Etag"));
|
||||||
|
|
||||||
// 调用JS文件获取签名
|
// 调用JS文件获取签名
|
||||||
|
down(client, jsonObject, DOWNLOAD_API_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void getZipDownUrl(WebClient client, JsonObject reqBodyJson) {
|
||||||
|
log.info(reqBodyJson.encodePrettily());
|
||||||
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
// {"ShareKey":"LH3rTd-1ENed","fileIdList":[{"fileId":17525952}]}
|
||||||
|
jsonObject.put("ShareKey", reqBodyJson.getString("ShareKey"));
|
||||||
|
jsonObject.put("fileIdList", new JsonArray().add(JsonObject.of("fileId", reqBodyJson.getInteger("FileId"))));
|
||||||
|
// 调用JS文件获取签名
|
||||||
|
down(client, jsonObject, BATCH_DOWNLOAD_API_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void down(WebClient client, JsonObject jsonObject, String api) {
|
||||||
ScriptObjectMirror getSign;
|
ScriptObjectMirror getSign;
|
||||||
try {
|
try {
|
||||||
getSign = JsExecUtils.executeJs("getSign", "/a/api/share/download/info");
|
getSign = JsExecUtils.executeJs("getSign", "/a/api/share/download/info");
|
||||||
@@ -143,7 +180,7 @@ public class YeTool extends PanBase {
|
|||||||
}
|
}
|
||||||
log.info("ye getSign: {}={}", getSign.get("0").toString(), getSign.get("1").toString());
|
log.info("ye getSign: {}={}", getSign.get("0").toString(), getSign.get("1").toString());
|
||||||
|
|
||||||
client.postAbs(UriTemplate.of(DOWNLOAD_API_URL))
|
client.postAbs(UriTemplate.of(api))
|
||||||
.setTemplateParam("authK", getSign.get("0").toString())
|
.setTemplateParam("authK", getSign.get("0").toString())
|
||||||
.setTemplateParam("authV", getSign.get("1").toString())
|
.setTemplateParam("authV", getSign.get("1").toString())
|
||||||
.putHeader("Platform", "web")
|
.putHeader("Platform", "web")
|
||||||
@@ -160,7 +197,8 @@ public class YeTool extends PanBase {
|
|||||||
fail("Ye: downURLJson格式异常->" + downURLJson);
|
fail("Ye: downURLJson格式异常->" + downURLJson);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String downURL = downURLJson.getJsonObject("data").getString("DownloadURL");
|
String downURL = downURLJson.getJsonObject("data")
|
||||||
|
.getString(api.contains("batch_download_share_info")? "DownloadUrl" : "DownloadURL");
|
||||||
try {
|
try {
|
||||||
Map<String, String> urlParams = CommonUtils.getURLParams(downURL);
|
Map<String, String> urlParams = CommonUtils.getURLParams(downURL);
|
||||||
String params = urlParams.get("params");
|
String params = urlParams.get("params");
|
||||||
|
|||||||
@@ -119,3 +119,19 @@ Platform:web
|
|||||||
{"ShareKey":"iaKtVv-6OECd","behavior":1}
|
{"ShareKey":"iaKtVv-6OECd","behavior":1}
|
||||||
|
|
||||||
### eaefamemdead
|
### eaefamemdead
|
||||||
|
https://www.123684.com/b/api/share/get?2393880368=1749017805-9397896-3041863692&limit=100&next=0&orderBy=file_name&orderDirection=asc&shareKey=LH3rTd-pENed&SharePwd=qaiu&ParentFileId=0&Page=1&event=homeListFile&operateType=1
|
||||||
|
Referer: https://www.123684.com/s/LH3rTd-pENed
|
||||||
|
Sec-Fetch-Dest: empty
|
||||||
|
Sec-Fetch-Mode: cors
|
||||||
|
Sec-Fetch-Site: same-origin
|
||||||
|
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0
|
||||||
|
platform: web
|
||||||
|
sec-ch-ua: "Chromium";v="136", "Microsoft Edge";v="136", "Not.A/Brand";v="99"
|
||||||
|
sec-ch-ua-mobile: ?0
|
||||||
|
sec-ch-ua-platform: "Windows"
|
||||||
|
|
||||||
|
###
|
||||||
|
POST https://www.123684.com/b/api/file/batch_download_share_info?3697171543=1749019332-221279-1801740277
|
||||||
|
Content-Type: application/json;charset=UTF-8
|
||||||
|
|
||||||
|
{"ShareKey":"LH3rTd-pENed","fileIdList":[{"fileId":17525951}]}
|
||||||
|
|||||||
Reference in New Issue
Block a user