aliexscrape
Advanced tools
Comparing version 1.0.2 to 1.0.3
18
index.js
@@ -13,12 +13,12 @@ const rp = require('request-promise'); | ||
data.productTitle = /itemprop="name">(.*)</.exec(response)[1]; | ||
// variants | ||
data.variants = []; | ||
// attributes | ||
data.attributes = []; | ||
$(response).find('#j-product-info-sku').children().each((i, child) => { | ||
const variantData = {}; | ||
variantData.title = $(child).find('.p-item-title').text(); | ||
variantData.options = []; | ||
const attributeData = {}; | ||
attributeData.title = $(child).find('.p-item-title').text(); | ||
attributeData.options = []; | ||
$(child).find('ul').children().each((i, li) => { | ||
const optionTag = $(li).find('a').children()[0]; | ||
if (optionTag.name === 'img') { | ||
variantData.options.push({ | ||
attributeData.options.push({ | ||
optionId: `${$(child).find('ul').attr('data-sku-prop-id')}:${$(li).find('a').attr('data-sku-id')}`, | ||
@@ -30,3 +30,3 @@ src: optionTag.attribs.src, | ||
} else if (optionTag.name === 'span') { | ||
variantData.options.push({ | ||
attributeData.options.push({ | ||
optionId: `${$(child).find('ul').attr('data-sku-prop-id')}:${$(li).find('a').attr('data-sku-id')}`, | ||
@@ -37,3 +37,3 @@ text: $(optionTag).text(), | ||
}); | ||
data.variants.push(variantData); | ||
data.attributes.push(attributeData); | ||
}); | ||
@@ -56,3 +56,3 @@ // pics | ||
if (pricing.skuAttr) { | ||
pricingData.combinedOptions = pricing.skuAttr.match(/[0-9]{1,20}:[0-9]{1,20}/g); | ||
pricingData.combinedAttributes = pricing.skuAttr.match(/[0-9]{1,20}:[0-9]{1,20}/g); | ||
} | ||
@@ -59,0 +59,0 @@ data.pricing.push(pricingData); |
{ | ||
"name": "aliexscrape", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Get Aliexpress product details in JSON", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,3 +38,3 @@ # aliexscrape | ||
```json | ||
{"productId":"32853590425","productTitle":"Original Vaporesso SWAG Kit 80W Electronic Cigarette Kits With Vaporesso Swag Mod NRG SE NRG SE Mini Tank E-Cigarettes Vape Kit ","variants":[{"title":"Color:","options":[{"optionId":"14:193","text":"Black"},{"optionId":"14:173","text":"Blue"},{"optionId":"14:366","text":"Orange"},{"optionId":"14:350853","text":"Silver"}]},{"title":"Battery Capacity:","options":[{"optionId":"1328:200660823","text":"3.5ml Full Kit"},{"optionId":"1328:200660824","text":"2ml Full Kit"},{"optionId":"1328:200660825","text":"Only Swag Mod"}]},{"title":"Ships From:","options":[{"optionId":"200007763:201336100","text":"China"},{"optionId":"200007763:201336103","text":"Russian Federation"}]}],"pics":["https://ae01.alicdn.com/kf/HTB1HaISXbZnBKNjSZFKq6AGOVXaq/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg","https://ae01.alicdn.com/kf/HTB1cdCPX9tYBeNjSspkq6zU8VXaf/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg","https://ae01.alicdn.com/kf/HTB1S6lXX21TBuNjy0Fjq6yjyXXag/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg","https://ae01.alicdn.com/kf/HTB1bHk8XFuWBuNjSszbq6AS7FXah/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg","https://ae01.alicdn.com/kf/HTB1Yog9XH5YBuNjSspoq6zeNFXaJ/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg","https://ae01.alicdn.com/kf/HTB1TrBaX49YBuNjy0Ffq6xIsVXaG/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg"],"pricing":[{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedOptions":["14:193","1328:200660825","200007763:201336100"]},{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedOptions":["14:173","1328:200660825","200007763:201336100"]},{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedOptions":["14:366","1328:200660825","200007763:201336100"]},{"singlePricing":"29.70","bulkPricing":"28.81","bulkOrder":2,"combinedOptions":["14:350853","1328:200660825","200007763:201336100"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedOptions":["14:193","1328:200660824","200007763:201336100"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedOptions":["14:193","1328:200660823","200007763:201336100"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedOptions":["14:173","1328:200660824","200007763:201336100"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedOptions":["14:173","1328:200660823","200007763:201336100"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedOptions":["14:366","1328:200660824","200007763:201336100"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedOptions":["14:366","1328:200660823","200007763:201336100"]},{"singlePricing":"43.92","bulkPricing":"42.6","bulkOrder":2,"combinedOptions":["14:350853","1328:200660824","200007763:201336100"]},{"singlePricing":"44.10","bulkPricing":"42.78","bulkOrder":2,"combinedOptions":["14:350853","1328:200660823","200007763:201336100"]},{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedOptions":["14:193","1328:200660825","200007763:201336103"]},{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedOptions":["14:173","1328:200660825","200007763:201336103"]},{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedOptions":["14:366","1328:200660825","200007763:201336103"]},{"singlePricing":"29.70","bulkPricing":"28.81","bulkOrder":2,"combinedOptions":["14:350853","1328:200660825","200007763:201336103"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedOptions":["14:193","1328:200660824","200007763:201336103"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedOptions":["14:193","1328:200660823","200007763:201336103"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedOptions":["14:173","1328:200660824","200007763:201336103"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedOptions":["14:173","1328:200660823","200007763:201336103"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedOptions":["14:366","1328:200660824","200007763:201336103"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedOptions":["14:366","1328:200660823","200007763:201336103"]},{"singlePricing":"43.92","bulkPricing":"42.6","bulkOrder":2,"combinedOptions":["14:350853","1328:200660824","200007763:201336103"]},{"singlePricing":"44.10","bulkPricing":"42.78","bulkOrder":2,"combinedOptions":["14:350853","1328:200660823","200007763:201336103"]}],"properties":[{"propertyTitle":"Nominal Capacity:","propertyDescription":"None"},{"propertyTitle":"Monitoring Function Of Smoking Number:","propertyDescription":"No"},{"propertyTitle":"Built-in Or External Battery:","propertyDescription":"External"},{"propertyTitle":"Atomizers Identification Function:","propertyDescription":"Yes"},{"propertyTitle":"Model Number:","propertyDescription":"Vaporesso SWAG Kit"},{"propertyTitle":"Compatible Battery:","propertyDescription":"18650"},{"propertyTitle":"USB Charger:","propertyDescription":"Yes"},{"propertyTitle":"Appearance:","propertyDescription":"Box Shape"},{"propertyTitle":"Temperature Control:","propertyDescription":"Yes"},{"propertyTitle":"Overheating Protection Function:","propertyDescription":"Yes"},{"propertyTitle":"Compatible Model:","propertyDescription":"Vaporesso SWAG Kit"},{"propertyTitle":"Firmware Upgradeable:","propertyDescription":"Yes"},{"propertyTitle":"TCR Adjustment Modes:","propertyDescription":"Yes"},{"propertyTitle":"Brand Name:","propertyDescription":"vaporesso"},{"propertyTitle":"Display screen:","propertyDescription":"Yes"},{"propertyTitle":"Type:","propertyDescription":"Electric Mod"},{"propertyTitle":"Short-circuit Protection Function:","propertyDescription":"Yes"},{"propertyTitle":"Material:","propertyDescription":"Metal"},{"propertyTitle":"Silicone Case:","propertyDescription":"No"},{"propertyTitle":"Low Voltage Alarm Function:","propertyDescription":"Yes"},{"propertyTitle":"Mod:","propertyDescription":"Vaporesso Swag Mod"},{"propertyTitle":"Vaporesso Swag Tank 1:","propertyDescription":"Vaporesso NRG SE Tank"},{"propertyTitle":"Vaporesso Swag Tank 2:","propertyDescription":"Vaporesso NRG SE Mini Tank"},{"propertyTitle":"Vaporesso Swag Coil 1 :","propertyDescription":"Vaporesso GT2 0.4ohm"},{"propertyTitle":"Vaporesso Swag Coil 2:","propertyDescription":"Vaporesso GT CCELL 0.5ohm"},{"propertyTitle":"Voltage Range:","propertyDescription":"0-8.5V"},{"propertyTitle":"Battery:","propertyDescription":"1*18650 battery (Not included)"},{"propertyTitle":"Power:","propertyDescription":"5-80W"},{"propertyTitle":"Output Modes:","propertyDescription":"VW, CCW, CCT, VT, TCR, RTC, BYPASS"}],"description":" \n<p> Original Vaporesso SWAG Kit 80W Electronic Cigarette Kits With Vaporesso Swag Mod NRG SE NRG SE Mini Tank E-Cigarettes Vape Kit  </p> \n<p> <img alt=\"SWAG-KIT\" src=\"https://ae01.alicdn.com/kf/HTB1fTESXbZnBKNjSZFrq6yRLFXaj.jpg\"><img alt=\"SWAG-KIT-7\" src=\"https://ae01.alicdn.com/kf/HTB1tHCPX_lYBeNjSszcq6zwhFXan.jpg\"><img alt=\"SWAG-KIT-1\" src=\"https://ae01.alicdn.com/kf/HTB1DHuPX_lYBeNjSszcq6zwhFXap.jpg\"><img alt=\"SWAG-KIT-2\" src=\"https://ae01.alicdn.com/kf/HTB1cT3PXf6TBKNjSZJiq6zKVFXa1.jpg\"><img alt=\"SWAG-KIT-3\" src=\"https://ae01.alicdn.com/kf/HTB1tX.UXXooBKNjSZFPq6xa2XXaO.jpg\"><img alt=\"SWAG-KIT-6\" src=\"https://ae01.alicdn.com/kf/HTB1VSw8XH1YBuNjSszeq6yblFXa9.jpg\"><img alt=\"SWAG-KIT-6-(2)\" src=\"https://ae01.alicdn.com/kf/HTB1bd3RXbZnBKNjSZFGq6zt3FXao.jpg\"></p>"} | ||
{"productId":"32853590425","productTitle":"Original Vaporesso SWAG Kit 80W Electronic Cigarette Kits With Vaporesso Swag Mod NRG SE NRG SE Mini Tank E-Cigarettes Vape Kit ","attributes":[{"title":"Color:","options":[{"optionId":"14:193","text":"Black"},{"optionId":"14:173","text":"Blue"},{"optionId":"14:366","text":"Orange"},{"optionId":"14:350853","text":"Silver"}]},{"title":"Battery Capacity:","options":[{"optionId":"1328:200660823","text":"3.5ml Full Kit"},{"optionId":"1328:200660824","text":"2ml Full Kit"},{"optionId":"1328:200660825","text":"Only Swag Mod"}]},{"title":"Ships From:","options":[{"optionId":"200007763:201336100","text":"China"},{"optionId":"200007763:201336103","text":"Russian Federation"}]}],"pics":["https://ae01.alicdn.com/kf/HTB1HaISXbZnBKNjSZFKq6AGOVXaq/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg","https://ae01.alicdn.com/kf/HTB1cdCPX9tYBeNjSspkq6zU8VXaf/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg","https://ae01.alicdn.com/kf/HTB1S6lXX21TBuNjy0Fjq6yjyXXag/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg","https://ae01.alicdn.com/kf/HTB1bHk8XFuWBuNjSszbq6AS7FXah/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg","https://ae01.alicdn.com/kf/HTB1Yog9XH5YBuNjSspoq6zeNFXaJ/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg","https://ae01.alicdn.com/kf/HTB1TrBaX49YBuNjy0Ffq6xIsVXaG/Original-Vaporesso-SWAG-Kit-80W-Electronic-Cigarette-Kits-With-Vaporesso-Swag-Mod-NRG-SE-NRG-SE.jpg"],"pricing":[{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedAttributes":["14:193","1328:200660825","200007763:201336100"]},{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedAttributes":["14:173","1328:200660825","200007763:201336100"]},{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedAttributes":["14:366","1328:200660825","200007763:201336100"]},{"singlePricing":"29.70","bulkPricing":"28.81","bulkOrder":2,"combinedAttributes":["14:350853","1328:200660825","200007763:201336100"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedAttributes":["14:193","1328:200660824","200007763:201336100"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedAttributes":["14:193","1328:200660823","200007763:201336100"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedAttributes":["14:173","1328:200660824","200007763:201336100"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedAttributes":["14:173","1328:200660823","200007763:201336100"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedAttributes":["14:366","1328:200660824","200007763:201336100"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedAttributes":["14:366","1328:200660823","200007763:201336100"]},{"singlePricing":"43.92","bulkPricing":"42.6","bulkOrder":2,"combinedAttributes":["14:350853","1328:200660824","200007763:201336100"]},{"singlePricing":"44.10","bulkPricing":"42.78","bulkOrder":2,"combinedAttributes":["14:350853","1328:200660823","200007763:201336100"]},{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedAttributes":["14:193","1328:200660825","200007763:201336103"]},{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedAttributes":["14:173","1328:200660825","200007763:201336103"]},{"singlePricing":"30.60","bulkPricing":"29.69","bulkOrder":2,"combinedAttributes":["14:366","1328:200660825","200007763:201336103"]},{"singlePricing":"29.70","bulkPricing":"28.81","bulkOrder":2,"combinedAttributes":["14:350853","1328:200660825","200007763:201336103"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedAttributes":["14:193","1328:200660824","200007763:201336103"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedAttributes":["14:193","1328:200660823","200007763:201336103"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedAttributes":["14:173","1328:200660824","200007763:201336103"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedAttributes":["14:173","1328:200660823","200007763:201336103"]},{"singlePricing":"44.64","bulkPricing":"43.3","bulkOrder":2,"combinedAttributes":["14:366","1328:200660824","200007763:201336103"]},{"singlePricing":"45.00","bulkPricing":"43.65","bulkOrder":2,"combinedAttributes":["14:366","1328:200660823","200007763:201336103"]},{"singlePricing":"43.92","bulkPricing":"42.6","bulkOrder":2,"combinedAttributes":["14:350853","1328:200660824","200007763:201336103"]},{"singlePricing":"44.10","bulkPricing":"42.78","bulkOrder":2,"combinedAttributes":["14:350853","1328:200660823","200007763:201336103"]}],"properties":[{"propertyTitle":"Nominal Capacity:","propertyDescription":"None"},{"propertyTitle":"Monitoring Function Of Smoking Number:","propertyDescription":"No"},{"propertyTitle":"Built-in Or External Battery:","propertyDescription":"External"},{"propertyTitle":"Atomizers Identification Function:","propertyDescription":"Yes"},{"propertyTitle":"Model Number:","propertyDescription":"Vaporesso SWAG Kit"},{"propertyTitle":"Compatible Battery:","propertyDescription":"18650"},{"propertyTitle":"USB Charger:","propertyDescription":"Yes"},{"propertyTitle":"Appearance:","propertyDescription":"Box Shape"},{"propertyTitle":"Temperature Control:","propertyDescription":"Yes"},{"propertyTitle":"Overheating Protection Function:","propertyDescription":"Yes"},{"propertyTitle":"Compatible Model:","propertyDescription":"Vaporesso SWAG Kit"},{"propertyTitle":"Firmware Upgradeable:","propertyDescription":"Yes"},{"propertyTitle":"TCR Adjustment Modes:","propertyDescription":"Yes"},{"propertyTitle":"Brand Name:","propertyDescription":"vaporesso"},{"propertyTitle":"Display screen:","propertyDescription":"Yes"},{"propertyTitle":"Type:","propertyDescription":"Electric Mod"},{"propertyTitle":"Short-circuit Protection Function:","propertyDescription":"Yes"},{"propertyTitle":"Material:","propertyDescription":"Metal"},{"propertyTitle":"Silicone Case:","propertyDescription":"No"},{"propertyTitle":"Low Voltage Alarm Function:","propertyDescription":"Yes"},{"propertyTitle":"Mod:","propertyDescription":"Vaporesso Swag Mod"},{"propertyTitle":"Vaporesso Swag Tank 1:","propertyDescription":"Vaporesso NRG SE Tank"},{"propertyTitle":"Vaporesso Swag Tank 2:","propertyDescription":"Vaporesso NRG SE Mini Tank"},{"propertyTitle":"Vaporesso Swag Coil 1 :","propertyDescription":"Vaporesso GT2 0.4ohm"},{"propertyTitle":"Vaporesso Swag Coil 2:","propertyDescription":"Vaporesso GT CCELL 0.5ohm"},{"propertyTitle":"Voltage Range:","propertyDescription":"0-8.5V"},{"propertyTitle":"Battery:","propertyDescription":"1*18650 battery (Not included)"},{"propertyTitle":"Power:","propertyDescription":"5-80W"},{"propertyTitle":"Output Modes:","propertyDescription":"VW, CCW, CCT, VT, TCR, RTC, BYPASS"}],"description":" \n<p> Original Vaporesso SWAG Kit 80W Electronic Cigarette Kits With Vaporesso Swag Mod NRG SE NRG SE Mini Tank E-Cigarettes Vape Kit  </p> \n<p> <img alt=\"SWAG-KIT\" src=\"https://ae01.alicdn.com/kf/HTB1fTESXbZnBKNjSZFrq6yRLFXaj.jpg\"><img alt=\"SWAG-KIT-7\" src=\"https://ae01.alicdn.com/kf/HTB1tHCPX_lYBeNjSszcq6zwhFXan.jpg\"><img alt=\"SWAG-KIT-1\" src=\"https://ae01.alicdn.com/kf/HTB1DHuPX_lYBeNjSszcq6zwhFXap.jpg\"><img alt=\"SWAG-KIT-2\" src=\"https://ae01.alicdn.com/kf/HTB1cT3PXf6TBKNjSZJiq6zKVFXa1.jpg\"><img alt=\"SWAG-KIT-3\" src=\"https://ae01.alicdn.com/kf/HTB1tX.UXXooBKNjSZFPq6xa2XXaO.jpg\"><img alt=\"SWAG-KIT-6\" src=\"https://ae01.alicdn.com/kf/HTB1VSw8XH1YBuNjSszeq6yblFXa9.jpg\"><img alt=\"SWAG-KIT-6-(2)\" src=\"https://ae01.alicdn.com/kf/HTB1bd3RXbZnBKNjSZFGq6zt3FXao.jpg\"></p>"} | ||
``` | ||
@@ -41,0 +41,0 @@ |
14333