Created
March 25, 2017 16:10
-
-
Save sawantuday/72fbd6717c45e49817cf02b6c4ff7f24 to your computer and use it in GitHub Desktop.
Revisions
-
sawantuday created this gist
Mar 25, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ module.exports = function (cb) { var amazon = require('amazon-product-api'); var client = amazon.createClient({ awsId: "Affiliate ID", awsSecret: "AWS Secret", awsTag: "affiliate-tag", locale: "IN" }); client.itemLookup({ idType: 'ASIN', itemId: 'B01DWAVO2W', responseGroup: 'ItemAttributes,Offers,Images,Large', domain: 'webservices.amazon.in' }).then(function (results) { // console.log("callback sucess") cb(null, { 'ASIN': results[0].ASIN[0], 'title': results[0].ItemAttributes[0].Title[0], 'url': results[0].DetailPageURL[0], 'lImg': results[0].LargeImage[0].URL[0], 'mImg': results[0].MediumImage[0].URL[0], 'listPrice': results[0].ItemAttributes[0].ListPrice[0].FormattedPrice[0], 'sellPrice': results[0].Offers[0].Offer[0].OfferListing[0].Price[0].FormattedPrice[0], 'available': results[0].Offers[0].Offer[0].OfferListing[0].AvailabilityAttributes[0].AvailabilityType[0] == 'now' ? 'yes' : 'no', 'similar': results[0].SimilarProducts[0].SimilarProduct, }) // console.log(JSON.stringify(results)); }).catch (function (err) { console.log("error") }); }