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

opengraph-cacher

v2.7.0

Published

[![inventid logo](https://cdn.inventid.nl/assets/logo-horizontally-ba8ae38ab1f53863fa4e99b977eaa1c7.png)](http://opensource.inventid.nl)

Downloads

22

Readme

inventid logo

Maintainability Test Coverage Dependency Status

Opengraph Cacher

Serving Opengraph data as a service

What

This project aims to be a simple service for internal use to fetch opengraph data in a structured fashion.

Additionally it caches the results for a configurable time in an Elasticsearch instance.

{
	"_url": "https://www.werkenbijderechtspraak.nl/",
	"_scrapedAt": 1487334683528,
	"_cacheResponse": false,
	"data": {
		"locale": [{
			"value": "nl_NL"
		}],
		"type": [{
			"value": "website"
		}],
		"title": [{
			"value": "Werken bij de Rechtspraak"
		}],
		"description": [{
			"value": "Op zoek naar een baan die er toe doet? De Rechtspraak heeft geregeld vacatures voor nieuwe collega's in juridische, staf of ICT functies"
		}],
		"url": [{
			"value": "https://www.werkenbijderechtspraak.nl/"
		}],
		"site_name": [{
			"value": "Werken bij de Rechtspraak"
		}],
		"twitter_card": [{
			"value": "summary"
		}],
		"twitter_description": [{
			"value": "Op zoek naar een baan die er toe doet? De Rechtspraak heeft geregeld vacatures voor nieuwe collega's in juridische, staf of ICT functies"
		}],
		"twitter_title": [{
			"value": "Werken bij de Rechtspraak"
		}],
		"twitter_site": [{
			"value": "@rechtspraakbaan"
		}],
		"twitter_creator": [{
			"value": "@rechtspraakbaan"
		}],
		"image": [{
			"value": {
				"value": "https://d3pxfuwnql1xse.cloudfront.net/30b9376b5b94713347a6c5c37faf2d1deef6cf59?url=https%3A%2F%2Fwww.werkenbijderechtspraak.nl%2Fwp-content%2Fuploads%2F2016%2F08%2Fheader-3.jpg",
				"width": [{
					"value": "1600"
				}],
				"height": [{
					"value": "220"
				}],
				"type": [{
					"value": null
				}]
			}
		}],
		"twitter_image": [{
			"value": {
				"value": "https://d3pxfuwnql1xse.cloudfront.net/30b9376b5b94713347a6c5c37faf2d1deef6cf59?url=https%3A%2F%2Fwww.werkenbijderechtspraak.nl%2Fwp-content%2Fuploads%2F2016%2F08%2Fheader-3.jpg",
				"width": [{
					"value": null
				}],
				"height": [{
					"value": null
				}],
				"alt": [{
					"value": null
				}]
			}
		}]
	}
}

Elasticsearch

The service will automatically create an index the first time save is performed. There are no special mappings required for the service.

Camo images

In order to ensure clients can requests clients from http over https the camo service can be used. If the environment variables CAMO_HOST and CAMO_KEY are set, images are automatically rewritten to use the defined camo instance.

Docker

A Docker container is available. Configuration is done using some command line variables.

An example is:

docker run \
    -e ES_URL=es.inventid.net:9200 \
    -e ES_INDEX=opengraph \
    -e ES_TYPE=cache \
    -e ES_VERSION=1.7 \
    -e CACHE_IN_DAYS=4 \
    -p 7070:7070 \
    inventid/opengraph-cacher

Example without elasticsearch:

docker run -p 7070:7070 inventid/opengraph-cacher

The CACHE_IN_DAYS variable can be omitted (which will fallback to 28 days).

API

The service has three simple endpoints:

GET /opengraph?url=your-escaped-url

Example: http://localhost:7070/opengraph/?url=http%3A%2F%2Finventid.nl ventid.nl).

DELETE /opengraph?url=your-escaped-url

Delete it from the cache, if you have a cache enabled.

GET /_health

To see if the container is online