diff --git a/parser/src/main/java/cn/qaiu/entity/FileInfo.java b/parser/src/main/java/cn/qaiu/entity/FileInfo.java index 0a54204..40ce7f7 100644 --- a/parser/src/main/java/cn/qaiu/entity/FileInfo.java +++ b/parser/src/main/java/cn/qaiu/entity/FileInfo.java @@ -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 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 getExtParameters() { + return extParameters; } - public FileInfo setComments(String comments) { - this.comments = comments; + public FileInfo setExtParameters(Map extParameters) { + this.extParameters = extParameters; return this; } } diff --git a/parser/src/main/java/cn/qaiu/parser/PanDomainTemplate.java b/parser/src/main/java/cn/qaiu/parser/PanDomainTemplate.java index f1c40ab..7a3704e 100644 --- a/parser/src/main/java/cn/qaiu/parser/PanDomainTemplate.java +++ b/parser/src/main/java/cn/qaiu/parser/PanDomainTemplate.java @@ -104,6 +104,11 @@ public enum PanDomainTemplate { compile("https://drive\\.google\\.com/file/d/(?.+)/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/(?[a-z_A-Z\\d-=]+)(#(.+))?"), + "https://www.icloud.com.cn/iclouddrive/{shareKey}", + PicTool.class), // =====================音乐类解析 分享链接标志->MxxS (单歌曲/普通音质)========================== // http://163cn.tv/xxx diff --git a/parser/src/main/java/cn/qaiu/parser/impl/PicTool.java b/parser/src/main/java/cn/qaiu/parser/impl/PicTool.java new file mode 100644 index 0000000..54df38d --- /dev/null +++ b/parser/src/main/java/cn/qaiu/parser/impl/PicTool.java @@ -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; + +/** + * iCloud云盘(pic) + */ +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 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(); + } +} diff --git a/web-front/src/parserUrl1.js b/web-front/src/parserUrl1.js index f864379..1474145 100644 --- a/web-front/src/parserUrl1.js +++ b/web-front/src/parserUrl1.js @@ -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/, diff --git a/web-service/src/main/resources/http-tools/test.http b/web-service/src/main/resources/http-tools/test.http index ec22caa..774fff2 100644 --- a/web-service/src/main/resources/http-tools/test.http +++ b/web-service/src/main/resources/http-tools/test.http @@ -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