The Stellarscrape ApiClient is an npm package designed to interact with the Stellarscrape API, allowing you to search for Amazon products and retrieve detailed product information across supported Amazon marketplaces. To use this package, obtain an API key by subscribing at StellarScrape.com.
Install the Stellarscrape client via npm:
npm install stellarscrape
To start using the Stellarscrape client, import the StellarScrape
class, initialize it with your API key, and use the methods provided to search for products or fetch product details.
const { StellarScrape } = require('stellarscrape');
const stellarScrape = new StellarScrape("YOUR_API_KEY");
Retrieve details for a specific product based on its Amazon Standard Identification Number (ASIN).
stellarScrape.getAmazonProduct("B0DGHN7913", ["fr"], "fr")
.then((data) => {
console.log(data);
})
.catch((err) => {
console.log(err);
});
Parameters:
-
asin
(string): The ASIN of the product. -
countries
(array of supportedCountry): List of country codes to fetch data from (e.g.,["fr"]
). -
userCountry
(supportedCountry): The country code for the user.
Search for products on Amazon across multiple supported locales using a query string.
stellarScrape.searchAmazonProducts("iphones", ["fr", "it", "es", "de"], "fr", 10, 0)
.then((data) => {
data.data.searchData.productsData.forEach((product) => console.log(product));
})
.catch((err) => {
console.log(err);
});
Parameters:
-
query
(string): Search term (e.g.,"iphones"
). -
countries
(array of supportedCountry): List of countries to search in (e.g.,["fr", "it", "es", "de"]
). -
userCountry
(supportedCountry): The primary country for the user. -
amount
(number, optional): Number of results per page (default is 10). -
startAt
(number, optional): The starting index of the results (default is 0).
Retrieve details for multiple products in one request by providing an array of ASINs.
stellarScrape.getAmazonMultipleProducts(["B09G9HWQYT", "B07F81WWKP"], ["fr"], "fr")
.then((data) => {
console.log(data.data);
})
.catch((err) => {
console.log(err);
});
Parameters:
-
asinArray
(array of strings): Array of ASINs (up to 100 per request). -
countries
(array of supportedCountry): List of country codes (e.g.,["fr"]
). -
userCountry
(supportedCountry): The user's country code.
- Obtain your API key by subscribing at StellarScrape.com.
- Manage errors with
.catch()
to handle potential API request issues.