drawrowfly / amazon-product-api

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

Fix infinite loop on reviews #5

Closed ShaunLWM closed 4 years ago

ShaunLWM commented 4 years ago

On products that have less than X number of reviews (for example, I want 100 reviews but there is only 8), review scraper seems to go on an infinite loop since the criteria is not met. This will stop the scraping and return the result as soon as no reviews are found.

I have tried it on multiple products on my main project. This is a sample product to test it out on.

let reviews = await amazon.reviews({
        asin: "B083SB6RHQ",
        number: 100
    });

Requested 100, but should only return 4.