mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-04-11 11:26:55 +00:00
js演练场
This commit is contained in:
@@ -40,7 +40,11 @@ custom-parsers/
|
||||
*/
|
||||
function parse(shareLinkInfo, http, logger) {
|
||||
// 你的解析逻辑
|
||||
return "https://example.com/download/file.zip";
|
||||
// 示例:解析后返回真实下载链接
|
||||
var url = shareLinkInfo.getShareUrl();
|
||||
var response = http.get(url);
|
||||
// ... 解析逻辑 ...
|
||||
return "https://download-server.com/file/xxx";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +68,9 @@ function parseFileList(shareLinkInfo, http, logger) {
|
||||
*/
|
||||
function parseById(shareLinkInfo, http, logger) {
|
||||
// 你的按ID解析逻辑
|
||||
return "https://example.com/download/" + fileId;
|
||||
var paramJson = shareLinkInfo.getOtherParam("paramJson");
|
||||
var fileId = paramJson.fileId;
|
||||
return "https://download-server.com/file/" + fileId;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -69,6 +69,9 @@ var java;
|
||||
* @property {function(): number} statusCode - 获取HTTP状态码
|
||||
* @property {function(string): string|null} header - 获取响应头
|
||||
* @property {function(): Object} headers - 获取所有响应头
|
||||
* @property {function(): boolean} isSuccess - 检查请求是否成功(2xx状态码)
|
||||
* @property {function(): Array} bodyBytes - 获取响应体字节数组
|
||||
* @property {function(): number} bodySize - 获取响应体大小(字节)
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -77,10 +80,20 @@ var java;
|
||||
* @property {function(string): JsHttpResponse} getWithRedirect - 发起GET请求并跟随重定向
|
||||
* @property {function(string): JsHttpResponse} getNoRedirect - 发起GET请求但不跟随重定向(用于获取Location头)
|
||||
* @property {function(string, any=): JsHttpResponse} post - 发起POST请求
|
||||
* @property {function(string, any=): JsHttpResponse} put - 发起PUT请求
|
||||
* @property {function(string): JsHttpResponse} delete - 发起DELETE请求
|
||||
* @property {function(string, any=): JsHttpResponse} patch - 发起PATCH请求
|
||||
* @property {function(string, string): JsHttpClient} putHeader - 设置请求头
|
||||
* @property {function(Object): JsHttpClient} putHeaders - 批量设置请求头
|
||||
* @property {function(string): JsHttpClient} removeHeader - 删除指定请求头
|
||||
* @property {function(): JsHttpClient} clearHeaders - 清空所有请求头(保留默认头)
|
||||
* @property {function(): Object} getHeaders - 获取所有请求头
|
||||
* @property {function(number): JsHttpClient} setTimeout - 设置请求超时时间(秒)
|
||||
* @property {function(Object): JsHttpResponse} sendForm - 发送简单表单数据
|
||||
* @property {function(string, Object): JsHttpResponse} sendMultipartForm - 发送multipart表单数据(支持文件上传)
|
||||
* @property {function(string, Object): JsHttpResponse} sendMultipartForm - 发送multipart表单数据(仅支持文本字段)
|
||||
* @property {function(any): JsHttpResponse} sendJson - 发送JSON数据
|
||||
* @property {function(string): string} urlEncode - URL编码(静态方法)
|
||||
* @property {function(string): string} urlDecode - URL解码(静态方法)
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user