mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 12:23:03 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23a18aba5c | ||
|
|
2d5a79bb16 | ||
|
|
51e1bbefbb | ||
|
|
6647fc5371 | ||
|
|
b67544f0cd | ||
|
|
ef5826a73b | ||
|
|
a48adbd0df | ||
|
|
5c60493a24 | ||
|
|
55e6227de0 | ||
|
|
24a7395004 | ||
|
|
b2a7187fc5 | ||
|
|
ace7cdc88e | ||
|
|
2e909b5868 | ||
|
|
de78bcbc98 | ||
|
|
c560f0e902 | ||
|
|
88860c9302 |
@@ -1,7 +1,10 @@
|
||||
FROM eclipse-temurin:17-alpine
|
||||
FROM eclipse-temurin:17-jre
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 安装 unzip
|
||||
RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY ./web-service/target/netdisk-fast-download-bin.zip .
|
||||
|
||||
RUN unzip netdisk-fast-download-bin.zip && \
|
||||
|
||||
14
bin/stop.sh
Normal file
14
bin/stop.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# set -x
|
||||
|
||||
# 找到运行中的 Java 进程的 PID
|
||||
PID=$(ps -ef | grep 'netdisk-fast-download.jar' | grep -v grep | awk '{print $2}')
|
||||
|
||||
if [ -z "$PID" ]; then
|
||||
echo "未找到正在运行的进程 netdisk-fast-download.jar"
|
||||
exit 1
|
||||
else
|
||||
# 杀掉进程
|
||||
echo "停止 netdisk-fast-download.jar (PID: $PID)..."
|
||||
kill -9 "$PID"
|
||||
fi
|
||||
@@ -14,9 +14,6 @@
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<slf4j.version>2.0.5</slf4j.version>
|
||||
<commons-lang3.version>3.12.0</commons-lang3.version>
|
||||
<vertx.version>4.5.6</vertx.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -3,15 +3,14 @@ package cn.qaiu.parser.impl;
|
||||
import cn.qaiu.entity.FileInfo;
|
||||
import cn.qaiu.entity.ShareLinkInfo;
|
||||
import cn.qaiu.parser.PanBase;
|
||||
import cn.qaiu.util.CastUtil;
|
||||
import cn.qaiu.util.FileSizeConverter;
|
||||
import cn.qaiu.util.HeaderUtils;
|
||||
import cn.qaiu.util.JsExecUtils;
|
||||
import cn.qaiu.util.*;
|
||||
import io.netty.handler.codec.http.cookie.DefaultCookie;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.MultiMap;
|
||||
import io.vertx.core.Promise;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.ext.web.client.WebClient;
|
||||
import io.vertx.ext.web.client.WebClientSession;
|
||||
import org.openjdk.nashorn.api.scripting.ScriptObjectMirror;
|
||||
|
||||
import javax.script.ScriptException;
|
||||
@@ -28,7 +27,7 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
public class LzTool extends PanBase {
|
||||
|
||||
public static final String SHARE_URL_PREFIX = "https://wwww.lanzoup.com";
|
||||
public static final String SHARE_URL_PREFIX = "https://wwww.lanzoum.com";
|
||||
|
||||
|
||||
public LzTool(ShareLinkInfo shareLinkInfo) {
|
||||
@@ -117,7 +116,7 @@ public class LzTool extends PanBase {
|
||||
map.add((String) k, v.toString());
|
||||
});
|
||||
MultiMap headers = HeaderUtils.parseHeaders("""
|
||||
Accept: application/json, text/javascript, */*
|
||||
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
|
||||
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
|
||||
Cache-Control: no-cache
|
||||
@@ -146,8 +145,38 @@ public class LzTool extends PanBase {
|
||||
}
|
||||
String downUrl = urlJson.getString("dom") + "/file/" + urlJson.getString("url");
|
||||
headers.remove("Referer");
|
||||
client.getAbs(downUrl).putHeaders(headers).send()
|
||||
.onSuccess(res3 -> promise.complete(res3.headers().get("Location")))
|
||||
WebClientSession webClientSession = WebClientSession.create(client);
|
||||
webClientSession.getAbs(downUrl).putHeaders(headers).send()
|
||||
.onSuccess(res3 -> {
|
||||
String location = res3.headers().get("Location");
|
||||
if (location == null) {
|
||||
String text = asText(res3);
|
||||
// 使用cookie 再请求一次
|
||||
headers.add("Referer", downUrl);
|
||||
int beginIndex = text.indexOf("arg1='") + 6;
|
||||
String arg1 = text.substring(beginIndex, text.indexOf("';", beginIndex));
|
||||
String acw_sc__v2 = AcwScV2Generator.acwScV2Simple(arg1);
|
||||
// 创建一个 Cookie 并放入 CookieStore
|
||||
DefaultCookie nettyCookie = new DefaultCookie("acw_sc__v2", acw_sc__v2);
|
||||
nettyCookie.setDomain(".lanrar.com"); // 设置域名
|
||||
nettyCookie.setPath("/"); // 设置路径
|
||||
nettyCookie.setSecure(false);
|
||||
nettyCookie.setHttpOnly(false);
|
||||
webClientSession.cookieStore().put(nettyCookie);
|
||||
webClientSession.getAbs(downUrl).putHeaders(headers).send()
|
||||
.onSuccess(res4 -> {
|
||||
String location0 = res4.headers().get("Location");
|
||||
if (location0 == null) {
|
||||
fail(downUrl + " -> 直链获取失败, 可能分享已失效");
|
||||
} else {
|
||||
promise.complete(location0);
|
||||
}
|
||||
}).onFailure(handleFail(downUrl));
|
||||
return;
|
||||
}
|
||||
|
||||
promise.complete(location);
|
||||
})
|
||||
.onFailure(handleFail(downUrl));
|
||||
} catch (Exception e) {
|
||||
fail("解析异常");
|
||||
|
||||
@@ -66,87 +66,41 @@ public class YeTool extends PanBase {
|
||||
|
||||
public Future<String> parse() {
|
||||
|
||||
final String dataKey = shareLinkInfo.getShareKey();
|
||||
final String shareKey = shareLinkInfo.getShareKey().replaceAll("(\\..*)|(#.*)", "");
|
||||
final String pwd = shareLinkInfo.getSharePassword();
|
||||
|
||||
client.getAbs(UriTemplate.of(FIRST_REQUEST_URL)).setTemplateParam("key", dataKey).send().onSuccess(res -> {
|
||||
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")
|
||||
.send().onSuccess(res2 -> {
|
||||
JsonObject infoJson = asJson(res2);
|
||||
if (infoJson.getInteger("code") != 0) {
|
||||
fail("{} 状态码异常 {}", shareKey, infoJson);
|
||||
return;
|
||||
}
|
||||
|
||||
String html = res.bodyAsString();
|
||||
// 判断分享是否已经失效
|
||||
if (html.contains("分享链接已失效")) {
|
||||
fail("该分享已失效({})已失效", shareLinkInfo.getShareUrl());
|
||||
return;
|
||||
}
|
||||
JsonObject getFileInfoJson =
|
||||
infoJson.getJsonObject("data").getJsonArray("InfoList").getJsonObject(0);
|
||||
getFileInfoJson.put("ShareKey", shareKey);
|
||||
|
||||
Pattern compile = Pattern.compile("window.g_initialProps\\s*=\\s*(.*);");
|
||||
Matcher matcher = compile.matcher(html);
|
||||
|
||||
if (!matcher.find()) {
|
||||
fail("该分享({})文件信息找不到, 可能分享已失效", shareLinkInfo.getShareUrl());
|
||||
return;
|
||||
}
|
||||
String fileInfoString = matcher.group(1);
|
||||
JsonObject fileInfoJson = new JsonObject(fileInfoString);
|
||||
JsonObject resJson = fileInfoJson.getJsonObject("res");
|
||||
JsonObject resListJson = fileInfoJson.getJsonObject("reslist");
|
||||
|
||||
if (resJson == null || resJson.getInteger("code") != 0) {
|
||||
fail(dataKey + " 解析到异常JSON: " + resJson);
|
||||
return;
|
||||
}
|
||||
String shareKey = resJson.getJsonObject("data").getString("ShareKey");
|
||||
|
||||
if (resListJson == null || resListJson.getInteger("code") != 0) {
|
||||
// 加密分享
|
||||
if (StringUtils.isNotEmpty(pwd)) {
|
||||
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")
|
||||
.send().onSuccess(res2 -> {
|
||||
JsonObject infoJson = asJson(res2);
|
||||
if (infoJson.getInteger("code") != 0) {
|
||||
fail("{} 状态码异常 {}", dataKey, infoJson);
|
||||
return;
|
||||
}
|
||||
|
||||
JsonObject getFileInfoJson =
|
||||
infoJson.getJsonObject("data").getJsonArray("InfoList").getJsonObject(0);
|
||||
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);
|
||||
}).onFailure(this.handleFail(GET_FILE_INFO_URL));
|
||||
} else {
|
||||
fail("该分享[{}]需要密码",dataKey);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
JsonObject reqBodyJson = resListJson.getJsonObject("data").getJsonArray("InfoList").getJsonObject(0);
|
||||
reqBodyJson.put("ShareKey", shareKey);
|
||||
if (reqBodyJson.getInteger("Type") == 1) {
|
||||
// 文件夹
|
||||
getZipDownUrl(client, reqBodyJson);
|
||||
return;
|
||||
}
|
||||
getDownUrl(client, reqBodyJson);
|
||||
}).onFailure(this.handleFail(FIRST_REQUEST_URL));
|
||||
// 判断是否为文件夹: 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("该分享[{}]解析异常: {}", shareKey, exception.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
getDownUrl(client, getFileInfoJson);
|
||||
}).onFailure(this.handleFail(GET_FILE_INFO_URL));
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
@@ -243,7 +197,6 @@ public class YeTool extends PanBase {
|
||||
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");
|
||||
|
||||
52
parser/src/main/java/cn/qaiu/util/AcwScV2Generator.java
Normal file
52
parser/src/main/java/cn/qaiu/util/AcwScV2Generator.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package cn.qaiu.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class AcwScV2Generator {
|
||||
|
||||
public static String acwScV2Simple(String arg1) {
|
||||
// 映射表
|
||||
int[] posList = {15,35,29,24,33,16,1,38,10,9,19,31,40,27,22,23,25,
|
||||
13,6,11,39,18,20,8,14,21,32,26,2,30,7,4,17,5,3,
|
||||
28,34,37,12,36};
|
||||
|
||||
String mask = "3000176000856006061501533003690027800375";
|
||||
String[] outPutList = new String[40];
|
||||
Arrays.fill(outPutList, "");
|
||||
|
||||
// 重排 arg1
|
||||
for (int i = 0; i < arg1.length(); i++) {
|
||||
char ch = arg1.charAt(i);
|
||||
for (int j = 0; j < posList.length; j++) {
|
||||
if (posList[j] == i + 1) {
|
||||
outPutList[j] = String.valueOf(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder arg2 = new StringBuilder();
|
||||
for (String s : outPutList) {
|
||||
arg2.append(s);
|
||||
}
|
||||
|
||||
// 按 mask 异或
|
||||
StringBuilder result = new StringBuilder();
|
||||
int length = Math.min(arg2.length(), mask.length());
|
||||
|
||||
for (int i = 0; i < length; i += 2) {
|
||||
String strHex = arg2.substring(i, i + 2);
|
||||
String maskHex = mask.substring(i, i + 2);
|
||||
|
||||
int strVal = Integer.parseInt(strHex, 16);
|
||||
int maskVal = Integer.parseInt(maskHex, 16);
|
||||
|
||||
int xor = strVal ^ maskVal;
|
||||
|
||||
// 补齐 2 位小写 16 进制
|
||||
result.append(String.format("%02x", xor));
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
||||
18
parser/src/test/java/cn/qaiu/util/AcwScV2GeneratorTest.java
Normal file
18
parser/src/test/java/cn/qaiu/util/AcwScV2GeneratorTest.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package cn.qaiu.util;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import static cn.qaiu.util.AcwScV2Generator.acwScV2Simple;
|
||||
|
||||
public class AcwScV2GeneratorTest {
|
||||
|
||||
// 简单测试
|
||||
@Test
|
||||
public void testCookie() {
|
||||
String arg1 = "3E40CCD6747C0E55B0531DB86380DDA1D08CE247";
|
||||
String cookie = acwScV2Simple(arg1);
|
||||
Assert.assertEquals("68d8c25247df18dd66d24165d11084d09bc00db9", cookie);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,4 +29,20 @@ public class TestRegex {
|
||||
System.out.println(matcher.group(1));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testYeShareKey() {
|
||||
String url = "ABCD1234-asdasd";
|
||||
String shareKey = url.replaceAll("(\\..*)|(#.*)", "");
|
||||
System.out.println(shareKey);
|
||||
url = "ABCD1234-adasd.html";
|
||||
shareKey = url.replaceAll("(\\..*)|(#.*)", "");
|
||||
System.out.println(shareKey);
|
||||
url = "ABCD1234-adasd#123123";
|
||||
shareKey = url.replaceAll("(\\..*)|(#.*)", "");
|
||||
System.out.println(shareKey);
|
||||
url = "ABCD1234-adasd.html#123123";
|
||||
shareKey = url.replaceAll("(\\..*)|(#.*)", "");
|
||||
System.out.println(shareKey);
|
||||
}
|
||||
}
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -25,7 +25,7 @@
|
||||
|
||||
<packageDirectory>${project.basedir}/web-service/target/package</packageDirectory>
|
||||
|
||||
<vertx.version>4.5.6</vertx.version>
|
||||
<vertx.version>4.5.21</vertx.version>
|
||||
<org.reflections.version>0.10.2</org.reflections.version>
|
||||
<lombok.version>1.18.38</lombok.version>
|
||||
<slf4j.version>2.0.5</slf4j.version>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@vueuse/core": "^11.2.0",
|
||||
"axios": "1.11.0",
|
||||
"axios": "1.12.0",
|
||||
"clipboard": "^2.0.11",
|
||||
"core-js": "^3.8.3",
|
||||
"element-plus": "^2.8.7",
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</div>
|
||||
<!-- 项目简介移到卡片内 -->
|
||||
<div class="project-intro">
|
||||
<div class="intro-title">NFD网盘直链解析0.1.9_bate8</div>
|
||||
<div class="intro-title">NFD网盘直链解析0.1.9_b9m</div>
|
||||
<div class="intro-desc">
|
||||
<div>支持网盘:蓝奏云、蓝奏云优享、小飞机盘、123云盘、奶牛快传、移动云空间、QQ邮箱云盘、QQ闪传等 <el-link style="color:#606cf5" href="https://github.com/qaiu/netdisk-fast-download?tab=readme-ov-file#%E7%BD%91%E7%9B%98%E6%94%AF%E6%8C%81%E6%83%85%E5%86%B5" target="_blank"> >> </el-link></div>
|
||||
<div>文件夹解析支持:蓝奏云、蓝奏云优享、小飞机盘、123云盘</div>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
###
|
||||
POST http://127.0.0.1:6400/v2/shout/submit
|
||||
POST https://lzzz.qaiu.top/v2/shout/submit
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"content": "CREATE UNIQUE INDEX `idx_uk_code` ON `t_messages` (`code`);"
|
||||
"content": "ok 123123123123123123123123123123123123123123123123123123123123231123123"
|
||||
}
|
||||
|
||||
###
|
||||
GET http://127.0.0.1:6400/v2/shout/retrieve?code=878696
|
||||
GET http://lzzz.qaiu.top/v2/shout/retrieve?code=414016
|
||||
|
||||
###
|
||||
响应:
|
||||
@@ -16,3 +16,6 @@ GET http://127.0.0.1:6400/v2/shout/retrieve?code=878696
|
||||
"code": 200,
|
||||
"msg": "success"
|
||||
}
|
||||
|
||||
###
|
||||
https://gfs302n511.userstorage.mega.co.nz/dl/XwiiRG-Z97rz7wcbWdDmcd654FGkYU3FJncTobxhpPR9GVSggHJQsyMGdkLsWEiIIf71RUXcQPtV7ljVc0Z3tA_ThaUb9msdh7tS0z-2CbaRYSM5176DFxDKQtG84g
|
||||
Reference in New Issue
Block a user