1. add iCloud解析

This commit is contained in:
QAIU
2024-11-04 14:18:56 +08:00
parent 82ec586554
commit 8269673619
5 changed files with 109 additions and 6 deletions

View File

@@ -1,5 +1,7 @@
package cn.qaiu.entity;
import java.util.Map;
public class FileInfo {
/**
@@ -12,6 +14,16 @@ public class FileInfo {
*/
String fileId;
/**
* 文件大小(byte)
*/
Long size;
/**
* MIME类型
*/
String fileMIME;
/**
* 文件路径
*/
@@ -38,9 +50,9 @@ public class FileInfo {
Integer downloadCount;
/**
* 评论信息
* 扩展参数
*/
String comments;
Map<String, Object> extParameters;
public String getFileName() {
return fileName;
@@ -60,6 +72,24 @@ public class FileInfo {
return this;
}
public Long getSize() {
return size;
}
public FileInfo setSize(Long size) {
this.size = size;
return this;
}
public String getFileMIME() {
return fileMIME;
}
public FileInfo setFileMIME(String fileMIME) {
this.fileMIME = fileMIME;
return this;
}
public String getFilePath() {
return filePath;
}
@@ -105,12 +135,12 @@ public class FileInfo {
return this;
}
public String getComments() {
return comments;
public Map<String, Object> getExtParameters() {
return extParameters;
}
public FileInfo setComments(String comments) {
this.comments = comments;
public FileInfo setExtParameters(Map<String, Object> extParameters) {
this.extParameters = extParameters;
return this;
}
}

View File

@@ -104,6 +104,11 @@ public enum PanDomainTemplate {
compile("https://drive\\.google\\.com/file/d/(?<KEY>.+)/view(\\?usp=(sharing|drive_link))?"),
"https://drive.google.com/file/d/{shareKey}/view?usp=sharing",
PgdTool.class),
// iCloud https://www.icloud.com.cn/iclouddrive/xxx#fonts
PIC("iCloud",
compile("https://www\\.icloud\\.com\\.cn/iclouddrive/(?<KEY>[a-z_A-Z\\d-=]+)(#(.+))?"),
"https://www.icloud.com.cn/iclouddrive/{shareKey}",
PicTool.class),
// =====================音乐类解析 分享链接标志->MxxS (单歌曲/普通音质)==========================
// http://163cn.tv/xxx

View File

@@ -0,0 +1,58 @@
package cn.qaiu.parser.impl;
import cn.qaiu.entity.ShareLinkInfo;
import cn.qaiu.parser.PanBase;
import io.vertx.core.Future;
import io.vertx.core.json.JsonObject;
/**
* <a href="https://www.icloud.com.cn/">iCloud云盘(pic)</a>
*/
public class PicTool extends PanBase {
private static final String api = "https://ckdatabasews.icloud.com.cn/database/1/com.apple.cloudkit/production/public/records/resolve";
public PicTool(ShareLinkInfo shareLinkInfo) {
super(shareLinkInfo);
}
public Future<String> parse() {
// {"shortGUIDs":[{"value":"xxx"}]}
JsonObject jsonObject =
new JsonObject("{\"shortGUIDs\":[{\"value\":\"%s\"}]}".formatted(shareLinkInfo.getShareKey()));
client.postAbs(api).sendJsonObject(jsonObject).onSuccess(res -> {
// results->rootRecord->fields->fileContent->value->downloadURL // ${f}->fileName
// fileName: results->share->fields->cloudkit.title->value + "." + results->rootRecord->fields->extension->value
JsonObject json = asJson(res);
try {
JsonObject result = json.getJsonArray("results").getJsonObject(0);
JsonObject fileInfo = result
.getJsonObject("rootRecord")
.getJsonObject("fields");
String downURL = fileInfo
.getJsonObject("fileContent")
.getJsonObject("value")
.getString("downloadURL");
String extension = fileInfo
.getJsonObject("extension")
.getString("value");
String fileTitle = result
.getJsonObject("share")
.getJsonObject("fields")
.getJsonObject("cloudkit.title")
.getString("value");
complete(downURL.replace("${f}", fileTitle + "." + extension));
} catch (Exception e) {
fail(e, "json解析失败");
}
}).onFailure(handleFail());
return promise.future();
}
}

View File

@@ -308,6 +308,11 @@
host: /drive\.google\.com/,
name: 'GoogleDrive'
},
icloud: {
reg: /https:\/\/www\.icloud\.com\.cn\/iclouddrive\/([a-zA-Z\d_-]+)(#.+)?/,
host: /www\.icloud\.com\.cn/,
name: 'iCloud',
},
n163Music: {
reg: /https:\/\/163cn\.tv\/.+/,
host: /163cn\.tv/,

View File

@@ -254,3 +254,8 @@ GET http://127.0.0.1:6400/parser?url=https://www.vyuyun.com/s/QMa6ie?password=I4
### pod PASS
# @no-redirect
GET http://127.0.0.1:6400/parser?url=https://1drv.ms/u/s!Alg0feQmCv2rpFvu444hg5yVqDcK?e=OggA4s
### pic PASS
# @no-redirect
GET http://127.0.0.1:6400/parser?url=https://www.icloud.com.cn/iclouddrive/0d8lBC0qp01v1uNThurAGQf1A#fonts