Skip to content

Commit 2ba57f3

Browse files
committed
默认不使用代理
1 parent 164fb59 commit 2ba57f3

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ ins-grab download --help
5858
- `-u, --username`: Single account username
5959
- `-t, --types`: Media types to download (image,video)
6060
- `-m, --max-items`: Maximum items to download
61-
- `-p, --proxy`: Proxy URL
61+
- `-p, --proxy`: Proxy URL (optional)
6262
- `--timeout`: Request timeout in milliseconds
6363

base/request.js

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class Request {
3737
};
3838

3939
if (this.proxy) {
40+
console.log(`使用代理: ${this.proxy}`);
4041
reqOptions.agent = new HttpsProxyAgent(this.proxy);
4142
}
4243

@@ -54,6 +55,9 @@ export class Request {
5455
if (error.type === 'request-timeout') {
5556
throw new Error(`请求超时 (${this.timeout}ms): ${url}`);
5657
}
58+
if (this.proxy && error.code === 'ECONNREFUSED') {
59+
throw new Error(`代理连接失败: ${this.proxy}`);
60+
}
5761
throw error;
5862
}
5963
}

bin/cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ program
2222
.option('-u, --username <username>', 'Single account username')
2323
.option('-t, --types <types>', 'Media types to download (image,video)', 'image,video')
2424
.option('-m, --max-items <number>', 'Maximum items to download', '100')
25-
.option('-p, --proxy <url>', 'Proxy URL', 'http://127.0.0.1:7890')
25+
.option('-p, --proxy <url>', 'Proxy URL (optional)')
2626
.option('--timeout <ms>', 'Request timeout in milliseconds', '30000')
2727
.action(async (options) => {
2828
try {

0 commit comments

Comments
 (0)