mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 12:23:03 +00:00
城通分享格式适配, 优化日志打印
This commit is contained in:
@@ -9,15 +9,25 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.ext.web.client.HttpRequest;
|
||||
import io.vertx.uritemplate.UriTemplate;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <a href="https://www.ctfile.com">诚通网盘</a>
|
||||
*/
|
||||
public class CtTool extends PanBase {
|
||||
private static final String API_URL_PREFIX = "https://webapi.ctfile.com";
|
||||
|
||||
private static final String API1 = API_URL_PREFIX + "/getfile.php?path=file" +
|
||||
// https://webapi.ctfile.com/getfile.php?path=f&f=55050874-1246660795-6464f6&
|
||||
// passcode=7548&token=30wiijxs1fzhb6brw0p9m6&r=0.5885881231735761&
|
||||
// ref=&url=https%3A%2F%2F474b.com%2Ff%2F55050874-1246660795-6464f6%3Fp%3D7548
|
||||
private static final String API1 = API_URL_PREFIX + "/getfile.php?path={path}" +
|
||||
"&f={shareKey}&passcode={pwd}&token={token}&r={rand}&ref=";
|
||||
|
||||
//https://webapi.ctfile.com/get_file_url.php?uid=55050874&fid=1246660795&folder_id=0&
|
||||
// file_chk=054bc20461f5c63ff82015b9e69fb7fc&mb=1&token=30wiijxs1fzhb6brw0p9m6&app=0&
|
||||
// acheck=1&verifycode=&rd=0.965929071503574
|
||||
private static final String API2 = API_URL_PREFIX + "/get_file_url.php?" +
|
||||
"uid={uid}&fid={fid}&folder_id=0&file_chk={file_chk}&mb=0&token={token}&app=0&acheck=0&verifycode=" +
|
||||
"&rd={rand}";
|
||||
@@ -49,8 +59,13 @@ public class CtTool extends PanBase {
|
||||
String[] split = shareKey.split("-");
|
||||
String uid = split[0], fid = split[1];
|
||||
String token = RandomStringGenerator.generateRandomString();
|
||||
// 获取url path
|
||||
int i1 = shareLinkInfo.getShareUrl().indexOf("com/");
|
||||
int i2 = shareLinkInfo.getShareUrl().lastIndexOf("/");
|
||||
String path = shareLinkInfo.getShareUrl().substring(i1 + 4, i2);
|
||||
|
||||
HttpRequest<Buffer> bufferHttpRequest1 = clientSession.getAbs(UriTemplate.of(API1))
|
||||
.setTemplateParam("path", path)
|
||||
.setTemplateParam("shareKey", shareKey)
|
||||
.setTemplateParam("pwd", shareLinkInfo.getSharePassword())
|
||||
.setTemplateParam("token", token)
|
||||
@@ -79,10 +94,10 @@ public class CtTool extends PanBase {
|
||||
}
|
||||
}).onFailure(handleFail(bufferHttpRequest1.queryParams().toString()));
|
||||
} else {
|
||||
fail("解析失败, 可能分享已失效: json: {} 字段 {} 不存在", resJson, "file_chk");
|
||||
fail("解析失败, file_chk找不到, 可能分享已失效或者分享密码不对: {}", fileJson);
|
||||
}
|
||||
} else {
|
||||
fail("解析失败, 可能分享已失效: json: {} 字段 {} 不存在", resJson, "file");
|
||||
fail("解析失败, 文件信息为空, 可能分享已失效");
|
||||
}
|
||||
}).onFailure(handleFail(bufferHttpRequest1.queryParams().toString()));
|
||||
return promise.future();
|
||||
|
||||
Reference in New Issue
Block a user