mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-06-15 18:07:29 +00:00
docs: update parser and custom script docs
This commit is contained in:
@@ -240,13 +240,13 @@ var encoded = JsHttpClient.urlEncode("hello world"); // "hello%20world"
|
|||||||
var decoded = JsHttpClient.urlDecode("hello%20world"); // "hello world"
|
var decoded = JsHttpClient.urlDecode("hello%20world"); // "hello world"
|
||||||
|
|
||||||
// 发送简单表单数据
|
// 发送简单表单数据
|
||||||
var formResponse = http.sendForm({
|
var formResponse = http.sendForm("https://api.example.com/login", {
|
||||||
username: "user",
|
username: "user",
|
||||||
password: "pass"
|
password: "pass"
|
||||||
});
|
});
|
||||||
|
|
||||||
// 发送JSON数据
|
// 发送JSON数据
|
||||||
var jsonResponse = http.sendJson({
|
var jsonResponse = http.sendJson("https://api.example.com/submit", {
|
||||||
name: "test",
|
name: "test",
|
||||||
value: 123
|
value: 123
|
||||||
});
|
});
|
||||||
@@ -637,7 +637,7 @@ A: 使用 `shareLinkInfo.getSharePassword()` 方法。
|
|||||||
|
|
||||||
### Q: 如何处理需要登录的网盘?
|
### Q: 如何处理需要登录的网盘?
|
||||||
|
|
||||||
A: 使用 `http.putHeader()` 设置认证头,或使用 `http.sendForm()` 发送登录表单。
|
A: 使用 `http.putHeader()` 设置认证头,或使用 `http.sendForm(url, data)` 发送登录表单。
|
||||||
|
|
||||||
### Q: 如何解析复杂的HTML?
|
### Q: 如何解析复杂的HTML?
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ List<FileInfo> files = tool.parseFileListSync();
|
|||||||
```
|
```
|
||||||
|
|
||||||
要点:
|
要点:
|
||||||
- 必须先 WebClientVertxInit.init(Vertx);若未显式初始化,内部将懒加载 Vertx.vertx(),建议显式注入以统一生命周期。
|
- 必须先 WebClientVertxInit.init(Vertx);未初始化时会直接报错,避免解析器偷偷创建第二个 Vert.x 实例。
|
||||||
- 支持三种同步方法:
|
- 支持三种同步方法:
|
||||||
- `parseSync()`: 解析单个文件下载链接
|
- `parseSync()`: 解析单个文件下载链接
|
||||||
- `parseFileListSync()`: 解析文件列表
|
- `parseFileListSync()`: 解析文件列表
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
this.temporaryExecutor = WebClientVertxInit.get().createSharedWorkerExecutor(
|
this.temporaryExecutor = WebClientVertxInit.get().createSharedWorkerExecutor(
|
||||||
"playground-temp-" + System.currentTimeMillis(),
|
"playground-temp-" + System.currentTimeMillis(),
|
||||||
1, // 每个请求只需要1个线程
|
1, // 每个请求只需要1个线程
|
||||||
10000000000L // 设置非常长的超时,避免被vertx强制中断
|
10000000000L // 设置非常长的超时,避免触发Vert.x阻塞线程告警
|
||||||
);
|
);
|
||||||
|
|
||||||
// 执行完成或超时后关闭
|
// 执行完成或超时后关闭
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ executionFuture.toCompletionStage()
|
|||||||
### 长期方案(需大量工作)
|
### 长期方案(需大量工作)
|
||||||
1. **迁移到GraalVM JavaScript引擎**
|
1. **迁移到GraalVM JavaScript引擎**
|
||||||
- 支持CPU时间限制
|
- 支持CPU时间限制
|
||||||
- 可以强制中断
|
- 相比Nashorn更容易实现受控取消
|
||||||
- 更好的性能
|
- 更好的性能
|
||||||
- 但需要额外依赖
|
- 但需要额外依赖
|
||||||
|
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ HTTP客户端对象:
|
|||||||
http.get(url) // GET请求
|
http.get(url) // GET请求
|
||||||
http.post(url, data) // POST请求
|
http.post(url, data) // POST请求
|
||||||
http.putHeader(name, value) // 设置请求头
|
http.putHeader(name, value) // 设置请求头
|
||||||
http.sendForm(data) // 发送表单数据
|
http.sendForm(url, data) // 发送表单数据
|
||||||
http.sendJson(data) // 发送JSON数据
|
http.sendJson(url, data) // 发送JSON数据
|
||||||
```
|
```
|
||||||
|
|
||||||
### JsHttpResponse
|
### JsHttpResponse
|
||||||
|
|||||||
@@ -89,9 +89,9 @@ var java;
|
|||||||
* @property {function(): JsHttpClient} clearHeaders - 清空所有请求头(保留默认头)
|
* @property {function(): JsHttpClient} clearHeaders - 清空所有请求头(保留默认头)
|
||||||
* @property {function(): Object} getHeaders - 获取所有请求头
|
* @property {function(): Object} getHeaders - 获取所有请求头
|
||||||
* @property {function(number): JsHttpClient} setTimeout - 设置请求超时时间(秒)
|
* @property {function(number): JsHttpClient} setTimeout - 设置请求超时时间(秒)
|
||||||
* @property {function(Object): JsHttpResponse} sendForm - 发送简单表单数据
|
* @property {function(string, 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, any): JsHttpResponse} sendJson - 发送JSON数据
|
||||||
* @property {function(string): string} urlEncode - URL编码(静态方法)
|
* @property {function(string): string} urlEncode - URL编码(静态方法)
|
||||||
* @property {function(string): string} urlDecode - URL解码(静态方法)
|
* @property {function(string): string} urlDecode - URL解码(静态方法)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -37,10 +37,10 @@
|
|||||||
|
|
||||||
<!-- 将文件输出设置成异步输出 -->
|
<!-- 将文件输出设置成异步输出 -->
|
||||||
<appender name="ASYNC-FILE" class="ch.qos.logback.classic.AsyncAppender">
|
<appender name="ASYNC-FILE" class="ch.qos.logback.classic.AsyncAppender">
|
||||||
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
|
<!-- 队列剩余 20% 时开始丢弃 TRACE/DEBUG/INFO 级别日志,避免阻塞调用线程 -->
|
||||||
<discardingThreshold>0</discardingThreshold>
|
<discardingThreshold>20</discardingThreshold>
|
||||||
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
|
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
|
||||||
<queueSize>256</queueSize>
|
<queueSize>512</queueSize>
|
||||||
<!-- 添加附加的appender,最多只能添加一个 -->
|
<!-- 添加附加的appender,最多只能添加一个 -->
|
||||||
<appender-ref ref="FILE"/>
|
<appender-ref ref="FILE"/>
|
||||||
</appender>
|
</appender>
|
||||||
|
|||||||
Reference in New Issue
Block a user