Skip to content

Commit

Permalink
add 超星盘,360盘
Browse files Browse the repository at this point in the history
  • Loading branch information
qaiu committed Feb 22, 2025
1 parent fece279 commit 01d59e3
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ main分支依赖JDK17, 提供了JDK11分支[main-jdk11](https://github.com/qaiu/
- [QQ音乐分享链接-mqqs](https://y.qq.com)
- 咪咕音乐分享链接(开发中)
- [Cloudreve自建网盘-ce](https://github.com/cloudreve/Cloudreve)
- [微雨云存储-pvvy](https://www.vyuyun.com/)
- ~[微雨云存储-pvvy](https://www.vyuyun.com/)~
- [超星云盘(需要referer: https://pan-yz.chaoxing.com)-pcx](https://pan-yz.chaoxing.com)
- [360云盘(需要referer: https://link.yunpan.com/)-pcx](https://yunpan.com)
- Google云盘-pgd
- Onedrive-pod
- Dropbox-pdp
Expand Down
1 change: 1 addition & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.build.timestamp.format>yyMMdd_HHmm</maven.build.timestamp.format>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/cn/qaiu/vx/core/util/CommonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static String getAppVersion() {
try {
properties.load(CommonUtil.class.getClassLoader().getResourceAsStream("app.properties"));
if (!properties.isEmpty()) {
appVersion = properties.getProperty("app.version");
appVersion = properties.getProperty("app.version") + "build" + properties.getProperty("build");
}
} catch (IOException e) {
e.printStackTrace();
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/app.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
app.version=${project.version}
build=${maven.build.timestamp}
11 changes: 11 additions & 0 deletions parser/src/main/java/cn/qaiu/parser/PanDomainTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@ public enum PanDomainTemplate {
compile("https://(115|anxia).com/s/(?<KEY>\\w+)(\\?password=(?<PWD>\\w+))?([&#].*)?"),
"https://115.com/s/{shareKey}?password={pwd}",
P115Tool.class),
// 链接:https://www.yunpan.com/surl_yD7wz4VgU9v(提取码:fc70)
P360("360云盘(需要referer头)",
compile("https://www\\.yunpan\\.com/(?<KEY>\\w+)"),
"https://www.yunpan.com/{shareKey}",
P360Tool.class),

// https://pan-yz.cldisk.com/external/m/file/953658049102462976
Pcx("超星云盘(需要referer头)",
compile("https://pan-yz\\.cldisk\\.com/external/m/file/(?<KEY>\\w+)"),
"https://pan-yz.cldisk.com/external/m/file/{shareKey}",
PcxTool.class),
// =====================音乐类解析 分享链接标志->MxxS (单歌曲/普通音质)==========================
// http://163cn.tv/xxx
MNES("网易云音乐分享",
Expand Down
109 changes: 109 additions & 0 deletions parser/src/main/java/cn/qaiu/parser/impl/P360Tool.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
package cn.qaiu.parser.impl;

import cn.qaiu.entity.ShareLinkInfo;
import cn.qaiu.parser.PanBase;
import io.vertx.core.Future;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.json.JsonObject;

import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* <a href="https://yunpan.360.cn">360AI云盘</a>
* 360AI云盘解析
* 下载链接需要Referer: https://link.yunpan.com/
*/
public class P360Tool extends PanBase {
public P360Tool(ShareLinkInfo shareLinkInfo) {
super(shareLinkInfo);
}

public Future<String> parse() {
// https://www.yunpan.com/surl_yD7jK9d4W6D 获取302跳转地址
clientNoRedirects.getAbs(shareLinkInfo.getShareUrl()).send()
.onSuccess(res -> {
String location = res.getHeader("Location");
if (location != null) {
down302(location);
} else {
fail();
}
}).onFailure(handleFail(""));


return future();
}

private void down302(String url) {
// 获取URL前缀 https://214004.link.yunpan.com/lk/surl_yD7ZU4WreR8 -> https://214004.link.yunpan.com/
String urlPrefix = url.substring(0, url.indexOf("/", 8));

clientSession.getAbs(url)
.send()
.onSuccess(res -> {
// find "nid": "17402043311959599"
Pattern compile = Pattern.compile("\"nid\": \"([^\"]+)\"");
Matcher matcher = compile.matcher(res.bodyAsString());
AtomicReference<String> nid = new AtomicReference<>();
if (matcher.find()) {
nid.set(matcher.group(1));
} else {
// 需要验证密码
/*
* POST https://4aec17.link.yunpan.com/share/verifyPassword
* Content-type: application/x-www-form-urlencoded UTF-8
* Referer: https://4aec17.link.yunpan.com/lk/surl_yD7jK9d4W6D
*
* shorturl=surl_yD7jK9d4W6D&linkpassword=d969
*/
clientSession.postAbs(urlPrefix + "/share/verifyPassword")
.putHeader("Content-Type", "application/x-www-form-urlencoded")
.putHeader("Referer", urlPrefix)
.sendBuffer(Buffer.buffer("shorturl=" + shareLinkInfo.getShareKey() + "&linkpassword" +
"=" + shareLinkInfo.getSharePassword()))
.onSuccess(res2 -> {
JsonObject entries = asJson(res2);
if (entries.getInteger("errno") == 0) {
clientSession.getAbs(url)
.send()
.onSuccess(res3 -> {
Matcher matcher1 = compile.matcher(res3.bodyAsString());
if (matcher1.find()) {
nid.set(matcher1.group(1));
} else {
fail();
return;
}
down(urlPrefix, nid.get());
}).onFailure(handleFail(""));
} else {
fail(entries.encode());
}
}).onFailure(handleFail(""));
return;
}
down(urlPrefix, nid.get());
}).onFailure(handleFail(""));
}

private void down(String urlPrefix, String nid) {
clientSession.postAbs(urlPrefix + "/share/downloadfile")
.putHeader("Content-Type", "application/x-www-form-urlencoded")
.putHeader("Referer", urlPrefix)
.sendBuffer(Buffer.buffer("shorturl=" + shareLinkInfo.getShareKey() + "&nid=" + nid))
.onSuccess(res2 -> {
JsonObject entries = asJson(res2);
String downloadurl = entries.getJsonObject("data").getString("downloadurl");
complete(downloadurl);
}).onFailure(handleFail(""));
}

// public static void main(String[] args) {
// String s = new P360Tool(ShareLinkInfo.newBuilder().shareUrl("https://www.yunpan.com/surl_yD7ZU4WreR8")
// .shareKey("surl_yD7ZU4WreR8")
// .build()).parseSync();
// System.out.println(s);
// }
}
47 changes: 47 additions & 0 deletions parser/src/main/java/cn/qaiu/parser/impl/PcxTool.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package cn.qaiu.parser.impl;

import cn.qaiu.entity.ShareLinkInfo;
import cn.qaiu.parser.PanBase;
import io.vertx.core.Future;
import io.vertx.core.MultiMap;
import io.vertx.core.json.JsonObject;
import io.vertx.uritemplate.UriTemplate;

/**
* <a href="https://passport2.chaoxing.com">超星云盘</a>
*/
public class PcxTool extends PanBase {

public PcxTool(ShareLinkInfo shareLinkInfo) {
super(shareLinkInfo);
}

public Future<String> parse() {
client.getAbs(shareLinkInfo.getShareUrl())
.send().onSuccess(res -> {
// 'download': 'https://d0.ananas.chaoxing.com/download/de08dcf546e4dd88a17bead86ff6338d?at_=1740211698795&ak_=d62a3acbd5ce43e1e8565b67990691e4&ad_=8c4ef22e980ee0dd9532ec3757ab19f8&fn=33.c'
String body = res.bodyAsString();
// 获取download
String str = "var fileinfo = {";
String fileInfo = res.bodyAsString().substring(res.bodyAsString().indexOf(str) + str.length() - 1
, res.bodyAsString().indexOf("};") + 1);
fileInfo = fileInfo.replace("'", "\"");
JsonObject jsonObject = new JsonObject(fileInfo);
String download = jsonObject.getString("download");
if (download.contains("fn=")) {
complete(download);
} else {
fail("获取下载链接失败: 不支持的文件类型: {}", jsonObject.getString("suffix"));
}
}).onFailure(handleFail(shareLinkInfo.getShareUrl()));
return promise.future();
}


// public static void main(String[] args) {
// String s = new PcxTool(ShareLinkInfo.newBuilder().shareUrl("https://pan-yz.cldisk.com/external/m/file/953658049102462976")
// .shareKey("953658049102462976")
// .build()).parseSync();
// System.out.println(s);
// }
}
10 changes: 9 additions & 1 deletion web-service/src/main/resources/http-tools/pan-cx.http
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

### 直链 Referer 有效期似乎是永久 at=1717958244333 => 2024/6/10 2:37:24
https://d0.ananas.chaoxing.com/download/8e8c9baca640d24680d974331390a158?at_=1717958244333&ak_=783925f9ba6eb2d0c711977b777a13e0&ad_=58ffecd38be494bea68f0cda68b18c0a&fn=testgles.c
Referer: https://pan-yz.chaoxing.com/external/m/file/1006748113111711744
Referer: https://pan-yz.chaoxing.com/



###
https://d0.ananas.chaoxing.com/download/ecf45b6d85a7e9d9d5f5ef33978c6f74?at_=1731411454916&ak_=12108e79795e73c6df0a75f5ea60fe2c&ad_=b6c289da3c6f6734b2262e8577364213
Referer: https://pan-yz.chaoxing.com/external/m/file/1006748113111711744

###
https://d0.ananas.chaoxing.com/download/3fe3ba9f6f2d1e9926b924c8268ca67d?at_=1740211468281&ak_=cc853b465206569f98a257674f8595a4&ad_=b5c27a9d86c298abc11220290a7dfde9&fn=wx_camera_1705290447091.jpg
Referer: https://pan-yz.chaoxing.com/

###
https://d0.ananas.chaoxing.com/download/8664a0b97110b49ca9e3ad024544649e?at_=1740211468281&ak_=cc853b465206569f98a257674f8595a4&ad_=b5c27a9d86c298abc11220290a7dfde9&fn=jdk17-jre-win-amd64.zip
Referer: https://pan-yz.chaoxing.com/

0 comments on commit 01d59e3

Please sign in to comment.