-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
182 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
app.version=${project.version} | ||
build=${maven.build.timestamp} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters