mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 12:23:03 +00:00
接口重构
This commit is contained in:
@@ -78,7 +78,8 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
ctx.request().path(), ctx.request().absoluteURI(), ctx.request().method());
|
||||
ctx.response().headers().add(ACCESS_CONTROL_ALLOW_ORIGIN, "*");
|
||||
ctx.response().headers().add(ACCESS_CONTROL_ALLOW_METHODS, "POST, GET, OPTIONS, PUT, DELETE, HEAD");
|
||||
ctx.response().headers().add(ACCESS_CONTROL_ALLOW_HEADERS, "X-PINGOTHER, Origin,Content-Type, Accept, X-Requested-With, Dev, Authorization, Version, Token");
|
||||
ctx.response().headers().add(ACCESS_CONTROL_ALLOW_HEADERS, "X-PINGOTHER, Origin,Content-Type, Accept, " +
|
||||
"X-Requested-With, Dev, Authorization, Version, Token");
|
||||
ctx.response().headers().add(ACCESS_CONTROL_MAX_AGE, "1728000");
|
||||
ctx.next();
|
||||
});
|
||||
@@ -199,8 +200,8 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
*/
|
||||
private String getRouteUrl(String methodName, String mapperValue) {
|
||||
String routeUrl;
|
||||
if (mapperValue.startsWith("/:") || "/".equals(mapperValue)) {
|
||||
routeUrl = (methodName + mapperValue);
|
||||
if ("/".equals(mapperValue)) {
|
||||
routeUrl = mapperValue;
|
||||
} else if (mapperValue.startsWith("/")) {
|
||||
routeUrl = mapperValue.substring(1);
|
||||
} else {
|
||||
@@ -349,7 +350,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
((Future<?>) data).onSuccess(res -> {
|
||||
if (res instanceof JsonObject) {
|
||||
fireJsonResponse(ctx, res);
|
||||
} else if (res != null){
|
||||
} else if (res != null) {
|
||||
fireJsonResponse(ctx, JsonResult.data(res));
|
||||
}
|
||||
}).onFailure(e -> fireJsonResponse(ctx, JsonResult.error(e.getMessage())));
|
||||
@@ -363,7 +364,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
String err = e.getMessage();
|
||||
if (e.getCause() != null) {
|
||||
if (e.getCause() instanceof InvocationTargetException) {
|
||||
err = ((InvocationTargetException)e.getCause()).getTargetException().getMessage();
|
||||
err = ((InvocationTargetException) e.getCause()).getTargetException().getMessage();
|
||||
} else {
|
||||
err = e.getCause().getMessage();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.qaiu.lz.common.parser;//package cn.qaiu.lz.common.parser;
|
||||
|
||||
import cn.qaiu.lz.common.parser.impl.*;
|
||||
import io.vertx.core.Future;
|
||||
|
||||
public interface IPanTool {
|
||||
Future<String> parse(String data, String code);
|
||||
|
||||
static IPanTool typeMatching(String type) {
|
||||
return switch (type) {
|
||||
case "lz" -> new LzTool();
|
||||
case "cow" -> new CowTool();
|
||||
case "ec" -> new EcTool();
|
||||
case "fc" -> new FcTool();
|
||||
case "uc" -> new UcTool();
|
||||
case "ye" -> new YeTool();
|
||||
case "fj" -> new FjTool();
|
||||
default -> {
|
||||
throw new IllegalArgumentException("未知分享类型");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static IPanTool shareURLPrefixMatching(String url) {
|
||||
|
||||
if (url.startsWith(CowTool.SHARE_URL_PREFIX)) {
|
||||
return new CowTool();
|
||||
} else if (url.startsWith(EcTool.SHARE_URL_PREFIX)) {
|
||||
return new EcTool();
|
||||
} else if (url.startsWith(FcTool.SHARE_URL_PREFIX)) {
|
||||
return new FcTool();
|
||||
} else if (url.startsWith(UcTool.SHARE_URL_PREFIX)) {
|
||||
return new UcTool();
|
||||
} else if (url.startsWith(YeTool.SHARE_URL_PREFIX)) {
|
||||
return new YeTool();
|
||||
} else if (url.startsWith(FjTool.SHARE_URL_PREFIX)) {
|
||||
return new FjTool();
|
||||
} else if (url.contains("lanzou")) {
|
||||
return new LzTool();
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("未知分享类型");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.qaiu.lz.common.parser;
|
||||
|
||||
import cn.qaiu.lz.common.parser.impl.LzTool;
|
||||
|
||||
/**
|
||||
* @author <a href="https://qaiu.top">QAIU</a>
|
||||
* @date 2023/6/13 4:26
|
||||
*/
|
||||
public enum PanType {
|
||||
LZ("lz"),
|
||||
COW("cow");
|
||||
|
||||
PanType(String type) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package cn.qaiu.lz.common.parser.impl;
|
||||
|
||||
import cn.qaiu.lz.common.parser.IPanTool;
|
||||
import cn.qaiu.lz.common.util.CommonUtils;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.Promise;
|
||||
import io.vertx.core.Vertx;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.ext.web.client.WebClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 奶牛快传解析工具
|
||||
*
|
||||
* @author <a href="https://qaiu.top">QAIU</a>
|
||||
* @date 2023/4/21 21:19
|
||||
*/
|
||||
@Slf4j
|
||||
public class CowTool implements IPanTool {
|
||||
|
||||
private static final String API_REQUEST_URL = "https://cowtransfer.com/core/api/transfer/share";
|
||||
public static final String SHARE_URL_PREFIX = "https://cowtransfer.com/s/";
|
||||
|
||||
public Future<String> parse(String data, String code) {
|
||||
Promise<String> promise = Promise.promise();
|
||||
WebClient client = WebClient.create(Vertx.vertx());
|
||||
String key = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data);
|
||||
client.getAbs(API_REQUEST_URL + "?uniqueUrl=" + key).send().onSuccess(res -> {
|
||||
JsonObject resJson = res.bodyAsJsonObject();
|
||||
if ("success".equals(resJson.getString("message")) && resJson.containsKey("data")) {
|
||||
JsonObject dataJson = resJson.getJsonObject("data");
|
||||
String guid = dataJson.getString("guid");
|
||||
String fileId = dataJson.getJsonObject("firstFile").getString("id");
|
||||
String url2 = API_REQUEST_URL + "/download?transferGuid=" + guid + "&fileId=" + fileId;
|
||||
client.getAbs(url2).send().onSuccess(res2 -> {
|
||||
JsonObject res2Json = res2.bodyAsJsonObject();
|
||||
if ("success".equals(res2Json.getString("message")) && res2Json.containsKey("data")) {
|
||||
JsonObject data2 = res2Json.getJsonObject("data");
|
||||
String downloadUrl = data2.getString("downloadUrl");
|
||||
if (StringUtils.isNotEmpty(downloadUrl)) {
|
||||
log.info("cow parse success: {}", downloadUrl);
|
||||
promise.complete(downloadUrl);
|
||||
}
|
||||
} else {
|
||||
log.error("cow parse fail: {}; json: {}", url2, res2Json);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
log.error("cow parse fail: {}; json: {}", key, resJson);
|
||||
}
|
||||
});
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package cn.qaiu.lz.common.util;
|
||||
package cn.qaiu.lz.common.parser.impl;
|
||||
|
||||
import cn.qaiu.lz.common.parser.IPanTool;
|
||||
import cn.qaiu.lz.common.util.CommonUtils;
|
||||
import cn.qaiu.vx.core.util.VertxHolder;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.Promise;
|
||||
@@ -13,20 +15,21 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* 移动云空间解析
|
||||
*/
|
||||
@Slf4j
|
||||
public class EcTool {
|
||||
private static final String SHARE_URL_PREFIX = "https://www.ecpan.cn/drive/fileextoverrid" +
|
||||
public class EcTool implements IPanTool {
|
||||
private static final String FIRST_REQUEST_URL = "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 final String SHARE_URL_PREFIX = "www.ecpan.cn/";
|
||||
|
||||
public static Future<String> parse(String dataKey) {
|
||||
public Future<String> parse(String data, String code) {
|
||||
String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data);
|
||||
Promise<String> promise = Promise.promise();
|
||||
WebClient client = WebClient.create(VertxHolder.getVertxInstance());
|
||||
// 第一次请求 获取文件信息
|
||||
client.getAbs(UriTemplate.of(SHARE_URL_PREFIX)).setTemplateParam("dataKey", dataKey).send().onSuccess(res -> {
|
||||
client.getAbs(UriTemplate.of(FIRST_REQUEST_URL)).setTemplateParam("dataKey", dataKey).send().onSuccess(res -> {
|
||||
JsonObject jsonObject = res.bodyAsJsonObject();
|
||||
log.debug("ecPan get file info -> {}", jsonObject);
|
||||
JsonObject fileInfo = jsonObject
|
||||
@@ -48,9 +51,7 @@ public class EcTool {
|
||||
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()));
|
||||
});
|
||||
}).onFailure(t -> promise.fail(new RuntimeException("解析异常: key = " + dataKey, t.fillInStackTrace())));
|
||||
|
||||
} else {
|
||||
promise.fail(new RuntimeException(DOWNLOAD_REQUEST_URL + " 解析失败: "
|
||||
@@ -1,5 +1,7 @@
|
||||
package cn.qaiu.lz.common.util;
|
||||
package cn.qaiu.lz.common.parser.impl;
|
||||
|
||||
import cn.qaiu.lz.common.parser.IPanTool;
|
||||
import cn.qaiu.lz.common.util.CommonUtils;
|
||||
import cn.qaiu.vx.core.util.VertxHolder;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.MultiMap;
|
||||
@@ -20,14 +22,14 @@ import java.util.regex.Pattern;
|
||||
/**
|
||||
* 亿方云
|
||||
*/
|
||||
public class FcTool {
|
||||
public class FcTool implements IPanTool {
|
||||
|
||||
public static final String SHARE_URL_PREFIX = "https://v2.fangcloud.com/sharing/";
|
||||
public static final String SHARE_URL_PREFIX2 = "https://v2.fangcloud.cn/sharing/";
|
||||
private static final String DOWN_REQUEST_URL = "https://v2.fangcloud.cn/apps/files/download?file_id={fid}" +
|
||||
"&scenario=share&unique_name={uname}";
|
||||
|
||||
public static Future<String> parse(String data, String code) {
|
||||
public Future<String> parse(String data, String code) {
|
||||
String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data);
|
||||
|
||||
Promise<String> promise = Promise.promise();
|
||||
@@ -1,5 +1,8 @@
|
||||
package cn.qaiu.lz.common.util;
|
||||
package cn.qaiu.lz.common.parser.impl;
|
||||
|
||||
import cn.qaiu.lz.common.parser.IPanTool;
|
||||
import cn.qaiu.lz.common.util.AESUtils;
|
||||
import cn.qaiu.lz.common.util.CommonUtils;
|
||||
import cn.qaiu.vx.core.util.VertxHolder;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.MultiMap;
|
||||
@@ -16,7 +19,7 @@ import java.util.UUID;
|
||||
*
|
||||
* @version V016_230609
|
||||
*/
|
||||
public class FjTool {
|
||||
public class FjTool implements IPanTool {
|
||||
|
||||
public static final String SHARE_URL_PREFIX = "https://www.feijix.com/s/";
|
||||
private static final String API_URL_PREFIX = "https://api.feijipan.com/ws/";
|
||||
@@ -27,7 +30,7 @@ public class FjTool {
|
||||
private static final String SECOND_REQUEST_URL = API_URL_PREFIX + "file/redirect?downloadId={fidEncode}&enable=1" +
|
||||
"&devType=6&uuid={uuid}×tamp={ts}&auth={auth}";
|
||||
|
||||
public static Future<String> parse(String data) {
|
||||
public Future<String> parse(String data, String code) {
|
||||
String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data);
|
||||
|
||||
Promise<String> promise = Promise.promise();
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.qaiu.lz.common.util;
|
||||
package cn.qaiu.lz.common.parser.impl;
|
||||
|
||||
import cn.qaiu.lz.common.parser.IPanTool;
|
||||
import cn.qaiu.vx.core.util.VertxHolder;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.MultiMap;
|
||||
@@ -18,11 +19,11 @@ import java.util.regex.Pattern;
|
||||
* @author QAIU
|
||||
* @version 1.0 update 2021/5/16 10:39
|
||||
*/
|
||||
public class LzTool {
|
||||
public class LzTool implements IPanTool {
|
||||
|
||||
public static final String SHARE_URL_PREFIX = "https://wwwa.lanzoui.com";
|
||||
|
||||
public static Future<String> parse(String data, String code) {
|
||||
public Future<String> parse(String data, String code) {
|
||||
Promise<String> promise = Promise.promise();
|
||||
String key = data.indexOf('/') > 0 ? data : SHARE_URL_PREFIX + "/" + data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.qaiu.lz.common.util;
|
||||
package cn.qaiu.lz.common.parser.impl;
|
||||
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.Promise;
|
||||
@@ -1,5 +1,7 @@
|
||||
package cn.qaiu.lz.common.util;
|
||||
package cn.qaiu.lz.common.parser.impl;
|
||||
|
||||
import cn.qaiu.lz.common.parser.IPanTool;
|
||||
import cn.qaiu.lz.common.util.CommonUtils;
|
||||
import cn.qaiu.vx.core.util.VertxHolder;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.Promise;
|
||||
@@ -13,7 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* 移动云空间解析
|
||||
*/
|
||||
@Slf4j
|
||||
public class UcTool {
|
||||
public class UcTool implements IPanTool {
|
||||
private static final String API_URL_PREFIX = "https://pc-api.uc.cn/1/clouddrive/";
|
||||
|
||||
public static final String SHARE_URL_PREFIX = "https://fast.uc.cn/s/";
|
||||
@@ -26,7 +28,7 @@ public class UcTool {
|
||||
|
||||
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) {
|
||||
public Future<String> parse(String data, String code) {
|
||||
var dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data);
|
||||
var passcode = (code == null) ? "" : code;
|
||||
Promise<String> promise = Promise.promise();
|
||||
@@ -1,5 +1,7 @@
|
||||
package cn.qaiu.lz.common.util;
|
||||
package cn.qaiu.lz.common.parser.impl;
|
||||
|
||||
import cn.qaiu.lz.common.parser.IPanTool;
|
||||
import cn.qaiu.lz.common.util.CommonUtils;
|
||||
import cn.qaiu.vx.core.util.VertxHolder;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.Promise;
|
||||
@@ -17,14 +19,14 @@ import java.util.regex.Pattern;
|
||||
/**
|
||||
* 123网盘
|
||||
*/
|
||||
public class YeTool {
|
||||
public class YeTool implements IPanTool {
|
||||
public static final String SHARE_URL_PREFIX = "https://www.123pan.com/s/";
|
||||
public static final String FIRST_REQUEST_URL = SHARE_URL_PREFIX + "{key}.html";
|
||||
private static final String GET_FILE_INFO_URL = "https://www.123pan.com/a/api/share/get?limit=100&next=1&orderBy" +
|
||||
"=file_name&orderDirection=asc&shareKey={shareKey}&SharePwd={pwd}&ParentFileId=0&Page=1&event" +
|
||||
"=homeListFile&operateType=1";
|
||||
|
||||
public static Future<String> parse(String data, String code) {
|
||||
public Future<String> parse(String data, String code) {
|
||||
|
||||
String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data);
|
||||
Promise<String> promise = Promise.promise();
|
||||
@@ -1,80 +0,0 @@
|
||||
package cn.qaiu.lz.common.util;
|
||||
|
||||
import cn.qaiu.vx.core.util.CastUtil;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jsoup.Jsoup;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 奶牛快传解析工具
|
||||
*
|
||||
* @author <a href="https://qaiu.top">QAIU</a>
|
||||
* @date 2023/4/21 21:19
|
||||
*/
|
||||
@Slf4j
|
||||
public class CowTool {
|
||||
/*
|
||||
First request:
|
||||
{
|
||||
"code": "0000",
|
||||
"message": "success",
|
||||
"data": {
|
||||
"guid": "e4f41b51-b5da-4f60-9312-37aa10c0aad7",
|
||||
"firstFile": {
|
||||
"id": "23861191276513345",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Then request:
|
||||
{
|
||||
"code": "0000",
|
||||
"message": "success",
|
||||
"tn": "TN:DE0E092E8A464521983780FBA21D0CD3",
|
||||
"data": {
|
||||
"downloadUrl": "https://download.cowcs.com..."
|
||||
}
|
||||
}
|
||||
*/
|
||||
public static String parse(String fullUrl) throws Exception {
|
||||
var uniqueUrl = fullUrl.substring(fullUrl.lastIndexOf('/') + 1);
|
||||
var baseUrl = "https://cowtransfer.com/core/api/transfer/share";
|
||||
var result = Jsoup
|
||||
.connect(baseUrl + "?uniqueUrl=" + uniqueUrl).ignoreContentType(true)
|
||||
.get()
|
||||
.text();
|
||||
var objectMapper = new ObjectMapper();
|
||||
Map<String, Object> map = objectMapper.readValue(result, new TypeReference<>() {
|
||||
});
|
||||
|
||||
if ("success".equals(map.get("message")) && map.containsKey("data")) {
|
||||
Map<String, Object> data = CastUtil.cast(map.get("data"));
|
||||
var guid = data.get("guid").toString();
|
||||
Map<String, Object> firstFile = CastUtil.cast(data.get("firstFile"));
|
||||
var fileId = firstFile.get("id").toString();
|
||||
var result2 = Jsoup
|
||||
.connect(baseUrl + "/download?transferGuid=" + guid + "&fileId=" + fileId)
|
||||
.ignoreContentType(true)
|
||||
.get()
|
||||
.text();
|
||||
Map<String, Object> map2 = objectMapper.readValue(result2, new TypeReference<>() {});
|
||||
|
||||
if ("success".equals(map2.get("message")) && map2.containsKey("data")) {
|
||||
Map<String, Object> data2 = CastUtil.cast(map2.get("data"));
|
||||
var downloadUrl = data2.get("downloadUrl").toString();
|
||||
if (StringUtils.isNotEmpty(downloadUrl)) {
|
||||
log.info("cow parse success: {}", downloadUrl);
|
||||
return downloadUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("Cow parse field------------->end");
|
||||
throw new Exception("Cow解析失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package cn.qaiu.lz.common.util;
|
||||
|
||||
public interface IFuturePanTool {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.qaiu.lz.web.http;
|
||||
|
||||
import cn.qaiu.lz.common.util.*;
|
||||
import cn.qaiu.lz.common.parser.IPanTool;
|
||||
import cn.qaiu.lz.common.parser.impl.*;
|
||||
import cn.qaiu.lz.web.model.SysUser;
|
||||
import cn.qaiu.lz.web.service.UserService;
|
||||
import cn.qaiu.vx.core.annotaions.RouteHandler;
|
||||
@@ -34,207 +35,50 @@ public class ServerApi {
|
||||
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(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.SHARE_URL_PREFIX)) {
|
||||
UcTool.parse(url, pwd).onSuccess(resUrl -> {
|
||||
response.putHeader("location", resUrl).setStatusCode(302).end();
|
||||
promise.complete();
|
||||
}).onFailure(t -> promise.fail(t.fillInStackTrace()));
|
||||
} else if (url.contains(FjTool.SHARE_URL_PREFIX)) {
|
||||
FjTool.parse(url).onSuccess(resUrl -> {
|
||||
response.putHeader("location", resUrl).setStatusCode(302).end();
|
||||
promise.complete();
|
||||
}).onFailure(t -> promise.fail(t.fillInStackTrace()));
|
||||
} else if (url.contains(FcTool.SHARE_URL_PREFIX)) {
|
||||
FcTool.parse(url, pwd).onSuccess(resUrl -> {
|
||||
response.putHeader("location", resUrl).setStatusCode(302).end();
|
||||
promise.complete();
|
||||
}).onFailure(t -> promise.fail(t.fillInStackTrace()));
|
||||
} else if (url.contains(YeTool.SHARE_URL_PREFIX)) {
|
||||
YeTool.parse(url, pwd).onSuccess(resUrl -> {
|
||||
response.putHeader("location", resUrl).setStatusCode(302).end();
|
||||
promise.complete();
|
||||
}).onFailure(t -> promise.fail(t.fillInStackTrace()));
|
||||
} else if (url.contains("lanzou")) {
|
||||
try {
|
||||
LzTool.parse(url, pwd).onSuccess(resUrl -> {
|
||||
response.putHeader("location", resUrl).setStatusCode(302).end();
|
||||
promise.complete();
|
||||
}).onFailure(t -> promise.fail(t.fillInStackTrace()));
|
||||
} catch (Exception e) {
|
||||
promise.fail(e);
|
||||
}
|
||||
} else if (url.contains("cowtransfer.com")) {
|
||||
String urlDownload;
|
||||
try {
|
||||
urlDownload = CowTool.parse(url);
|
||||
response.putHeader("location", urlDownload).setStatusCode(302).end();
|
||||
promise.complete();
|
||||
} catch (Exception e) {
|
||||
promise.fail(e);
|
||||
}
|
||||
|
||||
Promise<Void> promise = Promise.promise();
|
||||
if (url.contains(EcTool.SHARE_URL_PREFIX)) {
|
||||
// 默认读取Url参数会被截断手动获取一下其他参数
|
||||
url = EcTool.SHARE_URL_PREFIX + request.getParam("data");
|
||||
}
|
||||
try {
|
||||
IPanTool.shareURLPrefixMatching(url).parse(url, pwd).onSuccess(resUrl -> {
|
||||
response.putHeader("location", resUrl).setStatusCode(302).end();
|
||||
promise.complete();
|
||||
}).onFailure(t -> promise.fail(t.fillInStackTrace()));
|
||||
} catch (Exception e) {
|
||||
promise.fail(e);
|
||||
}
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
@RouteMapping(value = "/lz/:id", method = RouteMethod.GET)
|
||||
public void lzParse(HttpServerResponse response, String id) {
|
||||
|
||||
@RouteMapping(value = "/:type/:id", method = RouteMethod.GET)
|
||||
public void YeParse(HttpServerResponse response, String type, String id) {
|
||||
String code = "";
|
||||
if (id.contains("@")) {
|
||||
String[] ids = id.split("@");
|
||||
id = ids[0];
|
||||
code = ids[1];
|
||||
}
|
||||
LzTool.parse(id, code).onSuccess(resUrl -> response.putHeader("location", resUrl)
|
||||
|
||||
IPanTool.typeMatching(type).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/lz/:id", method = RouteMethod.GET)
|
||||
public Future<String> lzParseJson(HttpServerResponse response, String id) {
|
||||
@RouteMapping(value = "/json/:type/:id", method = RouteMethod.GET)
|
||||
public Future<String> YeParseJson(HttpServerResponse response, String type, String id) {
|
||||
String code = "";
|
||||
if (id.contains("@")) {
|
||||
String[] ids = id.split("@");
|
||||
id = ids[0];
|
||||
code = ids[1];
|
||||
}
|
||||
return LzTool.parse(id, code);
|
||||
}
|
||||
|
||||
@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/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);
|
||||
}
|
||||
|
||||
@RouteMapping(value = "/fj/:id", method = RouteMethod.GET)
|
||||
public void fjParse(HttpServerResponse response, String id) {
|
||||
FjTool.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/fj/:id", method = RouteMethod.GET)
|
||||
public Future<String> fjParseJson(HttpServerResponse response, String id) {
|
||||
return FjTool.parse(id);
|
||||
}
|
||||
|
||||
@RouteMapping(value = "/fc/:id", method = RouteMethod.GET)
|
||||
public void fcParse(HttpServerResponse response, String id) {
|
||||
String code = "";
|
||||
if (id.contains("@")) {
|
||||
String[] ids = id.split("@");
|
||||
id = ids[0];
|
||||
code = ids[1];
|
||||
}
|
||||
FcTool.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/fc/:id", method = RouteMethod.GET)
|
||||
public Future<String> fcParseJson(HttpServerResponse response, String id) {
|
||||
String code = "";
|
||||
if (id.contains("@")) {
|
||||
String[] ids = id.split("@");
|
||||
id = ids[0];
|
||||
code = ids[1];
|
||||
}
|
||||
return FcTool.parse(id, code);
|
||||
}
|
||||
|
||||
@RouteMapping(value = "/ye/:id", method = RouteMethod.GET)
|
||||
public void YeParse(HttpServerResponse response, String id) {
|
||||
String code = "";
|
||||
if (id.contains("@")) {
|
||||
String[] ids = id.split("@");
|
||||
id = ids[0];
|
||||
code = ids[1];
|
||||
}
|
||||
YeTool.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/ye/:id", method = RouteMethod.GET)
|
||||
public Future<String> YeParseJson(HttpServerResponse response, String id) {
|
||||
String code = "";
|
||||
if (id.contains("@")) {
|
||||
String[] ids = id.split("@");
|
||||
id = ids[0];
|
||||
code = ids[1];
|
||||
}
|
||||
return YeTool.parse(id, code);
|
||||
return IPanTool.typeMatching(type).parse(id, code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
###
|
||||
//https://cowtransfer.com/s/9a644fe3e3a748
|
||||
//https://cowtransfer.com/s/e4f41b51b5da4f
|
||||
|
||||
https://cowtransfer.com/core/api/transfer/share?uniqueUrl=9a644fe3e3a748
|
||||
|
||||
|
||||
@@ -10,9 +10,10 @@ GET http://127.0.0.1:6400/parser?url=https://lanzoux.com/iNvid035jgcb
|
||||
###
|
||||
# @no-redirect
|
||||
GET http://127.0.0.1:6400/parser?url=https://cowtransfer.com/s/9a644fe3e3a748
|
||||
|
||||
###
|
||||
# @no-redirect
|
||||
GET http://127.0.0.1:6400/cow/9a644fe3e3a748
|
||||
GET http://127.0.0.1:6400/cow/e4f41b51b5da4f
|
||||
|
||||
###
|
||||
# @no-redirect
|
||||
@@ -99,3 +100,6 @@ GET http://127.0.0.1:6400/ye/iaKtVv-qOECd@asdads
|
||||
### 123
|
||||
# @no-redirect
|
||||
GET http://127.0.0.1:6400/parser?url=https://www.123pan.com/s/iaKtVv-6OECd.html&pwd=DcGe
|
||||
|
||||
###
|
||||
POST http://127.0.0.1:6400/login1
|
||||
|
||||
Reference in New Issue
Block a user