npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

amazonproductscraper

v1.0.3

Published

Get title,name,price,images,description and specs of Amazon Products by URL or text search

Downloads

6

Readme

Amazon Product Scrapper

✨ Demo

Installation

  npm i amazonproductscraper

Usage

const { Product, getASINByText } = require('amazonproductscraper');
(async () => {
	const producto = await new Product(
		'https://www.amazon.com/-/es/dp/' +
			(await getASINByText('nvidia 2060 rtx'))
	).init();
	console.log(producto.get());
})();

getASINByText(search)

Searches and takes the ASIN (Amazon Standard Identification Number) of the first non-promoted result

Params

  • text string
await getASINByText('nvidia 2060 rtx');
//Returns: B083GH7LXW

Usage

Helpful when the product URL is not known https://www.amazon.com/dp/ + ASIN

const ASIN = await getASINByText('nvidia 2060 rtx');
'https://www.amazon.com/dp/' + ASIN;

You can add -/es/ for Spanish results as follows

const ASIN = await getASINByText('nvidia 2060 rtx');
'https://www.amazon.com/-/es/dp/' + ASIN;

↑ Getting results in multiple languages is not very clear to me yet

🚩 Product Class

| Method | Parameters | Return type | | --------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | init | Obtains and parses the product page DOM | Promise < Product > | | get | Returns all the possible product fields | { title: string; price: string; specs: { name: any; value: any; }[]; images: string[]; aboutThis: string[]; SKU: any; description: string; } | | getTitle | Returns the product title | string | | getPrice | Returns the product price | string | | getDescription | Returns the product description (Text only one) | string | | getAbout | Returns "About this item" list | string[] | | getImages(width?) | Returns the product gallery images by specified width size / max resolution by default | string[] | | getDetailedSpecs | Returns the product detailed specifications | { name:string, value:string }[] | | getSKU | Returns the product SKU | string |

async init()

Instantiate the Product object

Example

const ASIN = await getASINByText('nvidia 2060 rtx');
const producto = await new Product(`https://www.amazon.com/dp/${ASIN}`).init();
//Extract images from first non-promoted result for "nvidia 2060 rtx" search
console.log(producto.getImages());

Example

{
 title: 'EVGA GeForce RTX 2060 XC Ultra Gaming',
 price: 'US$ 309.99',
 specs: [
   { name: 'Brand', value: 'EVGA' },
   { name: 'Peso del producto', value: '1.8 pounds' },
   {
     name: 'Dimensiones del producto',
     value: '7.96 x 1.54 x 4.38 pulgadas'
   },
   {
     name: 'Dimensiones del artículo Largo x Ancho x Altura',
     value: '7.96 x 1.54 x 4.38 pulgadas'
   },
   { name: 'Fabricante', value: 'EVGA' },
   { name: 'ASIN', value: 'B083GH7LXW' },
   { name: 'Producto en amazon.com desde', value: 'Enero 3, 2020' }
 ],
 images: [
   'https://images-na.ssl-images-amazon.com/images/I/412cNrr8L5L.jpg',
   'https://images-na.ssl-images-amazon.com/images/I/41f-SG7CW6L.jpg',
   'https://images-na.ssl-images-amazon.com/images/I/4132axzkOUL.jpg',
   'https://images-na.ssl-images-amazon.com/images/I/31kPGH91w-L.jpg',
   'https://images-na.ssl-images-amazon.com/images/I/41G9asAucKL.jpg',
   'https://images-na.ssl-images-amazon.com/images/I/41VZ3J8M8bL.jpg',
   'https://images-na.ssl-images-amazon.com/images/I/31yxfGQymdL.jpg'
 ],
 aboutThis: [
   'Asegúrate de que esto coincide\nal ingresar tu número de modelo.',
   'Real Boost Clock: 1680 MHz; Memory detail: 6144 MB GDDR6',
   'Real-Time ray tracing in games for cutting-edge, hyper-realistic graphics',
   'Dual fans offer higher performance cooling and much quieter acoustic noise.',
   'Built for EVGA precision X1 + all-metal backplate, pre-installed',
   "3 year & EVGA's top notch technical support.",
   'Free deliver us the moon game w/ purchase, while supplies last'
 ],
 SKU: "192876216613",
 description: 'The EVGA GeForce RTX 20-Series Graphics Cards are powered by the all-New NVIDIA Turing architecture to give you incredible New levels of gaming realism, speed, power efficiency, and immersion. With the EVGA GeForce RTX 20-Series gaming cards you get the best gaming experience with next generation graphics performance, ice cold cooling, and advanced overclocking features with the all New EVGA Precision X1 software. The New NVIDIA GeForce RTX GPUs have reinvented graphics and set a New bar for perfrmance. Powered by the New NVIDIA Turing GPU architecture and the revolutionary NVIDI RTX platform, the New graphics cards bring together real-time ray tracing, artificial intelligence, and programmable shading. This is not only a whole New way to experience games - this is the ultimate PC gaming experience.'
}