Skip to content

Commit 088fee9

Browse files
committed
1. add:123云盘的新域名
2. update: 统计API支持ce盘 3. 缓存时长
1 parent d8666ac commit 088fee9

File tree

6 files changed

+38
-19
lines changed

6 files changed

+38
-19
lines changed

parser/src/main/java/cn/qaiu/parser/PanDomainTemplate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public enum PanDomainTemplate {
5757
WsTool.class),
5858
// https://www.123pan.com/s/
5959
YE("123网盘",
60-
"https://www\\.123pan\\.com/s/(.+)",
60+
"https://www\\.(123pan|123865|123684)\\.com/s/(.+)",
6161
"https://www.123pan.com/s/{shareKey}",
6262
YeTool.class),
6363
// https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data={code}&isShare=1

parser/src/main/java/cn/qaiu/parser/ParserCreate.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public ParserCreate normalizeShareLink() {
4242
String standardUrl = getStandardUrlTemplate().replace("{shareKey}", shareKey);
4343
shareLinkInfo.setShareUrl(shareUrl);
4444
shareLinkInfo.setShareKey(shareKey);
45-
shareLinkInfo.setStandardUrl(standardUrl);
45+
if (!(panDomainTemplate == PanDomainTemplate.CE)) {
46+
shareLinkInfo.setStandardUrl(standardUrl);
47+
}
4648
return this;
4749
}
4850
throw new IllegalArgumentException("Invalid share URL for " + this.panDomainTemplate.getDisplayName());
@@ -101,6 +103,9 @@ public synchronized static ParserCreate fromShareUrl(String shareUrl) {
101103
.type(panDomainTemplate.name().toLowerCase())
102104
.panName(panDomainTemplate.getDisplayName())
103105
.shareUrl(shareUrl).build();
106+
if (panDomainTemplate == PanDomainTemplate.CE) {
107+
shareLinkInfo.setStandardUrl(shareUrl);
108+
}
104109
ParserCreate parserCreate = new ParserCreate(panDomainTemplate, shareLinkInfo);
105110
return parserCreate.normalizeShareLink();
106111
}
@@ -120,4 +125,21 @@ public synchronized static ParserCreate fromType(String type) {
120125
throw new IllegalArgumentException("No enum constant for type name: " + type);
121126
}
122127
}
128+
129+
// 生成parser短链path(不包含domainName)
130+
public String genPathSuffix() {
131+
132+
String path;
133+
if (panDomainTemplate == PanDomainTemplate.CE) {
134+
// 处理Cloudreve(ce)类: pan.huang1111.cn_s_wDz5TK _ -> /
135+
path = this.shareLinkInfo.getType() + "/"
136+
+ this.shareLinkInfo.getShareUrl()
137+
.substring("https://".length()).replace("/", "_");
138+
} else {
139+
path = this.shareLinkInfo.getType() + "/" + this.shareLinkInfo.getShareKey();
140+
}
141+
String sharePassword = this.shareLinkInfo.getSharePassword();
142+
return path + (StringUtils.isBlank(sharePassword) ? "" : ("@" + sharePassword));
143+
}
144+
123145
}

web-front/public/index.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
content="Netdisk fast download,网盘直链解析工具">
1010
<meta name="description"
1111
content="Netdisk fast download 网盘直链解析工具">
12-
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
13-
<script>LA.init({id:"K8zkCkZMgFA6ShZK",ck:"K8zkCkZMgFA6ShZK"})</script>
14-
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9851170484804006"
15-
crossorigin="anonymous"></script>
1612
<style>
1713
.page-loading-wrap {
1814
padding: 120px;

web-service/src/main/java/cn/qaiu/lz/web/controller/ParserApi.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@
1414
import cn.qaiu.vx.core.annotaions.RouteMapping;
1515
import cn.qaiu.vx.core.enums.RouteMethod;
1616
import cn.qaiu.vx.core.util.AsyncServiceUtil;
17-
import cn.qaiu.vx.core.util.ResponseUtil;
1817
import cn.qaiu.vx.core.util.SharedDataUtil;
1918
import io.vertx.core.Future;
2019
import io.vertx.core.Promise;
2120
import io.vertx.core.http.HttpServerRequest;
22-
import io.vertx.core.http.HttpServerResponse;
23-
import io.vertx.core.net.HostAndPort;
2421
import lombok.extern.slf4j.Slf4j;
2522
import org.apache.commons.lang3.StringUtils;
2623

@@ -48,10 +45,11 @@ public Future<StatisticsInfo> statisticsInfo() {
4845
public Future<LinkInfoResp> parse(HttpServerRequest request, String pwd) {
4946
Promise<LinkInfoResp> promise = Promise.promise();
5047
String url = URLParamUtil.parserParams(request);
51-
ShareLinkInfo shareLinkInfo = ParserCreate.fromShareUrl(url).setShareLinkInfoPwd(pwd).getShareLinkInfo();
48+
ParserCreate parserCreate = ParserCreate.fromShareUrl(url).setShareLinkInfoPwd(pwd);
49+
ShareLinkInfo shareLinkInfo = parserCreate.getShareLinkInfo();
5250
LinkInfoResp build = LinkInfoResp.builder()
53-
.downLink(getDownLink(shareLinkInfo, false))
54-
.apiLink(getDownLink(shareLinkInfo, true))
51+
.downLink(getDownLink(parserCreate, false))
52+
.apiLink(getDownLink(parserCreate, true))
5553
.shareLinkInfo(shareLinkInfo).build();
5654
// 解析次数统计
5755
cacheManager.getShareKeyTotal(shareLinkInfo.getCacheKey()).onSuccess(res -> {
@@ -68,16 +66,14 @@ public Future<LinkInfoResp> parse(HttpServerRequest request, String pwd) {
6866
return promise.future();
6967
}
7068

71-
private static String getDownLink(ShareLinkInfo shareLinkInfo, boolean isJson) {
69+
private static String getDownLink(ParserCreate create, boolean isJson) {
7270

7371
String linkPrefix = SharedDataUtil.getJsonConfig("server")
7472
.getString("domainName");
7573
if (StringUtils.isBlank(linkPrefix)) {
7674
linkPrefix = "http://127.0.0.1";
7775
}
78-
String pwd = shareLinkInfo.getSharePassword();
79-
return linkPrefix + (isJson ? "/json/" : "/") + shareLinkInfo.getType() + "/" + shareLinkInfo.getShareKey() +
80-
(StringUtils.isBlank(pwd) ? "" : ("@" + pwd));
76+
return linkPrefix + (isJson ? "/json/" : "/") + create.genPathSuffix();
8177
}
8278

8379
}

web-service/src/main/resources/app-dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ cache:
5353
cow:
5454
ec:
5555
fc:
56-
fj:
57-
iz:
56+
fj: 30
57+
iz: 20
5858
le: 2879
5959
lz:
6060
qq: 999999

web-service/src/main/resources/http-tools/test.http

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ GET http://127.0.0.1:6400/ye/Ev1lVv-t3SY3
111111
# @no-redirect
112112
GET http://127.0.0.1:6400/json/parser?url=https://www.123pan.com/s/iaKtVv-6OECd.html&pwd=DcGe
113113

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

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

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

169174
###
170175
POST http://127.0.0.1:6400/v2/login?username=asd

0 commit comments

Comments
 (0)