Skip to content

Commit

Permalink
1. add:123云盘的新域名
Browse files Browse the repository at this point in the history
2. update: 统计API支持ce盘
3. 缓存时长
  • Loading branch information
qaiu committed Oct 1, 2024
1 parent d8666ac commit 088fee9
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 19 deletions.
2 changes: 1 addition & 1 deletion parser/src/main/java/cn/qaiu/parser/PanDomainTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public enum PanDomainTemplate {
WsTool.class),
// https://www.123pan.com/s/
YE("123网盘",
"https://www\\.123pan\\.com/s/(.+)",
"https://www\\.(123pan|123865|123684)\\.com/s/(.+)",
"https://www.123pan.com/s/{shareKey}",
YeTool.class),
// https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data={code}&isShare=1
Expand Down
24 changes: 23 additions & 1 deletion parser/src/main/java/cn/qaiu/parser/ParserCreate.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public ParserCreate normalizeShareLink() {
String standardUrl = getStandardUrlTemplate().replace("{shareKey}", shareKey);
shareLinkInfo.setShareUrl(shareUrl);
shareLinkInfo.setShareKey(shareKey);
shareLinkInfo.setStandardUrl(standardUrl);
if (!(panDomainTemplate == PanDomainTemplate.CE)) {
shareLinkInfo.setStandardUrl(standardUrl);
}
return this;
}
throw new IllegalArgumentException("Invalid share URL for " + this.panDomainTemplate.getDisplayName());
Expand Down Expand Up @@ -101,6 +103,9 @@ public synchronized static ParserCreate fromShareUrl(String shareUrl) {
.type(panDomainTemplate.name().toLowerCase())
.panName(panDomainTemplate.getDisplayName())
.shareUrl(shareUrl).build();
if (panDomainTemplate == PanDomainTemplate.CE) {
shareLinkInfo.setStandardUrl(shareUrl);
}
ParserCreate parserCreate = new ParserCreate(panDomainTemplate, shareLinkInfo);
return parserCreate.normalizeShareLink();
}
Expand All @@ -120,4 +125,21 @@ public synchronized static ParserCreate fromType(String type) {
throw new IllegalArgumentException("No enum constant for type name: " + type);
}
}

// 生成parser短链path(不包含domainName)
public String genPathSuffix() {

String path;
if (panDomainTemplate == PanDomainTemplate.CE) {
// 处理Cloudreve(ce)类: pan.huang1111.cn_s_wDz5TK _ -> /
path = this.shareLinkInfo.getType() + "/"
+ this.shareLinkInfo.getShareUrl()
.substring("https://".length()).replace("/", "_");
} else {
path = this.shareLinkInfo.getType() + "/" + this.shareLinkInfo.getShareKey();
}
String sharePassword = this.shareLinkInfo.getSharePassword();
return path + (StringUtils.isBlank(sharePassword) ? "" : ("@" + sharePassword));
}

}
4 changes: 0 additions & 4 deletions web-front/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
content="Netdisk fast download,网盘直链解析工具">
<meta name="description"
content="Netdisk fast download 网盘直链解析工具">
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
<script>LA.init({id:"K8zkCkZMgFA6ShZK",ck:"K8zkCkZMgFA6ShZK"})</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9851170484804006"
crossorigin="anonymous"></script>
<style>
.page-loading-wrap {
padding: 120px;
Expand Down
16 changes: 6 additions & 10 deletions web-service/src/main/java/cn/qaiu/lz/web/controller/ParserApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
import cn.qaiu.vx.core.annotaions.RouteMapping;
import cn.qaiu.vx.core.enums.RouteMethod;
import cn.qaiu.vx.core.util.AsyncServiceUtil;
import cn.qaiu.vx.core.util.ResponseUtil;
import cn.qaiu.vx.core.util.SharedDataUtil;
import io.vertx.core.Future;
import io.vertx.core.Promise;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.core.net.HostAndPort;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

Expand Down Expand Up @@ -48,10 +45,11 @@ public Future<StatisticsInfo> statisticsInfo() {
public Future<LinkInfoResp> parse(HttpServerRequest request, String pwd) {
Promise<LinkInfoResp> promise = Promise.promise();
String url = URLParamUtil.parserParams(request);
ShareLinkInfo shareLinkInfo = ParserCreate.fromShareUrl(url).setShareLinkInfoPwd(pwd).getShareLinkInfo();
ParserCreate parserCreate = ParserCreate.fromShareUrl(url).setShareLinkInfoPwd(pwd);
ShareLinkInfo shareLinkInfo = parserCreate.getShareLinkInfo();
LinkInfoResp build = LinkInfoResp.builder()
.downLink(getDownLink(shareLinkInfo, false))
.apiLink(getDownLink(shareLinkInfo, true))
.downLink(getDownLink(parserCreate, false))
.apiLink(getDownLink(parserCreate, true))
.shareLinkInfo(shareLinkInfo).build();
// 解析次数统计
cacheManager.getShareKeyTotal(shareLinkInfo.getCacheKey()).onSuccess(res -> {
Expand All @@ -68,16 +66,14 @@ public Future<LinkInfoResp> parse(HttpServerRequest request, String pwd) {
return promise.future();
}

private static String getDownLink(ShareLinkInfo shareLinkInfo, boolean isJson) {
private static String getDownLink(ParserCreate create, boolean isJson) {

String linkPrefix = SharedDataUtil.getJsonConfig("server")
.getString("domainName");
if (StringUtils.isBlank(linkPrefix)) {
linkPrefix = "http://127.0.0.1";
}
String pwd = shareLinkInfo.getSharePassword();
return linkPrefix + (isJson ? "/json/" : "/") + shareLinkInfo.getType() + "/" + shareLinkInfo.getShareKey() +
(StringUtils.isBlank(pwd) ? "" : ("@" + pwd));
return linkPrefix + (isJson ? "/json/" : "/") + create.genPathSuffix();
}

}
4 changes: 2 additions & 2 deletions web-service/src/main/resources/app-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ cache:
cow:
ec:
fc:
fj:
iz:
fj: 30
iz: 20
le: 2879
lz:
qq: 999999
Expand Down
7 changes: 6 additions & 1 deletion web-service/src/main/resources/http-tools/test.http
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ GET http://127.0.0.1:6400/ye/Ev1lVv-t3SY3
# @no-redirect
GET http://127.0.0.1:6400/json/parser?url=https://www.123pan.com/s/iaKtVv-6OECd.html&pwd=DcGe

### 123 PASS https://www.123865.com/s/iaKtVv-6OECd.html
# @no-redirect
GET http://127.0.0.1:6400/json/parser?url=https://www.123865.com/s/iaKtVv-6OECd.html&pwd=DcGe

### 123
# @no-redirect
Expand Down Expand Up @@ -164,7 +167,9 @@ GET http://127.0.0.1:6400/json/parser?url=https://iwx.mail.qq.com/ftn/download?f
GET http://127.0.0.1:6400/v2/statisticsInfo

###
GET http://127.0.0.1:6400/v2/linkInfo?url=https://www.123pan.com/s/iaKtVv-6OECd.html&pwd=DcGe
GET http://127.0.0.1:6400/v2/linkInfo?url=https://www.123865.com/s/iaKtVv-6OECd.html&pwd=DcGe
###
GET http://127.0.0.1:6400/v2/linkInfo?url=https://pan.seeoss.com/s/nLNsQ&pwd=DcGe

###
POST http://127.0.0.1:6400/v2/login?username=asd
Expand Down

0 comments on commit 088fee9

Please sign in to comment.