aliexscrape
Advanced tools
Comparing version 1.0.6 to 1.0.7
29
index.js
@@ -24,5 +24,4 @@ const rp = require('request-promise'); | ||
optionId: `${$(child).find('ul').attr('data-sku-prop-id')}:${$(li).find('a').attr('data-sku-id')}`, | ||
src: optionTag.attribs.src, | ||
src: optionTag.attribs.src.replace(/.jpg(.*).jpg/, '.jpg'), | ||
text: optionTag.attribs.title, | ||
bigpic: optionTag.attribs.bigpic, | ||
}); | ||
@@ -38,2 +37,7 @@ } else if (optionTag.name === 'span') { | ||
}); | ||
// seller/store data | ||
data.store = { | ||
name: $(response).find('span.shop-name').find('a').text(), | ||
id: $(response).find('span.shop-name').find('a').attr('href').match(/(\d+)/)[0], | ||
} | ||
// pics | ||
@@ -44,16 +48,15 @@ data.pics = []; | ||
}) | ||
// pricing | ||
data.pricing = []; | ||
const pricingJSON = /var.skuProducts=(.*);/.exec(response)[1]; | ||
const rawPricing = JSON.parse(pricingJSON); | ||
rawPricing.map(pricing => { | ||
// variations | ||
data.variations = []; | ||
const variationsJSON = /var.skuProducts=(.*);/.exec(response)[1]; | ||
const rawVariations = JSON.parse(variationsJSON); | ||
rawVariations.map(variation => { | ||
const pricingData = { | ||
singlePricing: pricing.skuVal.actSkuCalPrice || pricing.skuVal.skuCalPrice, | ||
bulkPricing: pricing.skuVal.actSkuBulkCalPrice, | ||
bulkOrder: pricing.skuVal.bulkOrder, | ||
pricing: variation.skuVal.skuCalPrice, | ||
discount: variation.skuVal.actSkuCalPrice, | ||
} | ||
if (pricing.skuAttr) { | ||
pricingData.combinedAttributes = pricing.skuAttr.match(/[0-9]{1,20}:[0-9]{1,20}/g); | ||
if (variation.skuAttr) { | ||
pricingData.combinedAttributes = variation.skuAttr.match(/[0-9]{1,20}:[0-9]{1,20}/g); | ||
} | ||
data.pricing.push(pricingData); | ||
data.variations.push(pricingData); | ||
}) | ||
@@ -60,0 +63,0 @@ // freight, get real-time here => https://freight.aliexpress.com/ajaxFreightCalculateService.htm?productid=32830803458&count=1¤cyCode=USD&country=TH |
{ | ||
"name": "aliexscrape", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Get Aliexpress product details in JSON", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
14782
91