spider.js
525 Bytes
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)