mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 20:33:03 +00:00
add 超星盘,360盘
This commit is contained in:
@@ -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("网易云音乐分享",
|
||||
|
||||
109
parser/src/main/java/cn/qaiu/parser/impl/P360Tool.java
Normal file
109
parser/src/main/java/cn/qaiu/parser/impl/P360Tool.java
Normal file
@@ -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
parser/src/main/java/cn/qaiu/parser/impl/PcxTool.java
Normal file
47
parser/src/main/java/cn/qaiu/parser/impl/PcxTool.java
Normal file
@@ -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);
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user