amazon-product-api icon indicating copy to clipboard operation
amazon-product-api copied to clipboard

Not getting image and price with asin()

Open diegocamy opened this issue 3 years ago • 6 comments

Hi! First of all thank you for this amazing repo.

I'm having an issue with the asins() function, it doesn't return the product image or price.

Here's an example

const product = await amazonScraper.asin({
        asin: 'B01A9IC55A',
        cookie:
          'session-id=135-5316162-8870621; session-id-time=2082787201l; ubid-main=134-9281963-7348201',
        randomUa: true,
      })
      
console.log(asin)

it returns this:

{
  "result": [
    {
      "title": "Element 6' Flatbar Grind Rail Black Skateboarding Ramps by ELEMENT",
      "description": " Element BLACK 6' FLATBAR Skateboard GRIND RAIL",
      "feature_bullets": [],
      "variants": [],
      "categories": [
        {
          "category": "Sports & Outdoors",
          "url": "https://www.amazon.com/sports-outdoors/b/ref=dp_bc_aui_C_1?ie=UTF8&node=3375251"
        },
        {
          "category": "Sports",
          "url": "https://www.amazon.com/Sports-Fitness/b/ref=dp_bc_aui_C_2?ie=UTF8&node=10971181011"
        },
        {
          "category": "Skates, Skateboards & Scooters",
          "url": "https://www.amazon.com/skateboarding-scooters-skates/b/ref=dp_bc_aui_C_3?ie=UTF8&node=11051398011"
        },
        {
          "category": "Skateboarding",
          "url": "https://www.amazon.com/Skateboarding/b/ref=dp_bc_aui_C_4?ie=UTF8&node=3416111"
        },
        {
          "category": "Ramps & Rails",
          "url": "https://www.amazon.com/b/ref=dp_bc_aui_C_5?ie=UTF8&node=3416201"
        }
      ],
      "asin": "B01A9IC55A",
      "url": "https://www.amazon.com/dp/B01A9IC55A",
      "reviews": {
        "total_reviews": 2,
        "rating": "",
        "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": [],
      "main_image": "",
      "total_images": 0,
      "images": [],
      "total_videos": 0,
      "videos": [],
      "delivery_message": "",
      "product_information": {
        "dimensions": "",
        "weight": "",
        "available_from": "",
        "available_from_utc": "",
        "available_for_months": 0,
        "available_for_days": 0,
        "manufacturer": "",
        "model_number": "",
        "department": "",
        "qty_per_order": 27,
        "store_id": "",
        "brand": "Visit the Element Store"
      },
      "badges": {
        "amazon_сhoice": false,
        "amazon_prime": false
      },
      "sponsored_products": [],
      "also_bought": [],
      "other_sellers": []
    }
  ]
}

Is it because amazon changed something on their website and the scraper is not getting the right selectors?

diegocamy avatar Feb 07 '22 20:02 diegocamy

@diegocamy use cookie

Bariskau avatar Feb 27 '22 03:02 Bariskau

same problem, i set cookie in index.js like cookie: 'session-id=147-8900442-4947133; session-id-time=2082787201l; ubid-main=134-2827420-1481364',

jpchupaprecios avatar Mar 18 '22 07:03 jpchupaprecios

I'm having the same issue with the images. Just an empty array.

cvanvlack avatar May 02 '22 19:05 cvanvlack

Selectors are constantly changing. You should update them. For cookies, you can use the my location based cookie library.

Bariskau avatar Jun 29 '22 10:06 Bariskau

not getting price for india country please suggest somthing.

devagarwal007 avatar Jul 19 '22 14:07 devagarwal007

@megalancast but this has some cost associated, please suggest some free tools and apis

devagarwal007 avatar Jul 27 '22 06:07 devagarwal007