diff --git a/.gitignore b/.gitignore index 10be014..82d6349 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,4 @@ sdkTest.log gradlew gradlew.bat unused.txt -/lz-cow-api-web/src/main/generated/ +/web-service/src/main/generated/ diff --git a/README.md b/README.md index 872bce3..a7c58ff 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/bin/lz-api.service b/bin/lz-api.service index 7d7188e..91ad871 100644 --- a/bin/lz-api.service +++ b/bin/lz-api.service @@ -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 diff --git a/bin/run.bat b/bin/run.bat index 21d188e..29680f2 100644 --- a/bin/run.bat +++ b/bin/run.bat @@ -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% %* diff --git a/bin/run.sh b/bin/run.sh index 45f81b8..ec7bf36 100644 --- a/bin/run.sh +++ b/bin/run.sh @@ -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 diff --git a/core-database/pom.xml b/core-database/pom.xml index c2b4c47..0d45ec8 100644 --- a/core-database/pom.xml +++ b/core-database/pom.xml @@ -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"> - lz-cow-api + netdisk-fast-download cn.qaiu - 0.0.1 + 0.1.3 4.0.0 diff --git a/core/pom.xml b/core/pom.xml index 1809066..bfe2b7d 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -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"> - lz-cow-api + netdisk-fast-download cn.qaiu - 0.0.1 + 0.1.3 4.0.0 1.0.8 diff --git a/core/src/main/java/cn/qaiu/vx/core/handlerfactory/RouterHandlerFactory.java b/core/src/main/java/cn/qaiu/vx/core/handlerfactory/RouterHandlerFactory.java index eb30e42..4729432 100644 --- a/core/src/main/java/cn/qaiu/vx/core/handlerfactory/RouterHandlerFactory.java +++ b/core/src/main/java/cn/qaiu/vx/core/handlerfactory/RouterHandlerFactory.java @@ -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()))); diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/common/util/EcTool.java b/lz-cow-api-web/src/main/java/cn/qaiu/lz/common/util/EcTool.java deleted file mode 100644 index 0e61efb..0000000 --- a/lz-cow-api-web/src/main/java/cn/qaiu/lz/common/util/EcTool.java +++ /dev/null @@ -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"); - } -} diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/http/ServerApi.java b/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/http/ServerApi.java deleted file mode 100644 index d32c788..0000000 --- a/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/http/ServerApi.java +++ /dev/null @@ -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 - *
Create date 2021/4/28 9:15 - * - * @author QAIU - */ -@Slf4j -@RouteHandler("/") -public class ServerApi { - - private final UserService userService = AsyncServiceUtil.getAsyncServiceInstance(UserService.class); - - @RouteMapping(value = "/login", method = RouteMethod.POST) - public Future login(SysUser user) { - log.info("<------- login: {}", user.getUsername()); - return userService.login(user); - } - - @RouteMapping(value = "/test2", method = RouteMethod.GET) - public JsonResult 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 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 cowParseJson(HttpServerResponse response, String id) throws Exception { - var url = "https://cowtransfer.com/s/" + id; - return JsonResult.data(CowTool.parse(url)); - } -} diff --git a/pom.xml b/pom.xml index 15c4ba2..27b9dd8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,13 +5,13 @@ 4.0.0 cn.qaiu - lz-cow-api + netdisk-fast-download pom - 0.0.1 + 0.1.3 core - lz-cow-api-web + web-service core-database @@ -19,8 +19,7 @@ 17 17 UTF-8 - 4.1.3 - ${project.basedir}/lz-cow-api-web/target/package + ${project.basedir}/netdisk-fast-download/target/package diff --git a/lz-cow-api-web/assembly.xml b/web-service/assembly.xml similarity index 100% rename from lz-cow-api-web/assembly.xml rename to web-service/assembly.xml diff --git a/lz-cow-api-web/pom.xml b/web-service/pom.xml similarity index 97% rename from lz-cow-api-web/pom.xml rename to web-service/pom.xml index 0e454ce..9c1cd5e 100644 --- a/lz-cow-api-web/pom.xml +++ b/web-service/pom.xml @@ -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"> - lz-cow-api + netdisk-fast-download cn.qaiu - 0.0.1 + 0.1.3 4.0.0 - 0.0.1 - lz-cow-api-web + 0.1.3 + web-service ${project.basedir}/target/package @@ -62,7 +62,7 @@ cn.qaiu core-database - 0.0.1 + 0.1.3 compile @@ -70,6 +70,7 @@ + compile ${project.basedir}/target/ ${project.build.directory}/classes ${project.artifactId}-${project.version} diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/AppMain.java b/web-service/src/main/java/cn/qaiu/lz/AppMain.java similarity index 66% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/AppMain.java rename to web-service/src/main/java/cn/qaiu/lz/AppMain.java index 3f24a12..5a9ae1c 100644 --- a/lz-cow-api-web/src/main/java/cn/qaiu/lz/AppMain.java +++ b/web-service/src/main/java/cn/qaiu/lz/AppMain.java @@ -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(); + } } diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/common/ToJson.java b/web-service/src/main/java/cn/qaiu/lz/common/ToJson.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/common/ToJson.java rename to web-service/src/main/java/cn/qaiu/lz/common/ToJson.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/common/interceptorImpl/DefaultInterceptor.java b/web-service/src/main/java/cn/qaiu/lz/common/interceptorImpl/DefaultInterceptor.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/common/interceptorImpl/DefaultInterceptor.java rename to web-service/src/main/java/cn/qaiu/lz/common/interceptorImpl/DefaultInterceptor.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/common/model/MyData.java b/web-service/src/main/java/cn/qaiu/lz/common/model/MyData.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/common/model/MyData.java rename to web-service/src/main/java/cn/qaiu/lz/common/model/MyData.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/common/model/UserInfo.java b/web-service/src/main/java/cn/qaiu/lz/common/model/UserInfo.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/common/model/UserInfo.java rename to web-service/src/main/java/cn/qaiu/lz/common/model/UserInfo.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/common/util/ArrayUtil.java b/web-service/src/main/java/cn/qaiu/lz/common/util/ArrayUtil.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/common/util/ArrayUtil.java rename to web-service/src/main/java/cn/qaiu/lz/common/util/ArrayUtil.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/common/util/ConnectUtil.java b/web-service/src/main/java/cn/qaiu/lz/common/util/ConnectUtil.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/common/util/ConnectUtil.java rename to web-service/src/main/java/cn/qaiu/lz/common/util/ConnectUtil.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/common/util/CowTool.java b/web-service/src/main/java/cn/qaiu/lz/common/util/CowTool.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/common/util/CowTool.java rename to web-service/src/main/java/cn/qaiu/lz/common/util/CowTool.java diff --git a/web-service/src/main/java/cn/qaiu/lz/common/util/EcTool.java b/web-service/src/main/java/cn/qaiu/lz/common/util/EcTool.java new file mode 100644 index 0000000..8697146 --- /dev/null +++ b/web-service/src/main/java/cn/qaiu/lz/common/util/EcTool.java @@ -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 parse(String dataKey) { + Promise 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(); + } +} diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/common/util/LzTool.java b/web-service/src/main/java/cn/qaiu/lz/common/util/LzTool.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/common/util/LzTool.java rename to web-service/src/main/java/cn/qaiu/lz/common/util/LzTool.java diff --git a/web-service/src/main/java/cn/qaiu/lz/common/util/UcTool.java b/web-service/src/main/java/cn/qaiu/lz/common/util/UcTool.java new file mode 100644 index 0000000..4a7f688 --- /dev/null +++ b/web-service/src/main/java/cn/qaiu/lz/common/util/UcTool.java @@ -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 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 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(); + } +} diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/package-info.java b/web-service/src/main/java/cn/qaiu/lz/package-info.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/package-info.java rename to web-service/src/main/java/cn/qaiu/lz/package-info.java diff --git a/web-service/src/main/java/cn/qaiu/lz/web/http/ServerApi.java b/web-service/src/main/java/cn/qaiu/lz/web/http/ServerApi.java new file mode 100644 index 0000000..9bd0b6b --- /dev/null +++ b/web-service/src/main/java/cn/qaiu/lz/web/http/ServerApi.java @@ -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 + *
Create date 2021/4/28 9:15 + * + * @author QAIU + */ +@Slf4j +@RouteHandler("/") +public class ServerApi { + + private final UserService userService = AsyncServiceUtil.getAsyncServiceInstance(UserService.class); + + @RouteMapping(value = "/login", method = RouteMethod.POST) + public Future login(SysUser user) { + log.info("<------- login: {}", user.getUsername()); + return userService.login(user); + } + + @RouteMapping(value = "/test2", method = RouteMethod.GET) + public JsonResult test01() { + return JsonResult.data("ok"); + } + + @RouteMapping(value = "/parser", method = RouteMethod.GET) + public Future parse(HttpServerResponse response, HttpServerRequest request, String url, String pwd) { + Promise 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 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 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 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 ucParseJson(String id) { + String code = ""; + if (id.contains("#")) { + String[] ids = id.split("#"); + id = ids[0]; + code = ids[1]; + } + return UcTool.parse(id, code); + } +} diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/model/CowUser.java b/web-service/src/main/java/cn/qaiu/lz/web/model/CowUser.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/web/model/CowUser.java rename to web-service/src/main/java/cn/qaiu/lz/web/model/CowUser.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/model/LzUser.java b/web-service/src/main/java/cn/qaiu/lz/web/model/LzUser.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/web/model/LzUser.java rename to web-service/src/main/java/cn/qaiu/lz/web/model/LzUser.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/model/SysUser.java b/web-service/src/main/java/cn/qaiu/lz/web/model/SysUser.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/web/model/SysUser.java rename to web-service/src/main/java/cn/qaiu/lz/web/model/SysUser.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/DbService.java b/web-service/src/main/java/cn/qaiu/lz/web/service/DbService.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/DbService.java rename to web-service/src/main/java/cn/qaiu/lz/web/service/DbService.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/JdkProxyFactory.java b/web-service/src/main/java/cn/qaiu/lz/web/service/JdkProxyFactory.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/JdkProxyFactory.java rename to web-service/src/main/java/cn/qaiu/lz/web/service/JdkProxyFactory.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/ServiceJdkProxy.java b/web-service/src/main/java/cn/qaiu/lz/web/service/ServiceJdkProxy.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/ServiceJdkProxy.java rename to web-service/src/main/java/cn/qaiu/lz/web/service/ServiceJdkProxy.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/UserService.java b/web-service/src/main/java/cn/qaiu/lz/web/service/UserService.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/UserService.java rename to web-service/src/main/java/cn/qaiu/lz/web/service/UserService.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/impl/DbServiceImpl.java b/web-service/src/main/java/cn/qaiu/lz/web/service/impl/DbServiceImpl.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/impl/DbServiceImpl.java rename to web-service/src/main/java/cn/qaiu/lz/web/service/impl/DbServiceImpl.java diff --git a/lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/impl/UserServiceImpl.java b/web-service/src/main/java/cn/qaiu/lz/web/service/impl/UserServiceImpl.java similarity index 100% rename from lz-cow-api-web/src/main/java/cn/qaiu/lz/web/service/impl/UserServiceImpl.java rename to web-service/src/main/java/cn/qaiu/lz/web/service/impl/UserServiceImpl.java diff --git a/lz-cow-api-web/src/main/resources/app-dev.yml b/web-service/src/main/resources/app-dev.yml similarity index 93% rename from lz-cow-api-web/src/main/resources/app-dev.yml rename to web-service/src/main/resources/app-dev.yml index 81d2859..d036e8c 100644 --- a/lz-cow-api-web/src/main/resources/app-dev.yml +++ b/web-service/src/main/resources/app-dev.yml @@ -2,7 +2,10 @@ server: port: 6400 contextPath: / + # 使用静态页面 enableStaticHtmlService: false + # 使用数据库 + enableDatabase: false staticResourcePath: webroot/ # 反向代理服务器配置路径(不用加后缀) proxyConf: server-proxy diff --git a/lz-cow-api-web/src/main/resources/app.yml b/web-service/src/main/resources/app.yml similarity index 100% rename from lz-cow-api-web/src/main/resources/app.yml rename to web-service/src/main/resources/app.yml diff --git a/lz-cow-api-web/src/main/resources/conf/dictionaries.json b/web-service/src/main/resources/conf/dictionaries.json similarity index 100% rename from lz-cow-api-web/src/main/resources/conf/dictionaries.json rename to web-service/src/main/resources/conf/dictionaries.json diff --git a/lz-cow-api-web/src/main/resources/curl/curl.sh b/web-service/src/main/resources/http-tools/curl.sh similarity index 100% rename from lz-cow-api-web/src/main/resources/curl/curl.sh rename to web-service/src/main/resources/http-tools/curl.sh diff --git a/web-service/src/main/resources/http-tools/ecpan.http b/web-service/src/main/resources/http-tools/ecpan.http new file mode 100644 index 0000000..fb9b872 --- /dev/null +++ b/web-service/src/main/resources/http-tools/ecpan.http @@ -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": "00", + "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 + }] +} diff --git a/lz-cow-api-web/src/main/resources/1.http b/web-service/src/main/resources/http-tools/test.http similarity index 53% rename from lz-cow-api-web/src/main/resources/1.http rename to web-service/src/main/resources/http-tools/test.http index 50aaebf..50ea3e0 100644 --- a/lz-cow-api-web/src/main/resources/1.http +++ b/web-service/src/main/resources/http-tools/test.http @@ -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": "00", - "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": "00", - "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 diff --git a/web-service/src/main/resources/http-tools/ucpan.http b/web-service/src/main/resources/http-tools/ucpan.http new file mode 100644 index 0000000..b4c5ad8 --- /dev/null +++ b/web-service/src/main/resources/http-tools/ucpan.http @@ -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" + ] +} diff --git a/lz-cow-api-web/src/main/resources/logback.xml b/web-service/src/main/resources/logback.xml similarity index 100% rename from lz-cow-api-web/src/main/resources/logback.xml rename to web-service/src/main/resources/logback.xml diff --git a/lz-cow-api-web/src/main/resources/server-proxy.yml b/web-service/src/main/resources/server-proxy.yml similarity index 100% rename from lz-cow-api-web/src/main/resources/server-proxy.yml rename to web-service/src/main/resources/server-proxy.yml diff --git a/lz-cow-api-web/src/test/java/cn/qaiu/web/test/Test01.java b/web-service/src/test/java/cn/qaiu/web/test/Test01.java similarity index 100% rename from lz-cow-api-web/src/test/java/cn/qaiu/web/test/Test01.java rename to web-service/src/test/java/cn/qaiu/web/test/Test01.java diff --git a/lz-cow-api-web/src/test/java/cn/qaiu/web/test/Test02.java b/web-service/src/test/java/cn/qaiu/web/test/Test02.java similarity index 100% rename from lz-cow-api-web/src/test/java/cn/qaiu/web/test/Test02.java rename to web-service/src/test/java/cn/qaiu/web/test/Test02.java diff --git a/lz-cow-api-web/src/test/java/cn/qaiu/web/test/TestJsoup.java b/web-service/src/test/java/cn/qaiu/web/test/TestJsoup.java similarity index 100% rename from lz-cow-api-web/src/test/java/cn/qaiu/web/test/TestJsoup.java rename to web-service/src/test/java/cn/qaiu/web/test/TestJsoup.java diff --git a/lz-cow-api-web/src/test/java/cn/qaiu/web/test/TestOS.java b/web-service/src/test/java/cn/qaiu/web/test/TestOS.java similarity index 97% rename from lz-cow-api-web/src/test/java/cn/qaiu/web/test/TestOS.java rename to web-service/src/test/java/cn/qaiu/web/test/TestOS.java index 324b663..d1dc92e 100644 --- a/lz-cow-api-web/src/test/java/cn/qaiu/web/test/TestOS.java +++ b/web-service/src/test/java/cn/qaiu/web/test/TestOS.java @@ -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)); } } diff --git a/lz-cow-api-web/src/test/java/cn/qaiu/web/test/TestWebClient2.java b/web-service/src/test/java/cn/qaiu/web/test/TestWebClient2.java similarity index 100% rename from lz-cow-api-web/src/test/java/cn/qaiu/web/test/TestWebClient2.java rename to web-service/src/test/java/cn/qaiu/web/test/TestWebClient2.java diff --git a/lz-cow-api-web/src/test/java/cn/qaiu/web/test/WebClientExample.java b/web-service/src/test/java/cn/qaiu/web/test/WebClientExample.java similarity index 100% rename from lz-cow-api-web/src/test/java/cn/qaiu/web/test/WebClientExample.java rename to web-service/src/test/java/cn/qaiu/web/test/WebClientExample.java diff --git a/lz-cow-api-web/src/test/java/cn/qaiu/web/test/WebProxyExamples.java b/web-service/src/test/java/cn/qaiu/web/test/WebProxyExamples.java similarity index 100% rename from lz-cow-api-web/src/test/java/cn/qaiu/web/test/WebProxyExamples.java rename to web-service/src/test/java/cn/qaiu/web/test/WebProxyExamples.java