drawrowfly / amazon-product-api

Amazon Scraper. Scrape products from the amazon search result or reviews from the specific product
648 stars 187 forks source link

When using .asin the price return 0 #23

Closed touq68616 closed 4 years ago

touq68616 commented 4 years ago

Hi,

I start trying the code and when I use .asin the price return '0'

This is my code

const amazonScraper = require('amazon-buddy');

(async () => { try {

    const product_by_asin = await amazonScraper.asin({ asin: 'B01GW3H3U8' });
    console.log(product_by_asin)

} catch (error) {
    console.log(error);
}

})();

and this what it returns

{ title: 'Xbox Wireless Controller - White', description: 'Edition:White | Configuration:SingleExperience the enhanced comfort and feel of the New Xbox Wireless Controller, featuring a sleek, streamlined design and textured grip. Enjoy custom button mapping and up to twice the wireless range. Plug in any compatible headset with the 3.5mm stereo headset jack. And with Bluetooth technology, play your favorite games on Windows 10 PCs, tablets, and phones. Button mapping available via Xbox Accessories app. Range compared to previous controllers with the Xbox One S. Bluetooth capabilities require Windows 10 devices running the Windows Anniversary Update. Go to xbox.com/xboxone/controller-OS for more information.', feature_bullets: [ 'Compatible with Xbox One X, Xbox One S, Xbox One and Windows 10', 'Includes Bluetooth technology for gaming on Windows 10 PCs and tablets', 'Stay on target with textured grip', 'Get upto twice the wireless range compared to previous Xbox One controllers (tested using the Xbox One S console)', 'Experience the enhanced comfort and feel of the new Xbox wireless controller' ], variants: [], asin: 'B01GW3H3U8', url: 'https://www.amazon.com/dp/B01GW3H3U8', reviews: { total_reviews: 18898, rating: '4.6', answered_questions: 0 }, item_available: true, price: { symbol: '$', currency: 'USD',

current_price: 0,

discounted: false,
before_price: 0,
savings_amount: 0,
savings_percent: 0

}, bestsellers_rank: [ { rank: 338, category: 'Video Games ', link: 'https://www.amazon.com/gp/bestsellers/videogames/ref=pd_zg_ts_videogames' }, { rank: 12, category: 'Xbox One Gamepads & Standard Controllers', link: 'https://www.amazon.com/gp/bestsellers/videogames/6469282011/ref=pd_zg_hrsr_videogames' } ], main_image: 'https://images-na.ssl-images-amazon.com/images/I/41iQlt6ZBLL._AC_SY879_.jpg', total_images: 6, images: [ 'https://images-na.ssl-images-amazon.com/images/I/41iQlt6ZBLL._AC_SY879_.jpg', 'https://images-na.ssl-images-amazon.com/images/I/41ps1EdriyL._AC_SY879_.jpg', 'https://images-na.ssl-images-amazon.com/images/I/41QcdZrEoWL._AC_SY879_.jpg', 'https://images-na.ssl-images-amazon.com/images/I/41rzMBZlRnL._AC_SY879_.jpg', 'https://images-na.ssl-images-amazon.com/images/I/418BpiuFGXL._AC_SY879_.jpg', 'https://images-na.ssl-images-amazon.com/images/I/6170h5brIxL._AC_SY879_.jpg' ], total_videos: 0, videos: [], delivery_message: '', product_information: { dimensions: '6.89 x 2.87 x 6.97 inches', weight: '1.2 pounds', available_from: 'June 10, 2016', available_from_utc: '2016-06-09T21:00:00.000Z', available_for_months: 52, available_for_days: 1579, manufacturer: 'Microsoft', model_number: 'TF5-00002', department: '', qty_per_order: 'na', store_id: '', brand: 'Brand: Microsoft' }, badges: { 'amazon_сhoice': false, amazon_prime: false }, sponsored_products: [], also_bought: [] }

Can you please help on that!

touq68616 commented 4 years ago

@drawrowfly

drawrowfly commented 4 years ago

https://www.amazon.com/dp/B01GW3H3U8/ this product has no price as it is not available

touq68616 commented 4 years ago

Sorry for that, I just use that for demostration because the products I am useing is too long for descrption. any way I modify the code and same problem.

My code now is

const amazonScraper = require('amazon-buddy');

(async () => { try {

    const product_by_asin = await amazonScraper.asin({ asin: 'B06XDPGRNX' });
    console.log(product_by_asin.result[0].price)

} catch (error) {
    console.log(error);
}

})();

the result is

{ symbol: '$', currency: 'USD', current_price: 0, discounted: false, before_price: 0, savings_amount: 0, savings_percent: 0 }

@drawrowfly

drawrowfly commented 4 years ago
//Some product metadata is binded to the ZIP code
//When you are setting the ZIP code new session is being generated by the Amazon
//By setting cookie values you will receive more accurate data(pricing and etc)
//Cookie example that can be extracted from the browser :session-id=222-22222-22222; session-id-time=222221l; ubid-main=444-4444-4444444

cookie: '',

Take cookie from your browser and set it

touq68616 commented 4 years ago

Thank you for the great content and for the great code.