mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 12:23:03 +00:00
修改123网盘解析规则
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package cn.qaiu.lz.common.parser.impl;
|
package cn.qaiu.lz.common.parser.impl;
|
||||||
|
|
||||||
import cn.qaiu.lz.common.parser.IPanTool;
|
import cn.qaiu.lz.common.parser.IPanTool;
|
||||||
|
import cn.qaiu.lz.common.util.AESUtils;
|
||||||
import cn.qaiu.lz.common.util.CommonUtils;
|
import cn.qaiu.lz.common.util.CommonUtils;
|
||||||
import cn.qaiu.lz.common.util.PanExceptionUtils;
|
import cn.qaiu.lz.common.util.PanExceptionUtils;
|
||||||
import cn.qaiu.vx.core.util.VertxHolder;
|
import cn.qaiu.vx.core.util.VertxHolder;
|
||||||
@@ -29,6 +30,8 @@ public class YeTool implements IPanTool {
|
|||||||
"=file_name&orderDirection=asc&shareKey={shareKey}&SharePwd={pwd}&ParentFileId=0&Page=1&event" +
|
"=file_name&orderDirection=asc&shareKey={shareKey}&SharePwd={pwd}&ParentFileId=0&Page=1&event" +
|
||||||
"=homeListFile&operateType=1";
|
"=homeListFile&operateType=1";
|
||||||
|
|
||||||
|
private static final String DOWNLOAD_API_URL = "https://www.123pan.com/b/api/share/download/info?auth-key={authKey}";
|
||||||
|
|
||||||
public Future<String> parse(String data, String code) {
|
public Future<String> parse(String data, String code) {
|
||||||
|
|
||||||
String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data);
|
String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data);
|
||||||
@@ -88,21 +91,39 @@ public class YeTool implements IPanTool {
|
|||||||
|
|
||||||
private static void getDownUrl(Promise<String> promise, WebClient client, JsonObject reqBodyJson) {
|
private static void getDownUrl(Promise<String> promise, WebClient client, JsonObject reqBodyJson) {
|
||||||
log.info(reqBodyJson.encodePrettily());
|
log.info(reqBodyJson.encodePrettily());
|
||||||
client.postAbs("https://www.123pan.com/a/api/share/download/info").sendJsonObject(reqBodyJson).onSuccess(res2 -> {
|
client.postAbs(UriTemplate.of(DOWNLOAD_API_URL))
|
||||||
JsonObject downURLJson = res2.bodyAsJsonObject();
|
.setTemplateParam("authKey", AESUtils.getAuthKey())
|
||||||
System.out.println(downURLJson);
|
.putHeader("Platform", "web")
|
||||||
if (downURLJson.getInteger("code") != 0) {
|
.putHeader("App-Version", "3")
|
||||||
return;
|
.sendJsonObject(reqBodyJson).onSuccess(res2 -> {
|
||||||
}
|
JsonObject downURLJson = res2.bodyAsJsonObject();
|
||||||
String downURL = downURLJson.getJsonObject("data").getString("DownloadURL");
|
|
||||||
try {
|
if (downURLJson.getInteger("code") != 0) {
|
||||||
Map<String, String> urlParams = CommonUtils.getURLParams(downURL);
|
promise.fail("Ye: downURLJson返回值异常->" + downURLJson);
|
||||||
String params = urlParams.get("params");
|
return;
|
||||||
byte[] decodeByte = Base64.getDecoder().decode(params);
|
}
|
||||||
promise.complete(new String(decodeByte));
|
String downURL = downURLJson.getJsonObject("data").getString("DownloadURL");
|
||||||
} catch (MalformedURLException e) {
|
try {
|
||||||
promise.fail("urlParams解析异常" + e.getMessage());
|
Map<String, String> urlParams = CommonUtils.getURLParams(downURL);
|
||||||
}
|
String params = urlParams.get("params");
|
||||||
}).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Ye", reqBodyJson.encodePrettily(), t)));
|
byte[] decodeByte = Base64.getDecoder().decode(params);
|
||||||
|
String downUrl2 = new String(decodeByte);
|
||||||
|
|
||||||
|
// 获取直链
|
||||||
|
client.getAbs(downUrl2).send().onSuccess(res3 -> {
|
||||||
|
JsonObject res3Json = res3.bodyAsJsonObject();
|
||||||
|
if (res3Json.getInteger("code") != 0) {
|
||||||
|
promise.fail("Ye: downUrl2返回值异常->" + res3Json);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
promise.complete(res3Json.getJsonObject("data").getString("redirect_url"));
|
||||||
|
|
||||||
|
}).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Ye",
|
||||||
|
reqBodyJson.encodePrettily(), t)));
|
||||||
|
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
promise.fail("urlParams解析异常" + e.getMessage());
|
||||||
|
}
|
||||||
|
}).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Ye", reqBodyJson.encodePrettily(), t)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
|
|
||||||
import javax.crypto.*;
|
import javax.crypto.*;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.Key;
|
import java.security.Key;
|
||||||
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HexFormat;
|
import java.util.HexFormat;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@@ -257,5 +260,31 @@ public class AESUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=============================== 123pan加密相关 ===============================
|
||||||
|
|
||||||
|
public static String getMD5Str(String str) {
|
||||||
|
byte[] digest;
|
||||||
|
try {
|
||||||
|
MessageDigest md5 = MessageDigest.getInstance("md5");
|
||||||
|
digest = md5.digest(str.getBytes(StandardCharsets.UTF_8));
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
//16是表示转换为16进制数
|
||||||
|
return new BigInteger(1, digest).toString(16);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getAuthKey() {
|
||||||
|
String _0x2207af = "/b/api/share/download/info";
|
||||||
|
String _0x467baa = "web";
|
||||||
|
int _0x4965f1 = 3;
|
||||||
|
|
||||||
|
String _0x430930 = String.valueOf(Math.round(0x989680 * Math.random()));
|
||||||
|
String _0x53928f = String.valueOf(new Date().getTime() / 0x3e8);
|
||||||
|
String _0x49ec94 = getMD5Str(_0x53928f + "|" + _0x430930 + "|" + _0x2207af + "|" + _0x467baa + "|" + _0x4965f1
|
||||||
|
+ "|8-8D$sL8gPjom7bk#cY");
|
||||||
|
|
||||||
|
return _0x53928f + "-" + _0x430930 + "-" + _0x49ec94;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,3 +82,26 @@ Content-Type:application/json;charset=UTF-8
|
|||||||
},
|
},
|
||||||
"publicPath": "https://www.123pan.com/a/api/"
|
"publicPath": "https://www.123pan.com/a/api/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
https://www.123pan.com/b/api/share/get?limit=100&next=1&orderBy=file_name&orderDirection=asc&shareKey=iaKtVv-6OECd&SharePwd=DcGe&ParentFileId=0&Page=1&event=homeListFile&operateType=1&auth-key=1689990170-3703305-62c1030a465013b7c18eddb49156b67b
|
||||||
|
|
||||||
|
|
||||||
|
# 23/07/22 123pan添加header
|
||||||
|
###
|
||||||
|
POST https://www.123pan.com/b/api/share/download/info?auth-key=1689996626-2926572-49f4cde9a911469869ee264cb6ae8426
|
||||||
|
App-Version:3
|
||||||
|
Platform:web
|
||||||
|
|
||||||
|
{"ShareKey":"iaKtVv-6OECd","FileID":2193732,"S3keyFlag":"1811834632-0","Size":4203111,"Etag":"69c94adbc0b9190cf23c4e958d8c7c53"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
https://www.123pan.com/a/api/share/get?limit=100&next=1&orderBy=file_name&orderDirection=asc&shareKey=iaKtVv-6OECd&SharePwd=DcGe&ParentFileId=0&Page=1&event=homeListFile&operateType=1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -76,12 +76,14 @@ GET http://127.0.0.1:6400/fc/e5079007dc31226096628870c7@QAIU
|
|||||||
|
|
||||||
#https://v2.fangcloud.com/sharing/e5079007dc31226096628870c7
|
#https://v2.fangcloud.com/sharing/e5079007dc31226096628870c7
|
||||||
|
|
||||||
|
|
||||||
|
# https://www.123pan.com/s/iaKtVv-ICECd.html
|
||||||
### 123
|
### 123
|
||||||
GET http://127.0.0.1:6400/json/ye/iaKtVv-qOECd
|
GET http://127.0.0.1:6400/json/ye/iaKtVv-ICECd
|
||||||
|
|
||||||
### 123
|
### 123
|
||||||
# @no-redirect
|
# @no-redirect
|
||||||
GET http://127.0.0.1:6400/ye/iaKtVv-qOECd@asdads
|
GET http://127.0.0.1:6400/ye/iaKtVv-qOECd
|
||||||
|
|
||||||
### 123
|
### 123
|
||||||
# @no-redirect
|
# @no-redirect
|
||||||
|
|||||||
@@ -62,4 +62,19 @@ public class TestAESUtil {
|
|||||||
System.out.println(AESUtils.getRandomString());
|
System.out.println(AESUtils.getRandomString());
|
||||||
System.out.println(AESUtils.getRandomString());
|
System.out.println(AESUtils.getRandomString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testKeyAuth(){
|
||||||
|
System.out.println(AESUtils.getAuthKey());
|
||||||
|
System.out.println(AESUtils.getAuthKey());
|
||||||
|
System.out.println(AESUtils.getAuthKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAES2() throws NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException,
|
||||||
|
BadPaddingException, InvalidKeyException {
|
||||||
|
System.out.println(AESUtils.encryptBase64ByAES("AAAAA", "123123"));
|
||||||
|
System.out.println(AESUtils.encryptBase64ByAES("AAAAA", AESUtils.generateKey("123123")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user