Authored by 陈峰

commit

... ... @@ -43,9 +43,10 @@ const task = async(options, tick = 1) => {
return task(options, tick + 1);
}
};
const lockTask = nodeLockup(task, config.delay);
module.exports = (ids, url = 'http://du.hupu.com/mapi/product/detail', params) => {
const lockTask = nodeLockup(task, config.delay);
return ids.map(id => lockTask(Object.assign({
productId: id,
source: 'boutiqueRecommend',
... ...
const spider = require('../libs/spider');
const spiderTask = async ids => {
spider(ids).forEach(promise => promise.then(result => {
if (result.status === 200) {
console.log(`${result.data.detail.productId},${result.data.detail.articleNumber},${result.data.detail.title},${result.data.item.price / 100},${result.data.detail.soldNum},http://du.hupu.com/mdu/product/detail.html?id=${result.data.detail.productId}`);
}
}))
}
const allIds = Array.from(new Array(21500)).map((v, i) => i + 1)
spiderTask(allIds)
\ No newline at end of file
... ...