|
@@ -4,6 +4,8 @@ const nodeLockup = require('node-lockup'); |
|
@@ -4,6 +4,8 @@ const nodeLockup = require('node-lockup'); |
4
|
const chalk = require('chalk');
|
4
|
const chalk = require('chalk');
|
5
|
const {logger} = require('./logger');
|
5
|
const {logger} = require('./logger');
|
6
|
|
6
|
|
|
|
7
|
+const detailUrl = 'https://app.poizon.com/api/v1/h5/index/fire/flow/product/detail';
|
|
|
8
|
+
|
7
|
const sign = (obj) => {
|
9
|
const sign = (obj) => {
|
8
|
let constr = '';
|
10
|
let constr = '';
|
9
|
|
11
|
|
|
@@ -25,10 +27,12 @@ const task = async(options, tick = 1) => { |
|
@@ -25,10 +27,12 @@ const task = async(options, tick = 1) => { |
25
|
json: true,
|
27
|
json: true,
|
26
|
headers: {
|
28
|
headers: {
|
27
|
Accept: 'application/json, text/plain, */*',
|
29
|
Accept: 'application/json, text/plain, */*',
|
28
|
- appVersion: '3.5.0',
|
|
|
29
|
- Referer: 'http://du.hupu.com/mdu/product/detail.html?id=1&source=boutiqueRecommend',
|
30
|
+ appid: 'h5',
|
|
|
31
|
+ appVersion: '4.4.0',
|
|
|
32
|
+ Referer: 'http://du.hupu.com/mdu/product/detail.html?id=1&source=shareDetail',
|
30
|
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 Safari/604.1',
|
33
|
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 Safari/604.1',
|
31
|
- 'X-Requested-With': 'XMLHttpRequest'
|
34
|
+ 'X-Requested-With': 'XMLHttpRequest',
|
|
|
35
|
+ cookie: 'duToken=d41d8cd9%7C16075871%7C1558328526%7C37c4ab8a8cd16e3f; UM_distinctid=16a341fe1c86a-099fe9f71aa88b8-5743047f-4a640-16a341fe1c94c5'
|
32
|
},
|
36
|
},
|
33
|
timeout: 2000
|
37
|
timeout: 2000
|
34
|
});
|
38
|
});
|
|
@@ -43,20 +47,20 @@ const task = async(options, tick = 1) => { |
|
@@ -43,20 +47,20 @@ const task = async(options, tick = 1) => { |
43
|
}
|
47
|
}
|
44
|
};
|
48
|
};
|
45
|
|
49
|
|
46
|
-module.exports = (ids, url = 'http://du.hupu.com/mapi/product/detail', params, delay) => {
|
50
|
+module.exports = (ids, url, params, delay) => {
|
47
|
const lockTask = nodeLockup(task, delay || 1);
|
51
|
const lockTask = nodeLockup(task, delay || 1);
|
48
|
|
52
|
|
49
|
return ids.map(id => lockTask(Object.assign({
|
53
|
return ids.map(id => lockTask(Object.assign({
|
50
|
productId: id,
|
54
|
productId: id,
|
51
|
- source: 'boutiqueRecommend',
|
|
|
52
|
- url
|
55
|
+ productSourceName: 'shareDetail',
|
|
|
56
|
+ url: url || detailUrl
|
53
|
}, params)));
|
57
|
}, params)));
|
54
|
};
|
58
|
};
|
55
|
|
59
|
|
56
|
-module.exports.spiderFetch = (id, url = 'http://du.hupu.com/mapi/product/detail', params) => {
|
60
|
+module.exports.spiderFetch = (id, url, params) => {
|
57
|
return task(Object.assign({
|
61
|
return task(Object.assign({
|
58
|
productId: id,
|
62
|
productId: id,
|
59
|
- source: 'boutiqueRecommend',
|
|
|
60
|
- url
|
63
|
+ productSourceName: 'shareDetail',
|
|
|
64
|
+ url: url || detailUrl
|
61
|
}, params));
|
65
|
}, params));
|
62
|
}; |
66
|
}; |