|
|
const spider = require('../libs/spider');
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
const spiderTask = async ids => {
|
|
|
spider(ids).forEach(promise => promise.then(result => {
|
|
|
spider(ids, 'http://du.hupu.com/mapi/product/detail', {}, 1).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 sizes = result.data.sizeList;
|
|
|
|
|
|
sizes.forEach(size => {
|
|
|
const price = size.item.price;
|
|
|
const prePrice = _.get(size, 'preSellItem.price', 0)
|
|
|
const showPrice = _.get(size, 'showItem.price', 0)
|
|
|
|
|
|
console.log(`${result.data.detail.productId},${size.size},${price/100 || 0},${prePrice/100},${showPrice/100}`)
|
|
|
})
|
|
|
|
|
|
|
|
|
// 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)
|
|
|
const data = require('../data/skns.json')
|
|
|
|
|
|
const allIds = Array.from(new Array(23000 - 3377)).map((v, i) => i + 3377 + 1)
|
|
|
|
|
|
spiderTask(allIds) |
|
|
\ No newline at end of file |
|
|
spiderTask(data.map(item => item.productId)) |
|
|
\ No newline at end of file |
...
|
...
|
|