1. 项目重命名

2. 添加UC网盘解析
3. 添加移动云空间解析 #1
This commit is contained in:
QAIU
2023-05-24 16:20:06 +08:00
parent 455225e566
commit 7358931559
51 changed files with 526 additions and 349 deletions

2
.gitignore vendored
View File

@@ -37,4 +37,4 @@ sdkTest.log
gradlew
gradlew.bat
unused.txt
/lz-cow-api-web/src/main/generated/
/web-service/src/main/generated/

View File

@@ -1,8 +1,39 @@
# lz-cow-api
蓝奏云-奶牛快传的直链解析的API服务
使用Jdk17+Vert.x4.4.1+Jsoup
# netdisk-fast-download
# 网盘快速下载器--直链解析
## 网盘支持情况:
` 网盘名称(网盘标识): `
- 蓝奏云 (lz)
- [ ] 登录, 上传, 下载, 分享
- [x] 直链解析
- 奶牛快传 (cow)
- [ ] 登录, 上传, 下载, 分享
- [x] 直链解析
- 移动云空间 (ec)
- [ ] 登录, 上传, 下载, 分享
- [x] 直链解析
- UC网盘 (uc)
- [ ] 登录, 上传, 下载, 分享
- [x] 直链解析
- 夸克网盘 (qk)
- TODO
技术栈:
Jdk17+Vert.x4.4.1+Jsoup
Core模块集成Vert.x实现类spring的注解式路由API
API接口
```shell
(括号内表示可选内容)
1. 解析并自动302跳转 :
http(s)://you_host/parser?url=分享链接
http(s)://you_host/网盘标识/分享id(#分享密码)
2. 获取解析后的直链--JSON格式
http(s)://you_host/网盘标识/分享id(#分享密码)
```
示例:
```
// 解析并重定向到直链
@@ -13,7 +44,7 @@ GET http://127.0.0.1:6400/parser?url=https://lanzoux.com/ia2cntg
# @no-redirect
GET http://127.0.0.1:6400/parser?url=https://cowtransfer.com/s/9a644fe3e3a748
// Rest请求(只提供共享文件Id): cow 奶牛快传; lz 蓝奏云
// Rest请求(只提供共享文件Id):
###
# @no-redirect
GET http://127.0.0.1:6400/cow/9a644fe3e3a748
@@ -32,11 +63,11 @@ TODO:
# 网盘对比
| 网盘名称 | 可直接下载分享 | 加密分享 | 初始网盘空间 | 单文件大小限制 | 登录接口 |
|------|-------------|------|----------|----------------|------|
| 蓝奏云 | √ | √ | 不限空间 | 100M | |
| 奶牛快传 | √ | X | 10G | 不限大小 | |
| 夸克网盘 | X(>10M需要登录) | √ | 10G(20G) | 不限大小(>10M需要登录) | X |
| 天翼云盘 | | | | | |
| 阿里云盘 | | | | | |
| 网盘名称 | 可直接下载分享 | 加密分享 | 初始网盘空间 | 单文件大小限制 | 登录接口 |
|-------|-------------|----------|----------|----------------|------|
| 蓝奏云 | √ | √ | 不限空间 | 100M | TODO |
| 奶牛快传 | √ | X | 10G | 不限大小 | TODO |
| 移动云空间 | √ | √(密码可忽略) | 5G(个人) | 不限大小 | TODO |
| UC网盘 | √ | | 10G | 不限大小 | TODO |
| 夸克网盘 | √(>10M需要登录) | | 10G(20G) | 不限大小(>10M需要登录) | X |

View File

@@ -7,7 +7,7 @@ Wants=network-online.target
[Service]
Type=simple
# User=USER
ExecStart=/usr/bin/java -server -Xmx128m -jar /root/java/lz-cow-api-web/lz-cow-api-web-0.0.1.jar
ExecStart=/usr/bin/java -server -Xmx128m -jar /root/java/netdisk-fast-download/netdisk-fast-download-0.0.1.jar
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=always
StandOutput=syslog

View File

@@ -1,5 +1,5 @@
@echo off && @chcp 65001 > nul
pushd %~dp0
set LIB_DIR=%~dp0
for /f "delims=X" %%i in ('dir /b %LIB_DIR%\lz-cow-api-web-*.jar') do set LAUNCH_JAR=%LIB_DIR%\%%i
for /f "delims=X" %%i in ('dir /b %LIB_DIR%\netdisk-fast-download-*.jar') do set LAUNCH_JAR=%LIB_DIR%\%%i
"%JAVA_HOME%\bin\java.exe" -Xmx512M -Dfile.encoding=utf8 -jar %LAUNCH_JAR% %*

View File

@@ -1,5 +1,5 @@
#!/bin/sh
# set -x
LAUNCH_JAR="lz-cow-api-web-*.jar"
LAUNCH_JAR="netdisk-fast-download-*.jar"
nohup java -Xmx512M -jar "$LAUNCH_JAR" "$@" >startup.log 2>&1 &
tail -f startup.log

View File

@@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>lz-cow-api</artifactId>
<artifactId>netdisk-fast-download</artifactId>
<groupId>cn.qaiu</groupId>
<version>0.0.1</version>
<version>0.1.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>lz-cow-api</artifactId>
<artifactId>netdisk-fast-download</artifactId>
<groupId>cn.qaiu</groupId>
<version>0.0.1</version>
<version>0.1.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>1.0.8</version>

View File

@@ -83,7 +83,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
ctx.next();
});
// 添加跨域的方法
router.route().handler(CorsHandler.create("*").allowCredentials(true).allowedMethods(httpMethods));
router.route().handler(CorsHandler.create().addRelativeOrigin(".*").allowCredentials(true).allowedMethods(httpMethods));
// 配置文件上传路径
router.route().handler(BodyHandler.create().setUploadsDirectory("uploads"));
@@ -104,6 +104,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
registerNewHandler(router, handler);
} catch (Throwable e) {
LOGGER.error("Error register {}, Error details", handler, e.getCause());
}
}
} catch (Exception e) {
@@ -181,7 +182,10 @@ public class RouterHandlerFactory implements BaseHttpApi {
e.printStackTrace();
}
});
router.mountSubRouter(url, route);
if (url.endsWith("*")) {
throw new IllegalArgumentException("Don't include * when mounting a sub router");
}
router.route(url + "*").subRouter(route);
}
}
}
@@ -312,8 +316,8 @@ public class RouterHandlerFactory implements BaseHttpApi {
}
});
// 解析body-json参数
if ("application/json".equals(ctx.parsedHeaders().contentType().value()) && ctx.getBodyAsJson() != null) {
JsonObject body = ctx.getBodyAsJson();
if ("application/json".equals(ctx.parsedHeaders().contentType().value()) && ctx.body().asJsonObject() != null) {
JsonObject body = ctx.body().asJsonObject();
if (body != null) {
methodParametersTemp.forEach((k, v) -> {
// 只解析已配置包名前缀的实体类
@@ -345,7 +349,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
((Future<?>) data).onSuccess(res -> {
if (res instanceof JsonObject) {
fireJsonResponse(ctx, res);
} else {
} else if (res != null){
fireJsonResponse(ctx, JsonResult.data(res));
}
}).onFailure(e -> fireJsonResponse(ctx, JsonResult.error(e.getMessage())));

View File

@@ -1,36 +0,0 @@
package cn.qaiu.lz.common.util;
import io.vertx.core.Vertx;
import io.vertx.ext.web.client.WebClient;
/**
* 移动云空间解析
*/
public class EcTool {
public static String FULL_URL_PREFIX = "https://www.ecpan.cn/drive/fileextoverrid.do?chainUrlTemplate=https:%2F%2Fwww.ecpan.cn%2Fweb%2F%23%2FyunpanProxy%3Fpath%3D%252F%2523%252Fdrive%252Foutside&parentId=-1&data=";
public static String parse(String dataKey) throws Exception {
Vertx vertx = Vertx.vertx();
WebClient client = WebClient.create(vertx);
try {
client.getAbs(FULL_URL_PREFIX+dataKey).send().onSuccess(
res -> {
System.out.println(res.bodyAsString());
}
).onFailure(t -> {
throw new RuntimeException("解析失败");
});
} catch (RuntimeException e) {
throw new Exception(e);
}
return "";
}
public static void main(String[] args) throws Exception {
parse("81027a5c99af5b11ca004966c945cce6W9Bf2");
System.out.println("222222");
}
}

View File

@@ -1,80 +0,0 @@
package cn.qaiu.lz.web.http;
import cn.qaiu.lz.common.util.CowTool;
import cn.qaiu.lz.common.util.LzTool;
import cn.qaiu.lz.web.model.SysUser;
import cn.qaiu.lz.web.service.UserService;
import cn.qaiu.vx.core.annotaions.RouteHandler;
import cn.qaiu.vx.core.annotaions.RouteMapping;
import cn.qaiu.vx.core.enums.RouteMethod;
import cn.qaiu.vx.core.model.JsonResult;
import cn.qaiu.vx.core.util.AsyncServiceUtil;
import io.vertx.core.Future;
import io.vertx.core.http.HttpServerResponse;
import lombok.extern.slf4j.Slf4j;
/**
* 服务API
* <br>Create date 2021/4/28 9:15
*
* @author <a href="https://qaiu.top">QAIU</a>
*/
@Slf4j
@RouteHandler("/")
public class ServerApi {
private final UserService userService = AsyncServiceUtil.getAsyncServiceInstance(UserService.class);
@RouteMapping(value = "/login", method = RouteMethod.POST)
public Future<String> login(SysUser user) {
log.info("<------- login: {}", user.getUsername());
return userService.login(user);
}
@RouteMapping(value = "/test2", method = RouteMethod.GET)
public JsonResult<String> test01() {
return JsonResult.data("ok");
}
@RouteMapping(value = "/parser", method = RouteMethod.GET)
public void parse(HttpServerResponse response, String url) throws Exception {
if (url.contains("lanzou")) {
var urlDownload = LzTool.parse(url);
log.info("url = {}", urlDownload);
response.putHeader("location", urlDownload).setStatusCode(302).end();
} else if (url.contains("cowtransfer.com")) {
var urlDownload = CowTool.parse(url);
response.putHeader("location", urlDownload).setStatusCode(302).end();
}
}
@RouteMapping(value = "/lz/:id", method = RouteMethod.GET)
public void lzParse(HttpServerResponse response, String id) throws Exception {
var url = "https://wwsd.lanzoue.com/" + id;
var urlDownload = LzTool.parse(url);
log.info("url = {}", urlDownload);
response.putHeader("location", urlDownload).setStatusCode(302).end();
}
@RouteMapping(value = "/cow/:id", method = RouteMethod.GET)
public void cowParse(HttpServerResponse response, String id) throws Exception {
var url = "https://cowtransfer.com/s/" + id;
var urlDownload = CowTool.parse(url);
response.putHeader("location", urlDownload).setStatusCode(302).end();
}
@RouteMapping(value = "/json/lz/:id", method = RouteMethod.GET)
public JsonResult<String> lzParseJson(HttpServerResponse response, String id) throws Exception {
var url = "https://wwsd.lanzoue.com/" + id;
var urlDownload = LzTool.parse(url);
log.info("url = {}", urlDownload);
return JsonResult.data(urlDownload);
}
@RouteMapping(value = "/json/cow/:id", method = RouteMethod.GET)
public JsonResult<String> cowParseJson(HttpServerResponse response, String id) throws Exception {
var url = "https://cowtransfer.com/s/" + id;
return JsonResult.data(CowTool.parse(url));
}
}

View File

@@ -5,13 +5,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cn.qaiu</groupId>
<artifactId>lz-cow-api</artifactId>
<artifactId>netdisk-fast-download</artifactId>
<packaging>pom</packaging>
<version>0.0.1</version>
<version>0.1.3</version>
<modules>
<module>core</module>
<module>lz-cow-api-web</module>
<module>web-service</module>
<module>core-database</module>
</modules>
@@ -19,8 +19,7 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vertx.version>4.1.3</vertx.version>
<packageDirectory>${project.basedir}/lz-cow-api-web/target/package</packageDirectory>
<packageDirectory>${project.basedir}/netdisk-fast-download/target/package</packageDirectory>
</properties>
<build>

View File

@@ -3,13 +3,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>lz-cow-api</artifactId>
<artifactId>netdisk-fast-download</artifactId>
<groupId>cn.qaiu</groupId>
<version>0.0.1</version>
<version>0.1.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>0.0.1</version>
<artifactId>lz-cow-api-web</artifactId>
<version>0.1.3</version>
<artifactId>web-service</artifactId>
<properties>
<packageDirectory>${project.basedir}/target/package</packageDirectory>
@@ -62,7 +62,7 @@
<dependency>
<groupId>cn.qaiu</groupId>
<artifactId>core-database</artifactId>
<version>0.0.1</version>
<version>0.1.3</version>
<scope>compile</scope>
</dependency>
@@ -70,6 +70,7 @@
</dependencies>
<build>
<defaultGoal>compile</defaultGoal>
<directory>${project.basedir}/target/</directory>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>

View File

@@ -2,6 +2,7 @@ package cn.qaiu.lz;
import cn.qaiu.db.pool.JDBCPoolInit;
import cn.qaiu.vx.core.Deploy;
import cn.qaiu.vx.core.util.ConfigConstant;
import io.vertx.core.json.JsonObject;
@@ -23,7 +24,9 @@ public class AppMain {
* @param jsonObject 配置
*/
private static void exec(JsonObject jsonObject) {
JDBCPoolInit.builder().config(jsonObject.getJsonObject("dataSource")).build().initPool();
if (jsonObject.getJsonObject(ConfigConstant.SERVER).getBoolean("enableDatabase")) {
JDBCPoolInit.builder().config(jsonObject.getJsonObject("dataSource")).build().initPool();
}
}

View File

@@ -0,0 +1,65 @@
package cn.qaiu.lz.common.util;
import cn.qaiu.vx.core.util.VertxHolder;
import io.vertx.core.Future;
import io.vertx.core.Promise;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.client.WebClient;
import io.vertx.uritemplate.UriTemplate;
import lombok.extern.slf4j.Slf4j;
/**
* 移动云空间解析
*/
@Slf4j
public class EcTool {
private static final String FULL_URL_PREFIX = "https://www.ecpan.cn/drive/fileextoverrid" +
".do?chainUrlTemplate=https:%2F%2Fwww.ecpan" +
".cn%2Fweb%2F%23%2FyunpanProxy%3Fpath%3D%252F%2523%252Fdrive%252Foutside&parentId=-1&data={dataKey}";
private static final String DOWNLOAD_REQUEST_URL = "https://www.ecpan.cn/drive/sharedownload.do";
public static final String EC_HOST = "www.ecpan.cn";
public static Future<String> parse(String dataKey) {
Promise<String> promise = Promise.promise();
WebClient client = WebClient.create(VertxHolder.getVertxInstance());
// 第一次请求 获取文件信息
client.getAbs(UriTemplate.of(FULL_URL_PREFIX)).setTemplateParam("dataKey", dataKey).send().onSuccess(res -> {
JsonObject jsonObject = res.bodyAsJsonObject();
log.debug("ecPan get file info -> {}", jsonObject);
JsonObject fileInfo = jsonObject
.getJsonObject("var")
.getJsonObject("chainFileInfo");
if (!fileInfo.containsKey("errMesg")) {
JsonObject cloudpFile = fileInfo.getJsonObject("cloudpFile");
JsonArray fileIdList = JsonArray.of(cloudpFile);
// 构造请求JSON {"extCodeFlag":0,"isIp":0}
JsonObject requestBodyJson = JsonObject.of("extCodeFlag", 0, "isIp", 0);
requestBodyJson.put("shareId", Integer.parseInt(fileInfo.getString("shareId"))); // 注意shareId
// 数据类型
requestBodyJson.put("groupId", cloudpFile.getString("groupId"));
requestBodyJson.put("fileIdList", fileInfo.getJsonArray("cloudpFileList"));
// 第二次请求 获取下载链接
client.postAbs(DOWNLOAD_REQUEST_URL)
.sendJsonObject(requestBodyJson).onSuccess(res2 -> {
JsonObject jsonRes = res2.bodyAsJsonObject();
log.debug("ecPan get download url -> {}", res2.body().toString());
promise.complete(jsonRes.getJsonObject("var").getString("downloadUrl"));
}).onFailure(t -> {
promise.fail(new RuntimeException("解析异常: key = " + dataKey, t.fillInStackTrace()));
});
} else {
promise.fail(new RuntimeException(DOWNLOAD_REQUEST_URL + " 解析失败: "
+ fileInfo.getString("errMesg")) + " key = " + dataKey);
}
}
).onFailure(t -> {
promise.fail(new RuntimeException("解析异常: key = " + dataKey, t.fillInStackTrace()));
});
return promise.future();
}
}

View File

@@ -0,0 +1,87 @@
package cn.qaiu.lz.common.util;
import cn.qaiu.vx.core.util.VertxHolder;
import io.vertx.core.Future;
import io.vertx.core.Promise;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.client.WebClient;
import io.vertx.uritemplate.UriTemplate;
import lombok.extern.slf4j.Slf4j;
/**
* 移动云空间解析
*/
@Slf4j
public class UcTool {
private static final String API_URL_PREFIX = "https://pc-api.uc.cn/1/clouddrive/";
public static final String FULL_URL_PREFIX = "https://fast.uc.cn/s/";
private static final String FIRST_REQUEST_URL = API_URL_PREFIX + "share/sharepage/token?entry=ft&fr=pc&pr" +
"=UCBrowser";
private static final String SECOND_REQUEST_URL = API_URL_PREFIX + "transfer_share/detail?pwd_id={pwd_id}&passcode" +
"={passcode}&stoken={stoken}";
private static final String THIRD_REQUEST_URL = API_URL_PREFIX + "file/download?entry=ft&fr=pc&pr=UCBrowser";
public static Future<String> parse(String data, String code) {
if (!data.startsWith(FULL_URL_PREFIX)) {
data = FULL_URL_PREFIX + data;
}
var passcode = (code == null) ? "" : code;
var dataKey = data.substring(FULL_URL_PREFIX.length());
Promise<String> promise = Promise.promise();
var client = WebClient.create(VertxHolder.getVertxInstance());
var jsonObject = JsonObject.of("share_for_transfer", true);
jsonObject.put("pwd_id", dataKey);
jsonObject.put("passcode", passcode);
// 第一次请求 获取文件信息
client.postAbs(FIRST_REQUEST_URL).sendJsonObject(jsonObject).onSuccess(res -> {
log.debug("第一阶段 {}", res.body());
var resJson = res.bodyAsJsonObject();
if (resJson.getInteger("code") != 0) {
promise.fail(FIRST_REQUEST_URL + " 返回异常: " + resJson);
return;
}
var stoken = resJson.getJsonObject("data").getString("stoken");
// 第二次请求
client.getAbs(UriTemplate.of(SECOND_REQUEST_URL))
.setTemplateParam("pwd_id", dataKey)
.setTemplateParam("passcode", passcode)
.setTemplateParam("stoken", stoken)
.send().onSuccess(res2 -> {
log.debug("第二阶段 {}", res2.body());
JsonObject resJson2 = res2.bodyAsJsonObject();
if (resJson2.getInteger("code") != 0) {
promise.fail(FIRST_REQUEST_URL + " 返回异常: " + resJson2);
return;
}
// 文件信息
var info = resJson2.getJsonObject("data").getJsonArray("list").getJsonObject(0);
// 第二次请求
var bodyJson = JsonObject.of()
.put("fids", JsonArray.of(info.getString("fid")))
.put("pwd_id", dataKey)
.put("stoken", stoken)
.put("fids_token", JsonArray.of(info.getString("share_fid_token")));
client.postAbs(THIRD_REQUEST_URL).sendJsonObject(bodyJson)
.onSuccess(res3 -> {
log.debug("第三阶段 {}", res3.body());
var resJson3 = res3.bodyAsJsonObject();
if (resJson3.getInteger("code") != 0) {
promise.fail(FIRST_REQUEST_URL + " 返回异常: " + resJson2);
return;
}
promise.complete(resJson3.getJsonArray("data").getJsonObject(0).getString("download_url"));
})
.onFailure(t -> promise
.fail(new RuntimeException("解析异常: ", t.fillInStackTrace())));
}).onFailure(t -> promise.fail(new RuntimeException("解析异常: ", t.fillInStackTrace())));
}
).onFailure(t -> promise.fail(new RuntimeException("解析异常: key = " + dataKey, t.fillInStackTrace())));
return promise.future();
}
}

View File

@@ -0,0 +1,158 @@
package cn.qaiu.lz.web.http;
import cn.qaiu.lz.common.util.CowTool;
import cn.qaiu.lz.common.util.EcTool;
import cn.qaiu.lz.common.util.LzTool;
import cn.qaiu.lz.common.util.UcTool;
import cn.qaiu.lz.web.model.SysUser;
import cn.qaiu.lz.web.service.UserService;
import cn.qaiu.vx.core.annotaions.RouteHandler;
import cn.qaiu.vx.core.annotaions.RouteMapping;
import cn.qaiu.vx.core.enums.RouteMethod;
import cn.qaiu.vx.core.model.JsonResult;
import cn.qaiu.vx.core.util.AsyncServiceUtil;
import io.vertx.core.Future;
import io.vertx.core.Promise;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.http.HttpServerResponse;
import lombok.extern.slf4j.Slf4j;
import static io.vertx.core.http.HttpHeaders.CONTENT_TYPE;
/**
* 服务API
* <br>Create date 2021/4/28 9:15
*
* @author <a href="https://qaiu.top">QAIU</a>
*/
@Slf4j
@RouteHandler("/")
public class ServerApi {
private final UserService userService = AsyncServiceUtil.getAsyncServiceInstance(UserService.class);
@RouteMapping(value = "/login", method = RouteMethod.POST)
public Future<String> login(SysUser user) {
log.info("<------- login: {}", user.getUsername());
return userService.login(user);
}
@RouteMapping(value = "/test2", method = RouteMethod.GET)
public JsonResult<String> test01() {
return JsonResult.data("ok");
}
@RouteMapping(value = "/parser", method = RouteMethod.GET)
public Future<Void> parse(HttpServerResponse response, HttpServerRequest request, String url, String pwd) {
Promise<Void> promise = Promise.promise();
if (url.contains("lanzou")) {
String urlDownload = null;
try {
urlDownload = LzTool.parse(url);
log.info("url = {}", urlDownload);
response.putHeader("location", urlDownload).setStatusCode(302).end();
promise.complete();
} catch (Exception e) {
promise.fail(e);
}
} else if (url.contains("cowtransfer.com")) {
String urlDownload = null;
try {
urlDownload = CowTool.parse(url);
response.putHeader("location", urlDownload).setStatusCode(302).end();
promise.complete();
} catch (Exception e) {
promise.fail(e);
}
} else if (url.contains(EcTool.EC_HOST)) {
// 默认读取Url参数会被截断手动获取一下其他参数
String data = request.getParam("data");
EcTool.parse(data).onSuccess(resUrl -> {
response.putHeader("location", resUrl).setStatusCode(302).end();
promise.complete();
}).onFailure(t -> {
promise.fail(t.fillInStackTrace());
});
} else if (url.contains(UcTool.FULL_URL_PREFIX)) {
UcTool.parse(url, pwd).onSuccess(resUrl -> {
response.putHeader("location", resUrl).setStatusCode(302).end();
promise.complete();
}).onFailure(t -> {
promise.fail(t.fillInStackTrace());
});
}
return promise.future();
}
@RouteMapping(value = "/lz/:id", method = RouteMethod.GET)
public void lzParse(HttpServerResponse response, String id) throws Exception {
var url = "https://wwsd.lanzoue.com/" + id;
var urlDownload = LzTool.parse(url);
log.info("url = {}", urlDownload);
response.putHeader("location", urlDownload).setStatusCode(302).end();
}
@RouteMapping(value = "/cow/:id", method = RouteMethod.GET)
public void cowParse(HttpServerResponse response, String id) throws Exception {
var url = "https://cowtransfer.com/s/" + id;
var urlDownload = CowTool.parse(url);
response.putHeader("location", urlDownload).setStatusCode(302).end();
}
@RouteMapping(value = "/json/lz/:id", method = RouteMethod.GET)
public JsonResult<String> lzParseJson(HttpServerResponse response, String id) throws Exception {
var url = "https://wwsd.lanzoue.com/" + id;
var urlDownload = LzTool.parse(url);
log.info("url = {}", urlDownload);
return JsonResult.data(urlDownload);
}
@RouteMapping(value = "/json/cow/:id", method = RouteMethod.GET)
public JsonResult<String> cowParseJson(HttpServerResponse response, String id) throws Exception {
var url = "https://cowtransfer.com/s/" + id;
return JsonResult.data(CowTool.parse(url));
}
@RouteMapping(value = "/ec/:id", method = RouteMethod.GET)
public void ecParse(HttpServerResponse response, String id) {
EcTool.parse(id).onSuccess(resUrl -> {
response.putHeader("location", resUrl).setStatusCode(302).end();
}).onFailure(t -> {
response.putHeader(CONTENT_TYPE, "text/html;charset=utf-8");
response.end(t.getMessage());
});
}
@RouteMapping(value = "/json/ec/:id", method = RouteMethod.GET)
public Future<String> ecParseJson(HttpServerResponse response, String id) {
return EcTool.parse(id);
}
@RouteMapping(value = "/uc/:id", method = RouteMethod.GET)
public void ucParse(HttpServerResponse response, String id) {
String code = "";
if (id.contains("#")) {
String[] ids = id.split("#");
id = ids[0];
code = ids[1];
}
UcTool.parse(id, code).onSuccess(resUrl -> {
response.putHeader("location", resUrl).setStatusCode(302).end();
}).onFailure(t -> {
response.putHeader(CONTENT_TYPE, "text/html;charset=utf-8");
response.end(t.getMessage());
});
}
@RouteMapping(value = "/json/uc/:id", method = RouteMethod.GET)
public Future<String> ucParseJson(String id) {
String code = "";
if (id.contains("#")) {
String[] ids = id.split("#");
id = ids[0];
code = ids[1];
}
return UcTool.parse(id, code);
}
}

View File

@@ -2,7 +2,10 @@
server:
port: 6400
contextPath: /
# 使用静态页面
enableStaticHtmlService: false
# 使用数据库
enableDatabase: false
staticResourcePath: webroot/
# 反向代理服务器配置路径(不用加后缀)
proxyConf: server-proxy

View File

@@ -0,0 +1,88 @@
### https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&isShare=1
### ecpan(移动云空间)
https://www.ecpan.cn/drive/fileextoverrid.do?chainUrlTemplate=https:%2F%2Fwww.ecpan.cn%2Fweb%2F%23%2FyunpanProxy%3Fpath%3D%252F%2523%252Fdrive%252Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&parentId=-1
###
POST https://www.ecpan.cn/drive/sharedownload.do
Content-Type: application/json
{
"extCodeFlag": 0,
"isIp": 0,
"shareId": 2404783,
"groupId": "c27b53c4f91b11ed86b3b026287b20b1",
"fileIdList": [{
"tableName": "cloudp_file_52",
"appFileId": "2d06ad61f91c11ed86b3b026287b20b1",
"dfsFileId": "3080817de83747698ff5747e25f97e50",
"fileName": "fonts.zip",
"filePath": "个人盘",
"fileLevel": 0,
"fileCount": 0,
"fileType": 2,
"fileSort": 99,
"fileSize": 19115063,
"uploadSize": 19115063,
"parentId": "c27b53c4f91b11ed86b3b026287b20b1",
"usn": 11364252,
"userName": "157****1073",
"userId": "",
"corpId": 13260232,
"createDate": 1684813492000,
"modifyDate": 1684813492000,
"status": 1,
"version": 0,
"comeFrom": 21,
"isShare": 0,
"folderType": 0,
"groupDesc": null,
"groupId": "c27b53c4f91b11ed86b3b026287b20b1",
"groupName": null,
"permission": null,
"userInfo": null,
"diskType": 1,
"historyKey": null,
"oldAppFileId": null,
"fileRealPath": null,
"fileExt": null,
"oldFileName": null,
"key": null,
"isUpperCase": null,
"isSubDir": null,
"isViewFolder": null,
"uploadTimeType": null,
"startUploadTime": null,
"endUploadTime": null,
"sizeOperator": null,
"orderField": null,
"orderBy": null,
"oldFilePath": null,
"statusStr": null,
"rootUsn": 11364252,
"createdByUsn": null,
"attentionCount": 0,
"fileMd5": "86c1ff32437ca0ccaca24f7ea197e34a",
"fileLabel": null,
"fileDesc": null,
"fileExtends": "<fileExtends><shareRoot></shareRoot><isLock>0</isLock><isEncrypt>0</isEncrypt></fileExtends>",
"deviceId": null,
"fileNamePinyin": "fonts.zip",
"modifyUser": "157****1073",
"fileExFileds": {
"shareRoot": "",
"isLock": 0,
"isEncrypt": 0
},
"security": 0,
"createdDate": null,
"modifiedDate1": null,
"modifiedDate2": null,
"createdDate1": null,
"createdDate2": null,
"deleteUsn": null,
"toShares": null,
"firstLevel": null
}]
}

View File

@@ -130,207 +130,29 @@ https://drive-pc.quark.cn/1/clouddrive/share/sharepage/detail?pr=ucpro&fr=pc&pwd
https://drive-pc.quark.cn/1/clouddrive/auth/pc/flush?pr=ucpro&fr=pc
cookie: __pus=77641f2139b914c29ed2b0caf246723dAAQbjDyR/fi1Z9YqqWbfO2qPZYeRTrFSC2P30uuWJwtY2ZwwQTRsEPHJKc9nuPnrXfQxir+0N8K/mVfr7SIwGc2t;
# https://fast.uc.cn/s/33197dd53ace4
### UCpan
https://fast.uc.cn/api/info?st=&fr=pc&pr=UCBrowser
### UCpan 第一步 获取stoken POST json传入pwd_id(分享id),passcode(分享密码)
POST https://pc-api.uc.cn/1/clouddrive/share/sharepage/token?entry=ft&fr=pc&pr=UCBrowser
content-type: application/json
{"pwd_id":"33197dd53ace4","passcode":"","share_for_transfer":true}
### UCpan 第二步 获取fid,share_fid_token GET传参pwd_id,passcode,stoken
https://pc-api.uc.cn/1/clouddrive/transfer_share/detail?pwd_id=33197dd53ace4&passcode=&stoken=oPz47hsgQXQdDYimsP4kBMi8aLv40X378IZOiBsnfLU%3D
content-type: application/json
### UCpan 第二步获取下载链接 POST json传入fids(fid),pwd_id,stoken,fids_token(share_fid_token)
POST https://pc-api.uc.cn/1/clouddrive/file/download?entry=ft&fr=pc&pr=UCBrowser
content-type: application/json
{
"fids": [
"54c3cd90ed3e45119bb96ed99a562d40"
],
"pwd_id": "33197dd53ace4",
"stoken": "oPz47hsgQXQdDYimsP4kBMi8aLv40X378IZOiBsnfLU=",
"fids_token": [
"ff9f5b5c94df9d08c8dd3b7948fc5e20"
]
}
### https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&isShare=1
### ecpan(移动云空间)
https://www.ecpan.cn/drive/fileextoverrid.do?chainUrlTemplate=https:%2F%2Fwww.ecpan.cn%2Fweb%2F%23%2FyunpanProxy%3Fpath%3D%252F%2523%252Fdrive%252Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&parentId=-1
###
POST https://www.ecpan.cn/drive/sharedownload.do
Accept: application/json
Content-Type: application/json
{
"extCodeFlag": 0,
"isIp": 0,
"shareId": 2404807,
"groupId": "c27b53c4f91b11ed86b3b026287b20b1",
"fileIdList": [{
"tableName": "cloudp_file_52",
"appFileId": "2d06ad61f91c11ed86b3b026287b20b1",
"dfsFileId": "3080817de83747698ff5747e25f97e50",
"fileName": "fonts.zip",
"filePath": "个人盘",
"fileLevel": 0,
"fileCount": 0,
"fileType": 2,
"fileSort": 99,
"fileSize": 19115063,
"uploadSize": 19115063,
"parentId": "c27b53c4f91b11ed86b3b026287b20b1",
"usn": 11364252,
"userName": "157****1073",
"userId": "",
"corpId": 13260232,
"createDate": 1684813492000,
"modifyDate": 1684813492000,
"status": 1,
"version": 0,
"comeFrom": 21,
"isShare": 0,
"folderType": 0,
"groupDesc": null,
"groupId": "c27b53c4f91b11ed86b3b026287b20b1",
"groupName": null,
"permission": null,
"userInfo": null,
"diskType": 1,
"historyKey": null,
"oldAppFileId": null,
"fileRealPath": null,
"fileExt": null,
"oldFileName": null,
"key": null,
"isUpperCase": null,
"isSubDir": null,
"isViewFolder": null,
"uploadTimeType": null,
"startUploadTime": null,
"endUploadTime": null,
"sizeOperator": null,
"orderField": null,
"orderBy": null,
"oldFilePath": null,
"statusStr": null,
"rootUsn": 11364252,
"createdByUsn": null,
"attentionCount": 0,
"fileMd5": "86c1ff32437ca0ccaca24f7ea197e34a",
"fileLabel": null,
"fileDesc": null,
"fileExtends": "<fileExtends><shareRoot></shareRoot><isLock>0</isLock><isEncrypt>0</isEncrypt></fileExtends>",
"deviceId": null,
"fileNamePinyin": "fonts.zip",
"modifyUser": "157****1073",
"fileExFileds": {
"shareRoot": "",
"isLock": 0,
"isEncrypt": 0
},
"security": 0,
"createdDate": null,
"modifiedDate1": null,
"modifiedDate2": null,
"createdDate1": null,
"createdDate2": null,
"deleteUsn": null,
"toShares": null,
"firstLevel": null
}]
}
###
https://www.ecpan.cn/drive/fileextoverrid.do?chainUrlTemplate=https:%2F%2Fwww.ecpan.cn%2Fweb%2F%23%2FyunpanProxy%3Fpath%3D%252F%2523%252Fdrive%252Foutside&data=aa0cae0164d8885e6d35826b5b2901eckbWJBalM&parentId=-1
###
POST https://www.ecpan.cn/drive/sharedownload.do
Accept: application/json
Content-Type: application/json
# @no-redirect
GET http://127.0.0.1:6400/parser?url=https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&isShare=
# https://www.ecpan.cn/drive/fileextoverrid.do?chainUrlTemplate=https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=aa0cae0164d8885e6d35826b5b2901eckbWJBalM&parentId=-1
{
"extCodeFlag": 0,
"isIp": 0,
"shareId": 2404807,
"groupId": "c27b53c4f91b11ed86b3b026287b20b1",
"fileIdList": [{
"tableName": "cloudp_file_52",
"appFileId": "fe4ea2d0f92011ed86b3b026287b20b1",
"dfsFileId": "a81bdef5a9614d30b7f856755c985cf8",
"fileName": "readline-7.0-rc1.tar.gz",
"filePath": "个人盘\\app",
"fileLevel": 1,
"fileCount": 0,
"fileType": 2,
"fileSort": 99,
"fileSize": 2897058,
"uploadSize": 2897058,
"parentId": "ed008146f92011ed86b3b026287b20b1",
"usn": 11364252,
"userName": "157****1073",
"userId": "",
"corpId": 13260232,
"createDate": 1684815561000,
"modifyDate": 1684815561000,
"status": 1,
"version": 0,
"comeFrom": 21,
"isShare": 0,
"folderType": 0,
"groupDesc": null,
"groupId": "c27b53c4f91b11ed86b3b026287b20b1",
"groupName": null,
"permission": null,
"userInfo": null,
"diskType": 1,
"historyKey": null,
"oldAppFileId": null,
"fileRealPath": null,
"fileExt": null,
"oldFileName": null,
"key": null,
"isUpperCase": null,
"isSubDir": null,
"isViewFolder": null,
"uploadTimeType": null,
"startUploadTime": null,
"endUploadTime": null,
"sizeOperator": null,
"orderField": null,
"orderBy": null,
"oldFilePath": null,
"statusStr": null,
"rootUsn": 11364252,
"createdByUsn": null,
"attentionCount": 0,
"fileMd5": "c5ed4d0fd48ec6c940d6da375e3f1b50",
"fileLabel": null,
"fileDesc": null,
"fileExtends": "<fileExtends><shareRoot></shareRoot><isLock>0</isLock><isEncrypt>0</isEncrypt></fileExtends>",
"deviceId": null,
"fileNamePinyin": "readline-7.0-rc1.tar.gz",
"modifyUser": "157****1073",
"fileExFileds": {
"shareRoot": "",
"isLock": 0,
"isEncrypt": 0
},
"security": 0,
"createdDate": null,
"modifiedDate1": null,
"modifiedDate2": null,
"createdDate1": null,
"createdDate2": null,
"deleteUsn": null,
"toShares": null,
"firstLevel": null
}]
}
###
# @no-redirect
GET http://127.0.0.1:6400/ec/aa0cae0164d8885e6d35826b5b2901eckbWJBalM1
###
GET http://127.0.0.1:6400/json/ec/aa0cae0164d8885e6d35826b5b2901eckbWJBalM
###
# @no-redirect
GET http://127.0.0.1:6400/uc/33197dd53ace4
###
GET http://127.0.0.1:6400/json/uc/33197dd53ace4
###
# @no-redirect
GET http://127.0.0.1:6400/parser?url=https://fast.uc.cn/s/33197dd53ace4

View File

@@ -0,0 +1,29 @@
# https://fast.uc.cn/s/33197dd53ace4
### UCpan
https://fast.uc.cn/api/info?st=&fr=pc&pr=UCBrowser
### UCpan 第一步 获取stoken POST json传入pwd_id(分享id),passcode(分享密码)
POST https://pc-api.uc.cn/1/clouddrive/share/sharepage/token?entry=ft&fr=pc&pr=UCBrowser
content-type: application/json
{"pwd_id":"33197dd53ace4","passcode":"","share_for_transfer":true}
### UCpan 第二步 获取fid,share_fid_token GET传参pwd_id,passcode,stoken
https://pc-api.uc.cn/1/clouddrive/transfer_share/detail?pwd_id=33197dd53ace4&passcode=&stoken=oPz47hsgQXQdDYimsP4kBMi8aLv40X378IZOiBsnfLU%3D
content-type: application/json
### UCpan 第二步获取下载链接 POST json传入fids(fid),pwd_id,stoken,fids_token(share_fid_token)
POST https://pc-api.uc.cn/1/clouddrive/file/download?entry=ft&fr=pc&pr=UCBrowser
content-type: application/json
{
"fids": [
"54c3cd90ed3e45119bb96ed99a562d40"
],
"pwd_id": "33197dd53ace4",
"stoken": "oPz47hsgQXQdDYimsP4kBMi8aLv40X378IZOiBsnfLU=",
"fids_token": [
"ff9f5b5c94df9d08c8dd3b7948fc5e20"
]
}

View File

@@ -4,6 +4,8 @@ import java.io.*;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
public class TestOS {
@@ -157,5 +159,6 @@ public class TestOS {
// all();
// new TestOS().showURL();
System.out.println(File.separator);
System.out.println(URLEncoder.encode("https://www.ecpan.cn/web/#/yunpanProxy", StandardCharsets.UTF_8));
}
}