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

og-screenshots

v0.0.14

Published

A CLI to take screenshots of websites and generate [open graph images](https://ogp.me) from your own computer. Having a website with a screenshot as an open graph image is a great way to promote your website and attract more visitors.

Downloads

28

Readme

og-screenshots [BETA]

A CLI to take screenshots of websites and generate open graph images from your own computer. Having a website with a screenshot as an open graph image is a great way to promote your website and attract more visitors.

Why?

  • Existing solutions are expensive and subscription based. You usually only need to take the screenshots once. You don't have to pay for a monthly subscription.
  • Running your own open graph image generator in the cloud is also expensive. If you use a serverless platform, you'll have to pay for the computing power. If you use a self-hosted server, you'll have to pay for storage and bandwidth.

Features

  • Screenshot a single URL
  • Capture screenshots of multiple URLs from a sitemap or RSS feed

Requirements

Notes:

  • Note that I only tested this on macOS.
  • Chrome is required because I don't want to use puppeteer. Puppeteer automatically downloads a recent version of Chrome for Testing which can be ~170MB macOS, ~282MB Linux, or ~280MB Windows. That's a lot of bytes for doing just one thing. It turned out that the normal Chrome browser can be used for this task and majority of people already have it installed.

Install

npm i -g og-screenshots

Or you can also directly execute the command:

npx og-screenshots --url "https://example.com"

CLI

  Usage
    $ og-screenshots [input]

  Options
    --url, -u <type> Input URL (required). Can be a sitemap, RSS feed or a single URL. When using a sitemap or RSS feed, this command will automatically detect the URLs in the feed or sitemap and process them.
    --transform, -t Transform origin [Default: false]
    --timeout, -T <type> Timeout in milliseconds [Default: 60000]
    --extension, -e <type> File extension [Default: webp]
    --concurrency, -c <type> Concurrency level [Default: 3]
    --quality, -q <type> Image quality [Default: 100]
    --max-screenshots, -m <type> Maximum number of screenshots [Default: 0]
    --recommended-size, -r <type> Recommended image size [Default: {"width":1200,"height":630}]
    --output-dir, -o <type> Output directory [Default: ./public/screenshots]
    --window-size, -w <type> Browser window size [Default: 1300,1300]
    --chrome-path <type> Path to Chrome [Default: detected Chrome path]
    --imagemagick-path <type> Path to ImageMagick [Default: detected ImageMagick path]
    --overwrite Overwrite existing files [Default: false]. By default, the command will not take screenshots if the output file already exists.


  Examples
    $ og-screenshots --url "http://example.com"

Development

Run

npx tsx source/cli.tsx --url "https://example.com"

Known issues

  • Sometimes the process hangs. You can try to kill the process manually. Anyone who knows how to fix this issue is welcome to contribute.

License

Affero General Public License v3.0

Contact

Nico Prananta