mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 12:23:03 +00:00
ye目录解析
This commit is contained in:
@@ -19,7 +19,7 @@ public interface IPanTool {
|
||||
*/
|
||||
default Future<List<FileInfo>> parseFileList() {
|
||||
Promise<List<FileInfo>> promise = Promise.promise();
|
||||
promise.complete();
|
||||
promise.fail("Not implemented yet");
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public interface IPanTool {
|
||||
*/
|
||||
default Future<String> parseById() {
|
||||
Promise<String> promise = Promise.promise();
|
||||
promise.complete();
|
||||
promise.complete("Not implemented yet");
|
||||
return promise.future();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package cn.qaiu.parser.impl;
|
||||
|
||||
import cn.qaiu.entity.FileInfo;
|
||||
import cn.qaiu.entity.ShareLinkInfo;
|
||||
import cn.qaiu.parser.PanBase;
|
||||
import cn.qaiu.util.CommonUtils;
|
||||
import cn.qaiu.util.JsExecUtils;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.MultiMap;
|
||||
import io.vertx.core.Promise;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.pointer.JsonPointer;
|
||||
@@ -15,7 +17,9 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.openjdk.nashorn.api.scripting.ScriptObjectMirror;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -32,7 +36,7 @@ public class YeTool extends PanBase {
|
||||
|
||||
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";
|
||||
"&shareKey={shareKey}&SharePwd={pwd}&ParentFileId={ParentFileId}&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 BATCH_DOWNLOAD_API_URL = "https://www.123pan.com/b/api/file/batch_download_share_info?{authK}={authV}";
|
||||
@@ -97,6 +101,7 @@ public class YeTool extends PanBase {
|
||||
client.getAbs(UriTemplate.of(GET_FILE_INFO_URL))
|
||||
.setTemplateParam("shareKey", shareKey)
|
||||
.setTemplateParam("pwd", pwd)
|
||||
.setTemplateParam("ParentFileId", "0")
|
||||
// .setTemplateParam("authKey", AESUtils.getAuthKey("/a/api/share/get"))
|
||||
.putHeader("Platform", "web")
|
||||
.putHeader("App-Version", "3")
|
||||
@@ -227,4 +232,97 @@ public class YeTool extends PanBase {
|
||||
}
|
||||
}).onFailure(this.handleFail(DOWNLOAD_API_URL));
|
||||
}
|
||||
|
||||
|
||||
// dir parser
|
||||
@Override
|
||||
public Future<List<FileInfo>> parseFileList() {
|
||||
Promise<List<FileInfo>> promise = Promise.promise();
|
||||
|
||||
String shareKey = shareLinkInfo.getShareKey(); // 分享链接的唯一标识
|
||||
String pwd = shareLinkInfo.getSharePassword(); // 分享密码
|
||||
String parentFileId = "0"; // 根目录的文件ID
|
||||
String shareId = shareLinkInfo.getShareKey(); // String.valueOf(AESUtils.idEncrypt(dataKey));
|
||||
|
||||
// 如果参数里的目录ID不为空,则直接解析目录
|
||||
String dirId = (String) shareLinkInfo.getOtherParam().get("dirId");
|
||||
if (StringUtils.isNotBlank(dirId)) {
|
||||
parentFileId = dirId;
|
||||
}
|
||||
|
||||
|
||||
// 构造文件列表接口的URL
|
||||
client.getAbs(UriTemplate.of(GET_FILE_INFO_URL))
|
||||
.setTemplateParam("shareKey", shareKey)
|
||||
.setTemplateParam("pwd", pwd)
|
||||
.setTemplateParam("ParentFileId", parentFileId)
|
||||
.putHeaders(header)
|
||||
.send().onSuccess(res -> {
|
||||
JsonObject response = asJson(res);
|
||||
if (response.getInteger("code") != 0) {
|
||||
promise.fail("API错误: " + response.getString("message"));
|
||||
return;
|
||||
}
|
||||
|
||||
JsonArray infoList = response.getJsonObject("data").getJsonArray("InfoList");
|
||||
List<FileInfo> result = new ArrayList<>();
|
||||
|
||||
// 遍历返回的文件和目录信息
|
||||
for (int i = 0; i < infoList.size(); i++) {
|
||||
JsonObject item = infoList.getJsonObject(i);
|
||||
FileInfo fileInfo = new FileInfo();
|
||||
if (item.getInteger("Type") == 0) { // 文件
|
||||
fileInfo.setFileName(item.getString("FileName"))
|
||||
.setFileId(item.getString("FileId"))
|
||||
.setFileType("file")
|
||||
.setSize(item.getLong("Size"))
|
||||
.setParserUrl(String.format("%s/v2/getFileList/%s/%s", getDomainName(),
|
||||
shareLinkInfo.getType(), generateParam(item)))
|
||||
.setPreviewUrl(String.format("%s/v2/viewUrl/%s/%s", getDomainName(),
|
||||
shareLinkInfo.getType(), generateParam(item)));
|
||||
result.add(fileInfo);
|
||||
} else if (item.getInteger("Type") == 1) { // 目录
|
||||
fileInfo.setFileName(item.getString("FileName"))
|
||||
.setFileId(item.getString("FileId"))
|
||||
.setFileType("folder")
|
||||
.setParserUrl(String.format("%s/v2/getFileList?url=%s&dirId=%s", getDomainName(),
|
||||
shareLinkInfo.getShareUrl(), item.getString("FileId")));
|
||||
result.add(fileInfo);
|
||||
}
|
||||
}
|
||||
promise.complete(result);
|
||||
}).onFailure(promise::fail);
|
||||
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Future<String> parseById() {
|
||||
Promise<String> promise = Promise.promise();
|
||||
JsonObject paramJson = (JsonObject) shareLinkInfo.getOtherParam().get("paramJson");
|
||||
|
||||
// 调用下载接口获取直链
|
||||
client.getAbs(UriTemplate.of(DOWNLOAD_API_URL))
|
||||
.setTemplateParam("authK", paramJson.getString("authK"))
|
||||
.setTemplateParam("authV", paramJson.getString("authV"))
|
||||
.putHeaders(header)
|
||||
.send().onSuccess(res -> {
|
||||
JsonObject response = asJson(res);
|
||||
if (response.getInteger("code") != 0) {
|
||||
promise.fail("API错误: " + response.getString("message"));
|
||||
return;
|
||||
}
|
||||
String downloadUrl = response.getJsonObject("data").getString("redirect_url");
|
||||
promise.complete(downloadUrl);
|
||||
}).onFailure(promise::fail);
|
||||
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
|
||||
private String generateParam(JsonObject fileJson) {
|
||||
// 生成API请求所需的加密参数
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,3 +135,23 @@ POST https://www.123684.com/b/api/file/batch_download_share_info?3697171543=1749
|
||||
Content-Type: application/json;charset=UTF-8
|
||||
|
||||
{"ShareKey":"LH3rTd-pENed","fileIdList":[{"fileId":17525951}]}
|
||||
|
||||
###
|
||||
|
||||
https://www.123865.com/b/api/share/get?limit=100&next=-1&orderBy=file_name&orderDirection=asc&shareKey=iaKtVv-FTaCd&SharePwd=qaiu&ParentFileId=0&Page=1&event=homeListFile&operateType=1&OrderId=
|
||||
Accept: */*
|
||||
Accept-Encoding: gzip, deflate, br, zstd
|
||||
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
|
||||
App-Version: 3
|
||||
Connection: keep-alive
|
||||
DNT: 1
|
||||
Host: www.123865.com
|
||||
Referer: https://www.123865.com/s/iaKtVv-FTaCd?%E6%8F%90%E5%8F%96%E7%A0%81%3Aqaiu
|
||||
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/138.0.0.0 Safari/537.36 Edg/138.0.0.0
|
||||
platform: web
|
||||
sec-ch-ua: "Not)A;Brand";v="8", "Chromium";v="138", "Microsoft Edge";v="138"
|
||||
sec-ch-ua-mobile: ?0
|
||||
sec-ch-ua-platform: "Windows"
|
||||
Reference in New Issue
Block a user