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

universal-pdp-scrapper

v1.1.6

Published

A universal pdp scrapper using cheerio & ChatGPT

Downloads

35

Readme

Universal PDP Scrapper

NPM JavaScript Style Guide pages-build-deployment

This is a universal PDP scrapper that can scrape any product detail page and extract the following information:

product_name?: string;
images?: string[];
height?: string;
width?: string;
depth?: string;
material?: string;
price?: string;
sku?: string;
artist?: string;
type?: Types;
product_url?: string;
source?: string;
glbs?: string[];
glb_to_use?: string;
'supporting-surface'?: 'floor' | 'wall';

Under the hood, it uses OpenAI to extract estimated information from the product page and Google Custom Search JSON API / SerpAPI to extract images from product pages using Google Image Search coupled with Ikea's product search API and some custom scrappers for some popular furniture websites.

How to use

1. Install

npm i universal-pdp-scrapper

2. Usage

import { UniversalPDPScrapper } from 'universal-pdp-scrapper';

// Initialize the client and set the API keys
// You can set API Keys using environment variables as well: check [.env.sample](./.env.sample)
const client = new UniversalPDPScrapper({
    openaiApiKey: '',
    openaiOrgId: '',
    openaiModelId: '',
    googleApiKey: '',
    googleCseId: ''
});
const result = await client.scrape('https://www.ikea.com/us/en/p/jokkmokk-table-and-4-chairs-antique-stain-50211104/');
console.log(result);

3. Demo

Here's a demo of running the scrapper in a server environment integrated with a React app

4. Documentation

Check here.

Features

  • [x] Supports ES6 Async/Await
  • [x] Supports CommonJS require
  • [x] Tree-shakable
  • [x] Can be used both in Node and Browser environments
  • [x] Written in Typescript
  • [x] Uses OpenAI to extract estimated information from the product page
  • [x] Uses Google Custom Search JSON API to extract images from product pages using Google Image Search
  • [x] Uses Cheerio to scrape product pages for some popular websites

NOTE: This library doesn't solve the issue of CORS for images or glbs. If you encounter cors, its better to use this library in the server environment and download the images and glbs to your server and serve them from there.

universal-pdp-scrapper npminsights.com

Module Stats

See Rollup Visualizer