mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-07-13 06:51:14 +00:00
Compare commits
353 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 69d5f269bd | |||
| 459c974cb8 | |||
| 2f22cb01eb | |||
| e17fb99de4 | |||
| 0f926a57ef | |||
| 4380bfe0d6 | |||
| 8127cd0758 | |||
| 71a220f42b | |||
| d3b02676ec | |||
| d8f0dc4f8e | |||
| 48aa5b6148 | |||
| a989841a89 | |||
| 86783e8e46 | |||
| 66b9bcc53a | |||
| ff08615d1e | |||
| 4a6c3a1f90 | |||
| c79702eba8 | |||
| 41fc935c09 | |||
| 5fbbe5b240 | |||
| 9c121c03f2 | |||
| b74c3f31c4 | |||
| f23b97e22c | |||
| 0560989e77 | |||
| f2c9c34324 | |||
| a97268c702 | |||
| 2654b550fb | |||
| 12a5a17a30 | |||
| e346812c0a | |||
| 6b2e391af9 | |||
| 199456cb11 | |||
| 636994387f | |||
| 90c79f7bac | |||
| 79601b36a5 | |||
| 96cef89f08 | |||
| e057825b25 | |||
| ebe848dfe8 | |||
| e259a0989e | |||
| f750aa68e8 | |||
| 49b8501e86 | |||
| fc2e2a4697 | |||
| b4b1d7f923 | |||
| df646b8c43 | |||
| 8e790f6b22 | |||
| 2e76af980e | |||
| 80ccbe5b62 | |||
| aa0cd68f7f | |||
| 51833148b1 | |||
| 0fa77ebf21 | |||
| 584c075930 | |||
| 9e7a3718a4 | |||
| 0e2ca2f1ca | |||
| 52e889333b | |||
| 4745440079 | |||
| b5628eac17 | |||
| d23b11577e | |||
| f1dd9fc0ee | |||
| 0877fadcfb | |||
| 733059dc8e | |||
| 321380c2b9 | |||
| deb121a51b | |||
| b6aef7c239 | |||
| b13a7a5ee1 | |||
| fff6a00690 | |||
| b4da3cee20 | |||
| 0a650996a1 | |||
| 37b91cd388 | |||
| 42b721eabf | |||
| 231d5c3fb9 | |||
| 064efdf3f3 | |||
| 7b364a0f90 | |||
| c8a4ca7f16 | |||
| 97627b824c | |||
| 6dbdc9bd90 | |||
| 4166ea10af | |||
| fa12ab2c51 | |||
| 4fc4ed8640 | |||
| 48172f2769 | |||
| c7e6d68fbd | |||
| e6672a51c5 | |||
| abde7841ac | |||
| 8e661ed1c5 | |||
| 217cb3a776 | |||
| b8c1bca900 | |||
| 5e09b8e92a | |||
| c16bde6bb8 | |||
| eb06eb9f3d | |||
| 0c49088098 | |||
| b970241a64 | |||
| 6c5aafc11e | |||
| ca0846f4a7 | |||
| 14f7fcc5ad | |||
| 23a18aba5c | |||
| 2d5a79bb16 | |||
| 51e1bbefbb | |||
| 6647fc5371 | |||
| b67544f0cd | |||
| ef5826a73b | |||
| a48adbd0df | |||
| 5c60493a24 | |||
| 55e6227de0 | |||
| 24a7395004 | |||
| b2a7187fc5 | |||
| ace7cdc88e | |||
| 2e909b5868 | |||
| de78bcbc98 | |||
| c560f0e902 | |||
| 88860c9302 | |||
| ef65d0e095 | |||
| 6438505f4a | |||
| 1be5030dd1 | |||
| 421b2f4a42 | |||
| a66bf84381 | |||
| 0c4d366d6d | |||
| a1d0a921fa | |||
| 2092230a61 | |||
| 6e5ae6eff3 | |||
| 4f8259d772 | |||
| 8b987d9824 | |||
| e8ba451d18 | |||
| 77758db463 | |||
| 6c58598a8e | |||
| 3ac35230a3 | |||
| ca91302d28 | |||
| e07272a5dc | |||
| 461305e1df | |||
| 8e8ab10a0f | |||
| e754326925 | |||
| 4c92994c6f | |||
| 66c57f47ac | |||
| ec689eadd8 | |||
| c1e15709a7 | |||
| 2848937ce7 | |||
| 42ff0c21b2 | |||
| 3ed7e547e6 | |||
| fad8e688df | |||
| b2f2dcac4c | |||
| fcba78e977 | |||
| 77c9d777a1 | |||
| 4460659210 | |||
| 8631524107 | |||
| 0579588814 | |||
| df2bfb6ac7 | |||
| 517b6f8910 | |||
| 94a46d2833 | |||
| 1631a0faa1 | |||
| 06d5943cb6 | |||
| 3095e13676 | |||
| 482cbce7e8 | |||
| ef2fc3ab98 | |||
| 5b57b05eae | |||
| 093579c6f5 | |||
| c2d4990d7f | |||
| 40e8380738 | |||
| b716e1e861 | |||
| 8432d4952c | |||
| dd8f085f63 | |||
| 161ff8d8a3 | |||
| 1390cd0104 | |||
| 7a02b1e97f | |||
| 036f107c90 | |||
| 5652383450 | |||
| 9a047a5da0 | |||
| 8975743a37 | |||
| 0e30eafe49 | |||
| 7facb62f21 | |||
| 30d43cb961 | |||
| c505b17e35 | |||
| 080c4c753d | |||
| ade0d34d91 | |||
| 56d082eb0b | |||
| 795c4529ba | |||
| 0f5cfe22ea | |||
| 925ad2c3a5 | |||
| f3e96907fe | |||
| 75a1e58a7d | |||
| 379e889f71 | |||
| 40c06f397b | |||
| 9e9302436e | |||
| 6d816d4193 | |||
| 438eda9c08 | |||
| ace39e4633 | |||
| 7712391f29 | |||
| 65f08dcb02 | |||
| 1d332aa6f4 | |||
| ba81641517 | |||
| fb30bdb879 | |||
| fc451d3b41 | |||
| ffee1f3462 | |||
| f30027dd13 | |||
| 8b6aad17f4 | |||
| b77930adfb | |||
| aff8f88076 | |||
| 4e6582e24c | |||
| fa9acaccfd | |||
| 0414f85f12 | |||
| 527dd0eeb4 | |||
| 74ed7475c9 | |||
| 54dc3dba96 | |||
| 9980159090 | |||
| 0b193ebb00 | |||
| f5fc9843b2 | |||
| df1f67dd26 | |||
| b069a5f576 | |||
| 7686763a03 | |||
| 635a6eac37 | |||
| 877edc535f | |||
| 01d59e3c1e | |||
| fece2799e3 | |||
| de9756ee86 | |||
| 51f047a51b | |||
| 04b66e82b7 | |||
| df89253647 | |||
| 45dbca794e | |||
| 857bf28f99 | |||
| e07ce15228 | |||
| 0637bcfd8e | |||
| 23db0563ac | |||
| ccba71aa4e | |||
| fee4bf2ad6 | |||
| 5052fea9ef | |||
| e85215fca1 | |||
| e42fe45329 | |||
| 4240815bd1 | |||
| 6f0c5305e2 | |||
| 757005cad8 | |||
| 81651ad97c | |||
| f3763b6058 | |||
| 82478dc485 | |||
| 703fd05d43 | |||
| ff868b6e2a | |||
| 051a74b37b | |||
| a0a1085623 | |||
| 2612d3919c | |||
| 6f123a236f | |||
| 71e57e6a08 | |||
| 7cb18d8186 | |||
| cdbf670ece | |||
| e0dafee617 | |||
| c37bce1563 | |||
| 0b3c77d644 | |||
| 2cf85caf86 | |||
| 594010ba88 | |||
| d91460d2e2 | |||
| 89713e6ac9 | |||
| 17c9b2538c | |||
| d337b003cb | |||
| 8f1485656b | |||
| f0c4ec3031 | |||
| 458be84aca | |||
| c7716aad34 | |||
| 4a3e734408 | |||
| 54cc212753 | |||
| f4ae1eaa51 | |||
| d2537282c9 | |||
| 87527688c3 | |||
| 2be0b6505a | |||
| 672f100c7c | |||
| 5af402c0c5 | |||
| 693a4f0f63 | |||
| f8d2426ff6 | |||
| 973a9bedcd | |||
| a583733400 | |||
| 78eb51b3ca | |||
| a2606be9d8 | |||
| a4975c72ce | |||
| 58f96822a4 | |||
| 96b0d94986 | |||
| 70b38db8c5 | |||
| b6a9c2d3a0 | |||
| a01df6c7db | |||
| 4455bee570 | |||
| cd0adef2ed | |||
| 4aa24a65fb | |||
| 760dca8772 | |||
| 8269673619 | |||
| 82ec586554 | |||
| ca98cc8708 | |||
| f07800985d | |||
| b042df93b7 | |||
| ecf4441946 | |||
| 39b2612840 | |||
| 218f486e6b | |||
| cfcc25f175 | |||
| 155e88223c | |||
| 05039ece51 | |||
| 1c673f2b46 | |||
| 2232a70228 | |||
| e661b1d817 | |||
| 5a6a65f580 | |||
| 5cdd3bcd30 | |||
| 1233a885b8 | |||
| adf56cd768 | |||
| cd4b208be9 | |||
| 502de1a5d0 | |||
| 4158f869a3 | |||
| ff569d339c | |||
| 10eec323dd | |||
| 0a3db51c7d | |||
| 229aee0b30 | |||
| 44714aa981 | |||
| 2b6138a889 | |||
| 5e424f7bf4 | |||
| 294e47deed | |||
| dc42547b73 | |||
| 7ef7f0706b | |||
| a59b98a7c9 | |||
| 088fee9a4d | |||
| d8666acfe8 | |||
| 209e9c2866 | |||
| 6c3195dea4 | |||
| 7d774a7433 | |||
| f1ec4433cf | |||
| 1f825db261 | |||
| 1019f24f1d | |||
| f5c5b99579 | |||
| e002d19f1b | |||
| 0d5c9651f0 | |||
| 53fc13b95c | |||
| 694c3b0ddc | |||
| 9b3d4577cc | |||
| 77783915dd | |||
| b67ac21a79 | |||
| 603afed2f2 | |||
| c2a7c34496 | |||
| edd40f48ba | |||
| cca3d6b8b9 | |||
| f004512903 | |||
| 6407bb6730 | |||
| b914eeadec | |||
| dcadc6783e | |||
| bc9f43634f | |||
| 4778f0164c | |||
| 9904754a07 | |||
| 1b79077c9e | |||
| c13afb05b3 | |||
| 03e320efb8 | |||
| 7846332476 | |||
| 2d5d3b86e0 | |||
| 7c9ba890af | |||
| 0d609daffa | |||
| c12e56d402 | |||
| c7b38c07d5 | |||
| dc51066cea | |||
| 59d2fb3010 | |||
| a0fe702c10 | |||
| f886f7e366 | |||
| 1d475d88ed | |||
| e64c901912 | |||
| 5fce02e623 | |||
| 13997bc543 | |||
| 3e05b0d6f9 | |||
| 966417f867 | |||
| 601a0d1b91 |
Vendored
+53
-1
@@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
// 使用 IntelliSense 了解相关属性。
|
||||||
|
// 悬停以查看现有属性的描述。
|
||||||
|
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
@@ -7,12 +10,61 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"mainClass": "${file}"
|
"mainClass": "${file}"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "StringCase",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "cn.qaiu.vx.core.util.StringCase",
|
||||||
|
"projectName": "core"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "FCURLParser",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "cn.qaiu.parser.FCURLParser",
|
||||||
|
"projectName": "parser"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "QkTool",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "cn.qaiu.parser.impl.QkTool",
|
||||||
|
"projectName": "parser"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "WebClientExample",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "qaiu.web.test.WebClientExample",
|
||||||
|
"projectName": "parser"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "java",
|
"type": "java",
|
||||||
"name": "AppMain",
|
"name": "AppMain",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"mainClass": "cn.qaiu.lz.AppMain",
|
"mainClass": "cn.qaiu.lz.AppMain",
|
||||||
"projectName": "web-service"
|
"projectName": "web-service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "TestJs",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "cn.qaiu.web.test.TestJs",
|
||||||
|
"projectName": "web-service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "TestOS",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "cn.qaiu.web.test.TestOS",
|
||||||
|
"projectName": "web-service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "WebProxyExamples",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "cn.qaiu.web.test.WebProxyExamples",
|
||||||
|
"projectName": "web-service"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# netdisk-fast-download 网盘分享链接云解析服务
|
# netdisk-fast-download 网盘分享链接云解析服务
|
||||||
QQ交流群:1017480890
|
QQ群:1017480890
|
||||||
|
|
||||||
netdisk-fast-download网盘直链云解析(nfd云解析)能把网盘分享下载链接转化为直链,支持多款云盘,已支持蓝奏云/蓝奏云优享/奶牛快传/移动云云空间/小飞机盘/亿方云/123云盘/Cloudreve等,支持加密分享,以及部分网盘文件夹分享。
|
netdisk-fast-download网盘直链云解析(nfd云解析)能把网盘分享下载链接转化为直链,支持多款云盘,已支持蓝奏云/蓝奏云优享/奶牛快传/移动云云空间/小飞机盘/亿方云/123云盘/Cloudreve等,支持加密分享,以及部分网盘文件夹分享。
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ https://nfd-parser.github.io/nfd-preview/preview.html?src=https%3A%2F%2Flz.qaiu.
|
|||||||
## 预览地址
|
## 预览地址
|
||||||
[预览地址1](https://lz.qaiu.top)
|
[预览地址1](https://lz.qaiu.top)
|
||||||
[预览地址2](https://lz0.qaiu.top)
|
[预览地址2](https://lz0.qaiu.top)
|
||||||
[天翼云盘/移动云盘限时体验版](https://189.qaiu.top)
|
[移动/联通/天翼云盘大文件试用版](https://189.qaiu.top)
|
||||||
|
|
||||||
main分支依赖JDK17, 提供了JDK11分支[main-jdk11](https://github.com/qaiu/netdisk-fast-download/tree/main-jdk11)
|
main分支依赖JDK17, 提供了JDK11分支[main-jdk11](https://github.com/qaiu/netdisk-fast-download/tree/main-jdk11)
|
||||||
**0.1.8及以上版本json接口格式有调整 参考json返回数据格式示例**
|
**0.1.8及以上版本json接口格式有调整 参考json返回数据格式示例**
|
||||||
@@ -94,8 +94,6 @@ main分支依赖JDK17, 提供了JDK11分支[main-jdk11](https://github.com/qaiu/
|
|||||||
- [天翼云盘-p189](https://cloud.189.cn/)
|
- [天翼云盘-p189](https://cloud.189.cn/)
|
||||||
|
|
||||||
## API接口
|
## API接口
|
||||||
|
|
||||||
[api接口文档](https://nfdparser.apifox.cn/)
|
|
||||||
|
|
||||||
### 服务端口
|
### 服务端口
|
||||||
- **6400**: API 服务端口(建议使用 Nginx 代理)
|
- **6400**: API 服务端口(建议使用 Nginx 代理)
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public enum PanDomainTemplate {
|
|||||||
"lanzoug|" +
|
"lanzoug|" +
|
||||||
"lanzoum" +
|
"lanzoum" +
|
||||||
")\\.com/(.+/)?(?<KEY>.+)"),
|
")\\.com/(.+/)?(?<KEY>.+)"),
|
||||||
"https://w1.lanzn.com/{shareKey}",
|
"https://lanzoux.com/{shareKey}",
|
||||||
LzTool.class),
|
LzTool.class),
|
||||||
|
|
||||||
// https://www.feijix.com/s/
|
// https://www.feijix.com/s/
|
||||||
|
|||||||
@@ -4,15 +4,13 @@ import cn.qaiu.entity.FileInfo;
|
|||||||
import cn.qaiu.entity.ShareLinkInfo;
|
import cn.qaiu.entity.ShareLinkInfo;
|
||||||
import cn.qaiu.parser.PanBase;
|
import cn.qaiu.parser.PanBase;
|
||||||
import cn.qaiu.util.AESUtils;
|
import cn.qaiu.util.AESUtils;
|
||||||
import cn.qaiu.util.AcwScV2Generator;
|
|
||||||
import cn.qaiu.util.FileSizeConverter;
|
import cn.qaiu.util.FileSizeConverter;
|
||||||
import io.netty.handler.codec.http.cookie.DefaultCookie;
|
import cn.qaiu.util.UUIDUtil;
|
||||||
import io.vertx.core.Future;
|
import io.vertx.core.Future;
|
||||||
import io.vertx.core.MultiMap;
|
import io.vertx.core.MultiMap;
|
||||||
import io.vertx.core.Promise;
|
import io.vertx.core.Promise;
|
||||||
import io.vertx.core.json.JsonArray;
|
import io.vertx.core.json.JsonArray;
|
||||||
import io.vertx.core.json.JsonObject;
|
import io.vertx.core.json.JsonObject;
|
||||||
import io.vertx.ext.web.client.WebClientSession;
|
|
||||||
import io.vertx.uritemplate.UriTemplate;
|
import io.vertx.uritemplate.UriTemplate;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -20,12 +18,10 @@ import java.util.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 蓝奏云优享
|
* 蓝奏云优享
|
||||||
* v019b22
|
*
|
||||||
*/
|
*/
|
||||||
public class IzTool extends PanBase {
|
public class IzTool extends PanBase {
|
||||||
|
|
||||||
WebClientSession webClientSession = WebClientSession.create(clientNoRedirects);
|
|
||||||
|
|
||||||
private static final String API_URL_PREFIX = "https://api.ilanzou.com/unproved/";
|
private static final String API_URL_PREFIX = "https://api.ilanzou.com/unproved/";
|
||||||
|
|
||||||
private static final String FIRST_REQUEST_URL = API_URL_PREFIX + "recommend/list?devType=6&devModel=Chrome" +
|
private static final String FIRST_REQUEST_URL = API_URL_PREFIX + "recommend/list?devType=6&devModel=Chrome" +
|
||||||
@@ -74,19 +70,6 @@ public class IzTool extends PanBase {
|
|||||||
super(shareLinkInfo);
|
super(shareLinkInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCookie(String html) {
|
|
||||||
int beginIndex = html.indexOf("arg1='") + 6;
|
|
||||||
String arg1 = html.substring(beginIndex, html.indexOf("';", beginIndex));
|
|
||||||
String acw_sc__v2 = AcwScV2Generator.acwScV2Simple(arg1);
|
|
||||||
// 创建一个 Cookie 并放入 CookieStore
|
|
||||||
DefaultCookie nettyCookie = new DefaultCookie("acw_sc__v2", acw_sc__v2);
|
|
||||||
nettyCookie.setDomain(".ilanzou.com"); // 设置域名
|
|
||||||
nettyCookie.setPath("/"); // 设置路径
|
|
||||||
nettyCookie.setSecure(false);
|
|
||||||
nettyCookie.setHttpOnly(false);
|
|
||||||
webClientSession.cookieStore().put(nettyCookie);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Future<String> parse() {
|
public Future<String> parse() {
|
||||||
String shareId = shareLinkInfo.getShareKey();
|
String shareId = shareLinkInfo.getShareKey();
|
||||||
|
|
||||||
@@ -97,100 +80,70 @@ public class IzTool extends PanBase {
|
|||||||
// POST https://api.ilanzou.com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
|
// POST https://api.ilanzou.com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
|
||||||
String url = StringUtils.isBlank(shareLinkInfo.getSharePassword()) ? FIRST_REQUEST_URL
|
String url = StringUtils.isBlank(shareLinkInfo.getSharePassword()) ? FIRST_REQUEST_URL
|
||||||
: (FIRST_REQUEST_URL + "&code=" + shareLinkInfo.getSharePassword());
|
: (FIRST_REQUEST_URL + "&code=" + shareLinkInfo.getSharePassword());
|
||||||
webClientSession.postAbs(UriTemplate.of(VIP_REQUEST_URL))
|
client.postAbs(UriTemplate.of(VIP_REQUEST_URL))
|
||||||
.setTemplateParam("uuid", uuid)
|
.setTemplateParam("uuid", uuid)
|
||||||
.setTemplateParam("ts", tsEncode)
|
.setTemplateParam("ts", tsEncode)
|
||||||
.send().onSuccess(r0 -> { // 忽略res
|
.send().onSuccess(r0 -> { // 忽略res
|
||||||
// 第一次请求 获取文件信息
|
// 第一次请求 获取文件信息
|
||||||
// POST https://api.feijipan.com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
|
// POST https://api.feijipan.com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
|
||||||
webClientSession.postAbs(UriTemplate.of(url))
|
client.postAbs(UriTemplate.of(url))
|
||||||
.putHeaders(header)
|
.putHeaders(header)
|
||||||
.setTemplateParam("shareId", shareId)
|
.setTemplateParam("shareId", shareId)
|
||||||
.setTemplateParam("uuid", uuid)
|
.setTemplateParam("uuid", uuid)
|
||||||
.setTemplateParam("ts", tsEncode)
|
.setTemplateParam("ts", tsEncode)
|
||||||
.send().onSuccess(res -> {
|
.send().onSuccess(res -> {
|
||||||
String resBody = asText(res);
|
JsonObject resJson = asJson(res);
|
||||||
// 检查是否包含 cookie 验证
|
if (resJson.getInteger("code") != 200) {
|
||||||
if (resBody.contains("var arg1='")) {
|
fail(FIRST_REQUEST_URL + " 返回异常: " + resJson);
|
||||||
webClientSession = WebClientSession.create(clientNoRedirects);
|
|
||||||
setCookie(resBody);
|
|
||||||
// 重新请求
|
|
||||||
webClientSession.postAbs(UriTemplate.of(url))
|
|
||||||
.putHeaders(header)
|
|
||||||
.setTemplateParam("shareId", shareId)
|
|
||||||
.setTemplateParam("uuid", uuid)
|
|
||||||
.setTemplateParam("ts", tsEncode)
|
|
||||||
.send().onSuccess(res2 -> {
|
|
||||||
handleParseResponse(asText(res2), shareId);
|
|
||||||
}).onFailure(handleFail(FIRST_REQUEST_URL));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handleParseResponse(resBody, shareId);
|
if (resJson.getJsonArray("list").isEmpty()) {
|
||||||
|
fail(FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!resJson.containsKey("list") || resJson.getJsonArray("list").isEmpty()) {
|
||||||
|
fail(FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 文件Id
|
||||||
|
JsonObject fileInfo = resJson.getJsonArray("list").getJsonObject(0);
|
||||||
|
// 如果是目录返回目录ID
|
||||||
|
if (!fileInfo.containsKey("fileList") || fileInfo.getJsonArray("fileList").isEmpty()) {
|
||||||
|
fail(FIRST_REQUEST_URL + " 文件列表为空: " + fileInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JsonObject fileList = fileInfo.getJsonArray("fileList").getJsonObject(0);
|
||||||
|
if (fileList.getInteger("fileType") == 2) {
|
||||||
|
promise.complete(fileList.getInteger("folderId").toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String fileId = fileInfo.getString("fileIds");
|
||||||
|
String userId = fileInfo.getString("userId");
|
||||||
|
// 其他参数
|
||||||
|
// String fidEncode = AESUtils.encrypt2HexIz(fileId + "|");
|
||||||
|
String fidEncode = AESUtils.encrypt2HexIz(fileId + "|" + userId);
|
||||||
|
String auth = AESUtils.encrypt2HexIz(fileId + "|" + nowTs);
|
||||||
|
// 第二次请求
|
||||||
|
clientNoRedirects.getAbs(UriTemplate.of(SECOND_REQUEST_URL))
|
||||||
|
.setTemplateParam("fidEncode", fidEncode)
|
||||||
|
.setTemplateParam("uuid", uuid)
|
||||||
|
.setTemplateParam("ts", tsEncode)
|
||||||
|
.setTemplateParam("auth", auth)
|
||||||
|
.setTemplateParam("shareId", shareId)
|
||||||
|
.putHeaders(header).send().onSuccess(res2 -> {
|
||||||
|
MultiMap headers = res2.headers();
|
||||||
|
if (!headers.contains("Location")) {
|
||||||
|
fail(SECOND_REQUEST_URL + " 未找到重定向URL: \n" + headers);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
promise.complete(headers.get("Location"));
|
||||||
|
}).onFailure(handleFail(SECOND_REQUEST_URL));
|
||||||
}).onFailure(handleFail(FIRST_REQUEST_URL));
|
}).onFailure(handleFail(FIRST_REQUEST_URL));
|
||||||
});
|
});
|
||||||
return promise.future();
|
return promise.future();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleParseResponse(String resBody, String shareId) {
|
|
||||||
JsonObject resJson;
|
|
||||||
try {
|
|
||||||
resJson = new JsonObject(resBody);
|
|
||||||
} catch (Exception e) {
|
|
||||||
fail(FIRST_REQUEST_URL + " 解析JSON失败: " + resBody);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (resJson.isEmpty()) {
|
|
||||||
fail(FIRST_REQUEST_URL + " 返回内容为空");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (resJson.getInteger("code") != 200) {
|
|
||||||
fail(FIRST_REQUEST_URL + " 返回异常: " + resJson);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (resJson.getJsonArray("list").isEmpty()) {
|
|
||||||
fail(FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!resJson.containsKey("list") || resJson.getJsonArray("list").isEmpty()) {
|
|
||||||
fail(FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 文件Id
|
|
||||||
JsonObject fileInfo = resJson.getJsonArray("list").getJsonObject(0);
|
|
||||||
// 如果是目录返回目录ID
|
|
||||||
if (!fileInfo.containsKey("fileList") || fileInfo.getJsonArray("fileList").isEmpty()) {
|
|
||||||
fail(FIRST_REQUEST_URL + " 文件列表为空: " + fileInfo);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JsonObject fileList = fileInfo.getJsonArray("fileList").getJsonObject(0);
|
|
||||||
if (fileList.getInteger("fileType") == 2) {
|
|
||||||
promise.complete(fileList.getInteger("folderId").toString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String fileId = fileInfo.getString("fileIds");
|
|
||||||
String userId = fileInfo.getString("userId");
|
|
||||||
// 其他参数
|
|
||||||
// String fidEncode = AESUtils.encrypt2HexIz(fileId + "|");
|
|
||||||
String fidEncode = AESUtils.encrypt2HexIz(fileId + "|" + userId);
|
|
||||||
String auth = AESUtils.encrypt2HexIz(fileId + "|" + nowTs);
|
|
||||||
// 第二次请求
|
|
||||||
webClientSession.getAbs(UriTemplate.of(SECOND_REQUEST_URL))
|
|
||||||
.setTemplateParam("fidEncode", fidEncode)
|
|
||||||
.setTemplateParam("uuid", uuid)
|
|
||||||
.setTemplateParam("ts", tsEncode)
|
|
||||||
.setTemplateParam("auth", auth)
|
|
||||||
.setTemplateParam("shareId", shareId)
|
|
||||||
.putHeaders(header).send().onSuccess(res2 -> {
|
|
||||||
MultiMap headers = res2.headers();
|
|
||||||
if (!headers.contains("Location")) {
|
|
||||||
fail(SECOND_REQUEST_URL + " 未找到重定向URL: \n" + headers);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
promise.complete(headers.get("Location"));
|
|
||||||
}).onFailure(handleFail(SECOND_REQUEST_URL));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Future<List<FileInfo>> parseFileList() {
|
public Future<List<FileInfo>> parseFileList() {
|
||||||
Promise<List<FileInfo>> promise = Promise.promise();
|
Promise<List<FileInfo>> promise = Promise.promise();
|
||||||
@@ -221,7 +174,7 @@ public class IzTool extends PanBase {
|
|||||||
log.debug("开始解析目录: {}, shareId: {}, uuid: {}, ts: {}", id, shareId, uuid, tsEncode);
|
log.debug("开始解析目录: {}, shareId: {}, uuid: {}, ts: {}", id, shareId, uuid, tsEncode);
|
||||||
// 开始解析目录: 164312216, shareId: bPMsbg5K, uuid: 0fmVWTx2Ea4zFwkpd7KXf, ts: 20865d7b7f00828279f437cd1f097860
|
// 开始解析目录: 164312216, shareId: bPMsbg5K, uuid: 0fmVWTx2Ea4zFwkpd7KXf, ts: 20865d7b7f00828279f437cd1f097860
|
||||||
// 拿到目录ID
|
// 拿到目录ID
|
||||||
webClientSession.postAbs(UriTemplate.of(FILE_LIST_URL))
|
client.postAbs(UriTemplate.of(FILE_LIST_URL))
|
||||||
.putHeaders(header)
|
.putHeaders(header)
|
||||||
.setTemplateParam("shareId", shareId)
|
.setTemplateParam("shareId", shareId)
|
||||||
.setTemplateParam("uuid", uuid)
|
.setTemplateParam("uuid", uuid)
|
||||||
@@ -311,7 +264,7 @@ public class IzTool extends PanBase {
|
|||||||
public Future<String> parseById() {
|
public Future<String> parseById() {
|
||||||
// 第二次请求
|
// 第二次请求
|
||||||
JsonObject paramJson = (JsonObject)shareLinkInfo.getOtherParam().get("paramJson");
|
JsonObject paramJson = (JsonObject)shareLinkInfo.getOtherParam().get("paramJson");
|
||||||
webClientSession.getAbs(UriTemplate.of(SECOND_REQUEST_URL))
|
clientNoRedirects.getAbs(UriTemplate.of(SECOND_REQUEST_URL))
|
||||||
.setTemplateParam("fidEncode", paramJson.getString("fidEncode"))
|
.setTemplateParam("fidEncode", paramJson.getString("fidEncode"))
|
||||||
.setTemplateParam("uuid", paramJson.getString("uuid"))
|
.setTemplateParam("uuid", paramJson.getString("uuid"))
|
||||||
.setTemplateParam("ts", paramJson.getString("ts"))
|
.setTemplateParam("ts", paramJson.getString("ts"))
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import io.vertx.core.Promise;
|
|||||||
import io.vertx.core.json.JsonArray;
|
import io.vertx.core.json.JsonArray;
|
||||||
import io.vertx.core.json.JsonObject;
|
import io.vertx.core.json.JsonObject;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -204,21 +202,12 @@ public class LeTool extends PanBase {
|
|||||||
fileInfo.setFileType("folder");
|
fileInfo.setFileType("folder");
|
||||||
fileInfo.setSize(0L);
|
fileInfo.setSize(0L);
|
||||||
fileInfo.setSizeStr("0B");
|
fileInfo.setSizeStr("0B");
|
||||||
// 设置目录解析的URL - fileId 需要进行 URL 编码以保持特殊字符的编码状态
|
// 设置目录解析的URL - 注意:从API返回的fileId已经是URL编码的,直接使用
|
||||||
try {
|
// 不需要再次编码,避免双重编码导致解析失败
|
||||||
String encodedFileId = URLEncoder.encode(fileId, "UTF-8");
|
fileInfo.setParserUrl(String.format("%s/v2/getFileList?url=%s&dirId=%s",
|
||||||
fileInfo.setParserUrl(String.format("%s/v2/getFileList?url=%s&dirId=%s",
|
getDomainName(),
|
||||||
getDomainName(),
|
shareLinkInfo.getShareUrl(),
|
||||||
shareLinkInfo.getShareUrl(),
|
fileId));
|
||||||
encodedFileId));
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
log.error("URL编码失败: {}", e.getMessage());
|
|
||||||
// 降级方案:直接使用原始 fileId
|
|
||||||
fileInfo.setParserUrl(String.format("%s/v2/getFileList?url=%s&dirId=%s",
|
|
||||||
getDomainName(),
|
|
||||||
shareLinkInfo.getShareUrl(),
|
|
||||||
fileId));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// 文件类型
|
// 文件类型
|
||||||
fileInfo.setFileType(fileType != null ? String.valueOf(fileType) : DEFAULT_FILE_TYPE);
|
fileInfo.setFileType(fileType != null ? String.valueOf(fileType) : DEFAULT_FILE_TYPE);
|
||||||
|
|||||||
@@ -11,12 +11,14 @@ import io.vertx.core.Promise;
|
|||||||
import io.vertx.core.json.JsonObject;
|
import io.vertx.core.json.JsonObject;
|
||||||
import io.vertx.ext.web.client.WebClient;
|
import io.vertx.ext.web.client.WebClient;
|
||||||
import io.vertx.ext.web.client.WebClientSession;
|
import io.vertx.ext.web.client.WebClientSession;
|
||||||
|
import org.apache.commons.lang3.RegExUtils;
|
||||||
import org.openjdk.nashorn.api.scripting.ScriptObjectMirror;
|
import org.openjdk.nashorn.api.scripting.ScriptObjectMirror;
|
||||||
|
|
||||||
import javax.script.ScriptException;
|
import javax.script.ScriptException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@@ -27,14 +29,13 @@ import java.util.regex.Pattern;
|
|||||||
*/
|
*/
|
||||||
public class LzTool extends PanBase {
|
public class LzTool extends PanBase {
|
||||||
|
|
||||||
WebClientSession webClientSession = WebClientSession.create(clientNoRedirects);
|
public static final String SHARE_URL_PREFIX = "https://wwwwp.lanzoup.com";
|
||||||
|
|
||||||
public static final String SHARE_URL_PREFIX = "https://w1.lanzn.com/";
|
|
||||||
MultiMap headers0 = HeaderUtils.parseHeaders("""
|
MultiMap headers0 = HeaderUtils.parseHeaders("""
|
||||||
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: 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
|
Accept-Encoding: gzip, deflate
|
||||||
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
|
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
|
||||||
Cache-Control: max-age=0
|
Cache-Control: max-age=0
|
||||||
|
Cookie: codelen=1; pc_ad1=1
|
||||||
DNT: 1
|
DNT: 1
|
||||||
Priority: u=0, i
|
Priority: u=0, i
|
||||||
Sec-CH-UA: "Chromium";v="140", "Not=A?Brand";v="24", "Microsoft Edge";v="140"
|
Sec-CH-UA: "Chromium";v="140", "Not=A?Brand";v="24", "Microsoft Edge";v="140"
|
||||||
@@ -62,100 +63,53 @@ public class LzTool extends PanBase {
|
|||||||
.putHeaders(headers0)
|
.putHeaders(headers0)
|
||||||
.send().onSuccess(res -> {
|
.send().onSuccess(res -> {
|
||||||
String html = asText(res);
|
String html = asText(res);
|
||||||
if (html.contains("var arg1='")) {
|
try {
|
||||||
webClientSession = WebClientSession.create(clientNoRedirects);
|
setFileInfo(html, shareLinkInfo);
|
||||||
setCookie(html);
|
} catch (Exception e) {
|
||||||
webClientSession.getAbs(sUrl)
|
e.printStackTrace();
|
||||||
.putHeaders(headers0)
|
|
||||||
.send().onSuccess(res2 -> {
|
|
||||||
String html2 = asText(res2);
|
|
||||||
doParser(html2, pwd, sUrl);
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
doParser(html, pwd, sUrl);
|
|
||||||
}
|
}
|
||||||
|
// 匹配iframe
|
||||||
|
Pattern compile = Pattern.compile("src=\"(/fn\\?[a-zA-Z\\d_+/=]{16,})\"");
|
||||||
|
Matcher matcher = compile.matcher(html);
|
||||||
|
// 没有Iframe说明是加密分享, 匹配sign通过密码请求下载页面
|
||||||
|
if (!matcher.find()) {
|
||||||
|
try {
|
||||||
|
String jsText = getJsByPwd(pwd, html, "document.getElementById('rpt')");
|
||||||
|
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText, "down_p");
|
||||||
|
getDownURL(sUrl, client, scriptObjectMirror);
|
||||||
|
} catch (Exception e) {
|
||||||
|
fail(e, "js引擎执行失败");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 没有密码
|
||||||
|
String iframePath = matcher.group(1);
|
||||||
|
client.getAbs(SHARE_URL_PREFIX + iframePath).send().onSuccess(res2 -> {
|
||||||
|
String html2 = res2.bodyAsString();
|
||||||
|
|
||||||
|
// 去TMD正则
|
||||||
|
// Matcher matcher2 = Pattern.compile("'sign'\s*:\s*'(\\w+)'").matcher(html2);
|
||||||
|
String jsText = getJsText(html2);
|
||||||
|
if (jsText == null) {
|
||||||
|
fail(SHARE_URL_PREFIX + iframePath + " -> " + sUrl + ": js脚本匹配失败, 可能分享已失效");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText, null);
|
||||||
|
getDownURL(sUrl, client, scriptObjectMirror);
|
||||||
|
} catch (ScriptException | NoSuchMethodException e) {
|
||||||
|
fail(e, "js引擎执行失败");
|
||||||
|
}
|
||||||
|
}).onFailure(handleFail(SHARE_URL_PREFIX));
|
||||||
|
}
|
||||||
}).onFailure(handleFail(sUrl));
|
}).onFailure(handleFail(sUrl));
|
||||||
return promise.future();
|
return promise.future();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doParser(String html, String pwd, String sUrl) {
|
|
||||||
try {
|
|
||||||
setFileInfo(html, shareLinkInfo);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
// 匹配iframe
|
|
||||||
Pattern compile = Pattern.compile("src=\"(/fn\\?[a-zA-Z\\d_+/=]{16,})\"");
|
|
||||||
Matcher matcher = compile.matcher(html);
|
|
||||||
// 没有Iframe说明是加密分享, 匹配sign通过密码请求下载页面
|
|
||||||
if (!matcher.find()) {
|
|
||||||
try {
|
|
||||||
String jsText = getJsByPwd(pwd, html, "document.getElementById('rpt')");
|
|
||||||
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText, "down_p");
|
|
||||||
getDownURL(sUrl, scriptObjectMirror);
|
|
||||||
} catch (Exception e) {
|
|
||||||
fail(e, "js引擎执行失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// 没有密码
|
|
||||||
String iframePath = matcher.group(1);
|
|
||||||
String absoluteURI = SHARE_URL_PREFIX + iframePath;
|
|
||||||
webClientSession.getAbs(absoluteURI).putHeaders(headers0).send().onSuccess(res2 -> {
|
|
||||||
String html2= asText(res2);
|
|
||||||
// Matcher matcher2 = Pattern.compile("'sign'\s*:\s*'(\\w+)'").matcher(html2);
|
|
||||||
String jsText = getJsText(html2);
|
|
||||||
if (jsText == null) {
|
|
||||||
headers0.add("Referer", absoluteURI);
|
|
||||||
setCookie(html2);
|
|
||||||
webClientSession.getAbs(absoluteURI).send().onSuccess(res3 -> {
|
|
||||||
String html3= asText(res3);
|
|
||||||
String jsText3 = getJsText(html3);
|
|
||||||
if (jsText3 != null) {
|
|
||||||
try {
|
|
||||||
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText3, null);
|
|
||||||
getDownURL(sUrl, scriptObjectMirror);
|
|
||||||
} catch (ScriptException | NoSuchMethodException e) {
|
|
||||||
fail(e, "引擎执行失败");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
fail(SHARE_URL_PREFIX + iframePath + " -> " + sUrl + ": 获取失败0, 可能分享已失效");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText, null);
|
|
||||||
getDownURL(sUrl, scriptObjectMirror);
|
|
||||||
} catch (ScriptException | NoSuchMethodException e) {
|
|
||||||
fail(e, "js引擎执行失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).onFailure(handleFail(SHARE_URL_PREFIX));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setCookie(String html2) {
|
|
||||||
int beginIndex = html2.indexOf("arg1='") + 6;
|
|
||||||
String arg1 = html2.substring(beginIndex, html2.indexOf("';", beginIndex));
|
|
||||||
String acw_sc__v2 = AcwScV2Generator.acwScV2Simple(arg1);
|
|
||||||
// 创建一个 Cookie 并放入 CookieStore
|
|
||||||
DefaultCookie nettyCookie = new DefaultCookie("acw_sc__v2", acw_sc__v2);
|
|
||||||
nettyCookie.setDomain(".lanzn.com"); // 设置域名
|
|
||||||
nettyCookie.setPath("/"); // 设置路径
|
|
||||||
nettyCookie.setSecure(false);
|
|
||||||
nettyCookie.setHttpOnly(false);
|
|
||||||
webClientSession.cookieStore().put(nettyCookie);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getJsByPwd(String pwd, String html, String subText) {
|
private String getJsByPwd(String pwd, String html, String subText) {
|
||||||
String jsText = getJsText(html);
|
String jsText = getJsText(html);
|
||||||
|
|
||||||
if (jsText == null) {
|
if (jsText == null) {
|
||||||
throw new RuntimeException("获取失败1, 可能分享已失效");
|
throw new RuntimeException("js脚本匹配失败, 可能分享已失效");
|
||||||
}
|
}
|
||||||
jsText = jsText.replace("document.getElementById('pwd').value", "\"" + pwd + "\"");
|
jsText = jsText.replace("document.getElementById('pwd').value", "\"" + pwd + "\"");
|
||||||
int i = jsText.indexOf(subText);
|
int i = jsText.indexOf(subText);
|
||||||
@@ -177,7 +131,7 @@ public class LzTool extends PanBase {
|
|||||||
return html.substring(startPos, endPos).replaceAll("<!--.*-->", "");
|
return html.substring(startPos, endPos).replaceAll("<!--.*-->", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getDownURL(String key, Map<String, ?> obj) {
|
private void getDownURL(String key, WebClient client, Map<String, ?> obj) {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
fail("需要访问密码");
|
fail("需要访问密码");
|
||||||
return;
|
return;
|
||||||
@@ -209,7 +163,7 @@ public class LzTool extends PanBase {
|
|||||||
headers.set("referer", key);
|
headers.set("referer", key);
|
||||||
// action=downprocess&signs=%3Fctdf&websignkey=I5gl&sign=BWMGOF1sBTRWXwI9BjZdYVA7BDhfNAIyUG9UawJtUGMIPlAhACkCa1UyUTAAYFxvUj5XY1E7UGFXaFVq&websign=&kd=1&ves=1
|
// action=downprocess&signs=%3Fctdf&websignkey=I5gl&sign=BWMGOF1sBTRWXwI9BjZdYVA7BDhfNAIyUG9UawJtUGMIPlAhACkCa1UyUTAAYFxvUj5XY1E7UGFXaFVq&websign=&kd=1&ves=1
|
||||||
String url = SHARE_URL_PREFIX + url0;
|
String url = SHARE_URL_PREFIX + url0;
|
||||||
webClientSession.postAbs(url).putHeaders(headers).sendForm(map).onSuccess(res2 -> {
|
client.postAbs(url).putHeaders(headers).sendForm(map).onSuccess(res2 -> {
|
||||||
try {
|
try {
|
||||||
JsonObject urlJson = asJson(res2);
|
JsonObject urlJson = asJson(res2);
|
||||||
String name = urlJson.getString("inf");
|
String name = urlJson.getString("inf");
|
||||||
@@ -224,6 +178,7 @@ public class LzTool extends PanBase {
|
|||||||
|
|
||||||
String downUrl = urlJson.getString("dom") + "/file/" + urlJson.getString("url");
|
String downUrl = urlJson.getString("dom") + "/file/" + urlJson.getString("url");
|
||||||
headers.remove("Referer");
|
headers.remove("Referer");
|
||||||
|
WebClientSession webClientSession = WebClientSession.create(client);
|
||||||
webClientSession.getAbs(downUrl).putHeaders(headers).send()
|
webClientSession.getAbs(downUrl).putHeaders(headers).send()
|
||||||
.onSuccess(res3 -> {
|
.onSuccess(res3 -> {
|
||||||
String location = res3.headers().get("Location");
|
String location = res3.headers().get("Location");
|
||||||
@@ -240,13 +195,12 @@ public class LzTool extends PanBase {
|
|||||||
nettyCookie.setPath("/"); // 设置路径
|
nettyCookie.setPath("/"); // 设置路径
|
||||||
nettyCookie.setSecure(false);
|
nettyCookie.setSecure(false);
|
||||||
nettyCookie.setHttpOnly(false);
|
nettyCookie.setHttpOnly(false);
|
||||||
WebClientSession webClientSession2 = WebClientSession.create(clientNoRedirects);
|
webClientSession.cookieStore().put(nettyCookie);
|
||||||
webClientSession2.cookieStore().put(nettyCookie);
|
webClientSession.getAbs(downUrl).putHeaders(headers).send()
|
||||||
webClientSession2.getAbs(downUrl).putHeaders(headers).send()
|
|
||||||
.onSuccess(res4 -> {
|
.onSuccess(res4 -> {
|
||||||
String location0 = res4.headers().get("Location");
|
String location0 = res4.headers().get("Location");
|
||||||
if (location0 == null) {
|
if (location0 == null) {
|
||||||
fail(downUrl + " -> 直链获取失败2, 可能分享已失效");
|
fail(downUrl + " -> 直链获取失败, 可能分享已失效");
|
||||||
} else {
|
} else {
|
||||||
setDateAndComplate(location0);
|
setDateAndComplate(location0);
|
||||||
}
|
}
|
||||||
@@ -294,98 +248,67 @@ public class LzTool extends PanBase {
|
|||||||
String sUrl = shareLinkInfo.getShareUrl();
|
String sUrl = shareLinkInfo.getShareUrl();
|
||||||
String pwd = shareLinkInfo.getSharePassword();
|
String pwd = shareLinkInfo.getSharePassword();
|
||||||
|
|
||||||
webClientSession.getAbs(sUrl).send().onSuccess(res -> {
|
WebClient client = clientNoRedirects;
|
||||||
|
client.getAbs(sUrl).send().onSuccess(res -> {
|
||||||
String html = res.bodyAsString();
|
String html = res.bodyAsString();
|
||||||
// 检查是否需要 cookie 验证
|
try {
|
||||||
if (html.contains("var arg1='")) {
|
String jsText = getJsByPwd(pwd, html, "var urls =window.location.href");
|
||||||
webClientSession = WebClientSession.create(clientNoRedirects);
|
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText, "file");
|
||||||
setCookie(html);
|
Map<String, Object> data = CastUtil.cast(scriptObjectMirror.get("data"));
|
||||||
// 重新请求
|
MultiMap map = MultiMap.caseInsensitiveMultiMap();
|
||||||
webClientSession.getAbs(sUrl).send().onSuccess(res2 -> {
|
data.forEach((k, v) -> map.set(k, v.toString()));
|
||||||
handleFileListParse(res2.bodyAsString(), pwd, sUrl, promise);
|
log.debug("解析参数: {}", map);
|
||||||
}).onFailure(err -> promise.fail(err));
|
MultiMap headers = getHeaders(sUrl);
|
||||||
return;
|
|
||||||
|
String url = SHARE_URL_PREFIX + "/filemoreajax.php?file=" + data.get("fid");
|
||||||
|
client.postAbs(url).putHeaders(headers).sendForm(map).onSuccess(res2 -> {
|
||||||
|
JsonObject fileListJson = asJson(res2);
|
||||||
|
if (fileListJson.getInteger("zt") != 1) {
|
||||||
|
promise.fail(baseMsg() + fileListJson.getString("info"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<FileInfo> list = new ArrayList<>();
|
||||||
|
fileListJson.getJsonArray("text").forEach(item -> {
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"icon": "apk",
|
||||||
|
"t": 0,
|
||||||
|
"id": "iULV2n4361c",
|
||||||
|
"name_all": "xx.apk",
|
||||||
|
"size": "49.8 M",
|
||||||
|
"time": "2021-03-19",
|
||||||
|
"duan": "in4361",
|
||||||
|
"p_ico": 0
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
JsonObject fileJson = (JsonObject) item;
|
||||||
|
FileInfo fileInfo = new FileInfo();
|
||||||
|
String size = fileJson.getString("size");
|
||||||
|
Long sizeNum = FileSizeConverter.convertToBytes(size);
|
||||||
|
String panType = shareLinkInfo.getType();
|
||||||
|
String id = fileJson.getString("id");
|
||||||
|
fileInfo.setFileName(fileJson.getString("name_all"))
|
||||||
|
.setFileId(id)
|
||||||
|
.setCreateTime(fileJson.getString("time"))
|
||||||
|
.setFileType(fileJson.getString("icon"))
|
||||||
|
.setSizeStr(fileJson.getString("size"))
|
||||||
|
.setSize(sizeNum)
|
||||||
|
.setPanType(panType)
|
||||||
|
.setParserUrl(getDomainName() + "/d/" + panType + "/" + id)
|
||||||
|
.setPreviewUrl(String.format("%s/v2/view/%s/%s", getDomainName(),
|
||||||
|
shareLinkInfo.getType(), id));
|
||||||
|
log.debug("文件信息: {}", fileInfo);
|
||||||
|
list.add(fileInfo);
|
||||||
|
});
|
||||||
|
promise.complete(list);
|
||||||
|
});
|
||||||
|
} catch (ScriptException | NoSuchMethodException e) {
|
||||||
|
promise.fail(e);
|
||||||
}
|
}
|
||||||
handleFileListParse(html, pwd, sUrl, promise);
|
});
|
||||||
}).onFailure(err -> promise.fail(err));
|
|
||||||
return promise.future();
|
return promise.future();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleFileListParse(String html, String pwd, String sUrl, Promise<List<FileInfo>> promise) {
|
|
||||||
try {
|
|
||||||
String jsText = getJsByPwd(pwd, html, "var urls =window.location.href");
|
|
||||||
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText, "file");
|
|
||||||
Map<String, Object> data = CastUtil.cast(scriptObjectMirror.get("data"));
|
|
||||||
MultiMap map = MultiMap.caseInsensitiveMultiMap();
|
|
||||||
data.forEach((k, v) -> map.set(k, v.toString()));
|
|
||||||
log.debug("解析参数: {}", map);
|
|
||||||
MultiMap headers = getHeaders(sUrl);
|
|
||||||
|
|
||||||
String url = SHARE_URL_PREFIX + "/filemoreajax.php?file=" + data.get("fid");
|
|
||||||
webClientSession.postAbs(url).putHeaders(headers).sendForm(map).onSuccess(res2 -> {
|
|
||||||
String resBody = asText(res2);
|
|
||||||
// 再次检查是否需要 cookie 验证
|
|
||||||
if (resBody.contains("var arg1='")) {
|
|
||||||
setCookie(resBody);
|
|
||||||
// 重新请求
|
|
||||||
webClientSession.postAbs(url).putHeaders(headers).sendForm(map).onSuccess(res3 -> {
|
|
||||||
handleFileListResponse(asText(res3), promise);
|
|
||||||
}).onFailure(err -> promise.fail(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
handleFileListResponse(resBody, promise);
|
|
||||||
}).onFailure(err -> promise.fail(err));
|
|
||||||
} catch (ScriptException | NoSuchMethodException e) {
|
|
||||||
promise.fail(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleFileListResponse(String responseBody, Promise<List<FileInfo>> promise) {
|
|
||||||
try {
|
|
||||||
JsonObject fileListJson = new JsonObject(responseBody);
|
|
||||||
if (fileListJson.getInteger("zt") != 1) {
|
|
||||||
promise.fail(baseMsg() + fileListJson.getString("info"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<FileInfo> list = new ArrayList<>();
|
|
||||||
fileListJson.getJsonArray("text").forEach(item -> {
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
"icon": "apk",
|
|
||||||
"t": 0,
|
|
||||||
"id": "iULV2n4361c",
|
|
||||||
"name_all": "xx.apk",
|
|
||||||
"size": "49.8 M",
|
|
||||||
"time": "2021-03-19",
|
|
||||||
"duan": "in4361",
|
|
||||||
"p_ico": 0
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
JsonObject fileJson = (JsonObject) item;
|
|
||||||
FileInfo fileInfo = new FileInfo();
|
|
||||||
String size = fileJson.getString("size");
|
|
||||||
Long sizeNum = FileSizeConverter.convertToBytes(size);
|
|
||||||
String panType = shareLinkInfo.getType();
|
|
||||||
String id = fileJson.getString("id");
|
|
||||||
fileInfo.setFileName(fileJson.getString("name_all"))
|
|
||||||
.setFileId(id)
|
|
||||||
.setCreateTime(fileJson.getString("time"))
|
|
||||||
.setFileType(fileJson.getString("icon"))
|
|
||||||
.setSizeStr(fileJson.getString("size"))
|
|
||||||
.setSize(sizeNum)
|
|
||||||
.setPanType(panType)
|
|
||||||
.setParserUrl(getDomainName() + "/d/" + panType + "/" + id)
|
|
||||||
.setPreviewUrl(String.format("%s/v2/view/%s/%s", getDomainName(),
|
|
||||||
shareLinkInfo.getType(), id));
|
|
||||||
log.debug("文件信息: {}", fileInfo);
|
|
||||||
list.add(fileInfo);
|
|
||||||
});
|
|
||||||
promise.complete(list);
|
|
||||||
} catch (Exception e) {
|
|
||||||
promise.fail(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setFileInfo(String html, ShareLinkInfo shareLinkInfo) {
|
void setFileInfo(String html, ShareLinkInfo shareLinkInfo) {
|
||||||
// 写入 fileInfo
|
// 写入 fileInfo
|
||||||
FileInfo fileInfo = new FileInfo();
|
FileInfo fileInfo = new FileInfo();
|
||||||
|
|||||||
Reference in New Issue
Block a user