mm_https 1.5.8 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -2
- package/package.json +4 -4
- package/test.js +22 -22
package/index.js
CHANGED
|
@@ -321,9 +321,15 @@ Http.prototype.request = function(options) {
|
|
|
321
321
|
body = buffer.toString();
|
|
322
322
|
break;
|
|
323
323
|
}
|
|
324
|
-
var mh = body.match(/charset=
|
|
324
|
+
var mh = body.match(/charset=gb2312"/i);
|
|
325
325
|
if (mh) {
|
|
326
|
-
body = iconv.decode(
|
|
326
|
+
body = iconv.decode(buffer, 'gb2312');
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
mh = body.match(/charset=GBK"/i);
|
|
330
|
+
if (mh) {
|
|
331
|
+
body = iconv.decode(buffer, 'GBK');
|
|
332
|
+
}
|
|
327
333
|
}
|
|
328
334
|
var lt = headers['set-cookie'];
|
|
329
335
|
if (lt) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_https",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "这是超级美眉http请求帮助类模块,可自动补充cookie,实现模拟登录,通讯",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/qiuwenwu/mm_https#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"https-proxy-agent": "^
|
|
35
|
-
"iconv-lite": "^0.
|
|
36
|
-
"mm_expand": "^1.
|
|
34
|
+
"https-proxy-agent": "^7.0.5",
|
|
35
|
+
"iconv-lite": "^0.6.3",
|
|
36
|
+
"mm_expand": "^1.6.9"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/test.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
var Http = require('./index.js');
|
|
3
3
|
var fs = require("fs");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
async function test(){
|
|
6
|
+
var http = new Http();
|
|
7
|
+
var res = await http.get("http://8xf.91yoyoo.com/");
|
|
8
|
+
console.log("html", res);
|
|
9
|
+
}
|
|
10
10
|
|
|
11
11
|
// async function test3() {
|
|
12
12
|
// // 将「微信对话开放平台」得到的信息填入
|
|
@@ -140,22 +140,22 @@ var fs = require("fs");
|
|
|
140
140
|
// test();
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
async function download(){
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
download();
|
|
143
|
+
// async function download(){
|
|
144
|
+
// var hp = new Http({
|
|
145
|
+
// headers: `
|
|
146
|
+
// Referer: https://www.aieliantong.com/admin/index
|
|
147
|
+
// X-Auth-Token: xxx
|
|
148
|
+
// `,
|
|
149
|
+
// cookie: "Hm_lvt_c73f94a74e41202e67d251e6e3f591cb=1697871513; Hm_lpvt_c73f94a74e41202e67d251e6e3f591cb=1698886851; mm:uuid=3QSuThREzVFdRW6/YrT0o0WpriBhXhMdnLmhtJOXwBg="
|
|
150
|
+
// });
|
|
151
|
+
// console.log(hp.headers, hp.cookies);
|
|
152
|
+
// var url = "https://www.copipi.com/p/224/224/becce1fc21d723614b598f5377d5d676.jpg";
|
|
153
|
+
// "./二维码/中文".addDir();
|
|
154
|
+
// var filename = "./二维码/qrcode.jpg".fullname();
|
|
155
|
+
// var file = await hp.download(url, filename);
|
|
156
|
+
// console.log(file);
|
|
157
|
+
// }
|
|
158
|
+
// download();
|
|
159
159
|
|
|
160
160
|
// async function test() {
|
|
161
161
|
// var http = new Http();
|
|
@@ -211,4 +211,4 @@ download();
|
|
|
211
211
|
// // console.log("结果", res.body);
|
|
212
212
|
// }
|
|
213
213
|
|
|
214
|
-
|
|
214
|
+
test();
|