Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

opengraph-cacher

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opengraph-cacher

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

latest
npmnpm
Version
2.7.0
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 10 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts