123网盘解析规则优化

This commit is contained in:
QAIU
2023-07-24 10:41:25 +08:00
parent 67dc452819
commit 1292440f95
5 changed files with 41 additions and 17 deletions

View File

@@ -26,9 +26,11 @@ import java.util.regex.Pattern;
public class YeTool implements IPanTool {
public static final String SHARE_URL_PREFIX = "https://www.123pan.com/s/";
public static final String FIRST_REQUEST_URL = SHARE_URL_PREFIX + "{key}.html";
private static final String GET_FILE_INFO_URL = "https://www.123pan.com/a/api/share/get?limit=100&next=1&orderBy" +
"=file_name&orderDirection=asc&shareKey={shareKey}&SharePwd={pwd}&ParentFileId=0&Page=1&event" +
"=homeListFile&operateType=1";
// private static final String GET_FILE_INFO_URL = "https://www.123pan.com/a/api/share/get?limit=100&next=1&orderBy" +
// "=file_name&orderDirection=asc&shareKey={shareKey}&SharePwd={pwd}&ParentFileId=0&Page=1&event" +
// "=homeListFile&operateType=1";
private static final String GET_FILE_INFO_URL="https://www.123pan.com/b/api/share/get?limit=100&next=1&orderBy=file_name&orderDirection=asc" +
"&shareKey={shareKey}&SharePwd={pwd}&ParentFileId=0&Page=1&event=homeListFile&operateType=1&auth-key={authKey}";
private static final String DOWNLOAD_API_URL = "https://www.123pan.com/b/api/share/download/info?auth-key={authKey}";
@@ -64,6 +66,9 @@ public class YeTool implements IPanTool {
client.getAbs(UriTemplate.of(GET_FILE_INFO_URL))
.setTemplateParam("shareKey", shareKey)
.setTemplateParam("pwd", code)
.setTemplateParam("authKey", AESUtils.getAuthKey("/b/api/share/get"))
.putHeader("Platform", "web")
.putHeader("App-Version", "3")
.send().onSuccess(res2 -> {
JsonObject infoJson = res2.bodyAsJsonObject();
if (infoJson.getInteger("code") != 0) {
@@ -91,17 +96,29 @@ public class YeTool implements IPanTool {
private static void getDownUrl(Promise<String> promise, WebClient client, JsonObject reqBodyJson) {
log.info(reqBodyJson.encodePrettily());
JsonObject jsonObject = new JsonObject();
// {"ShareKey":"iaKtVv-6OECd","FileID":2193732,"S3keyFlag":"1811834632-0","Size":4203111,"Etag":"69c94adbc0b9190cf23c4e958d8c7c53"}
jsonObject.put("ShareKey", reqBodyJson.getString("ShareKey"));
jsonObject.put("FileID", reqBodyJson.getInteger("FileID"));
jsonObject.put("S3keyFlag", reqBodyJson.getString("S3keyFlag"));
jsonObject.put("Size", reqBodyJson.getInteger("Size"));
jsonObject.put("Etag", reqBodyJson.getString("Etag"));
client.postAbs(UriTemplate.of(DOWNLOAD_API_URL))
.setTemplateParam("authKey", AESUtils.getAuthKey())
.setTemplateParam("authKey", AESUtils.getAuthKey("/b/api/share/download/info"))
.putHeader("Platform", "web")
.putHeader("App-Version", "3")
.sendJsonObject(reqBodyJson).onSuccess(res2 -> {
.sendJsonObject(jsonObject).onSuccess(res2 -> {
JsonObject downURLJson = res2.bodyAsJsonObject();
try {
if (downURLJson.getInteger("code") != 0) {
promise.fail("Ye: downURLJson返回值异常->" + downURLJson);
return;
}
} catch(Exception ignored) {
promise.fail("Ye: downURLJson格式异常->" + downURLJson);
return;
}
String downURL = downURLJson.getJsonObject("data").getString("DownloadURL");
try {
Map<String, String> urlParams = CommonUtils.getURLParams(downURL);
@@ -112,10 +129,16 @@ public class YeTool implements IPanTool {
// 获取直链
client.getAbs(downUrl2).send().onSuccess(res3 -> {
JsonObject res3Json = res3.bodyAsJsonObject();
try {
if (res3Json.getInteger("code") != 0) {
promise.fail("Ye: downUrl2返回值异常->" + res3Json);
return;
}
} catch(Exception ignored) {
promise.fail("Ye: downUrl2格式异常->" + downURLJson);
return;
}
promise.complete(res3Json.getJsonObject("data").getString("redirect_url"));
}).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Ye",

View File

@@ -274,8 +274,7 @@ public class AESUtils {
return new BigInteger(1, digest).toString(16);
}
public static String getAuthKey() {
String _0x2207af = "/b/api/share/download/info";
public static String getAuthKey(String _0x2207af) {
String _0x467baa = "web";
int _0x4965f1 = 3;

View File

@@ -37,9 +37,9 @@ Accept: application/json, text/plain, */*
### 获取下载文件URL
POST https://www.wenshushu.cn/ap/dl/sign
Accept: application/json, text/plain, */*
X-Token:wss:bekzdwsfwwf
X-Token:wss:br57uq0qg03
{"ufileid":"bekoe5n508z","consumeCode":0,"type":1}
{"ufileid":"br4t1rst6xb","consumeCode":0,"type":1}
###
# {
@@ -49,5 +49,5 @@ X-Token:wss:bekzdwsfwwf
# "url": "https://down.wss.show/zkrk4th/9/yj/9yjvzkrk4th?cdn_sign=1686211254-31-0-6edd2e228a030be23210158daeb2c4a1&exp=4800&response-content-disposition=attachment%3B%20filename%3D%22supervision.sql%22%3B%20filename%2A%3Dutf-8%27%27supervision.sql",
### 直接下载
https://down.wss.show/zkrk4th/9/yj/9yjvzkrk4th?cdn_sign=1686211254-31-0-6edd2e228a030be23210158daeb2c4a1&exp=4800&response-content-disposition=attachment%3B%20filename%3D%22supervision.sql%22%3B%20filename%2A%3Dutf-8%27%27supervision.sql
https://down.wss.show/zkrk4th/9/yj/9yjvzkrk4th?cdn_sign=1690012643-63-0-f7761ba9a500a0b300a3b5573693f9ce&exp=4800&response-content-disposition=attachment%3B%20filename%3D%22supervision.sql%22%3B%20filename%2A%3Dutf-8%27%27supervision.sql

View File

@@ -80,6 +80,8 @@ GET http://127.0.0.1:6400/fc/e5079007dc31226096628870c7@QAIU
# https://www.123pan.com/s/iaKtVv-ICECd.html
### 123
GET http://127.0.0.1:6400/json/ye/iaKtVv-ICECd
### 123
GET http://127.0.0.1:6400/json/ye/iaKtVv-6OECd@DcGe
### 123
# @no-redirect

View File

@@ -65,9 +65,9 @@ public class TestAESUtil {
@Test
public void testKeyAuth(){
System.out.println(AESUtils.getAuthKey());
System.out.println(AESUtils.getAuthKey());
System.out.println(AESUtils.getAuthKey());
System.out.println(AESUtils.getAuthKey("/b/api/share/download/info"));
System.out.println(AESUtils.getAuthKey("/b/api/share/download/info"));
System.out.println(AESUtils.getAuthKey("/b/api/share/get"));
}