🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

ts-open-graph-scraper

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-open-graph-scraper

Node.js scraper module for Open Graph and Twitter Card info, based on https://github.com/jshemas/openGraphScraper

0.0.2
latest
Source
npm
Version published
Weekly downloads
178
17.11%
Maintainers
1
Weekly downloads
 
Created
Source

ts-open-graph-scraper

Build Status Known Vulnerabilities Coverage Status

A simple typescript-based node module for scraping Open Graph and Twitter Card info off a site.

Installation

npm install ts-open-graph-scraper

Usage

The major departure from @jshemas's openGraphScraper is this is entirely Typescript-based and implements only a promise interface. Additionally, it uses request-promise-native internally, so overloading it with Bluebird, etc., requires hoisting.

The OGOptions parameter extends Request's URL-based options, with the exclusion of json and callback options. Any other parameter is forwarded on. (eg, if you want to override headers, user-agent, etc., you can do it through these options where possible in request)

Additional properties are mostly similar to what's found in @jshemas's openGraphScraper

import ogs from 'ts-open-graph-scraper'

async function main() {
  const ogResults = await ogs('https://opg.me')
  // OR
  const ogResults = await ogs({
    url: 'https://opg.me'
  })
  console.table(ogResults)
}

To-Dos

  • Build this README out more
  • Expand coverage
  • Add more one-off expansions, like YouTube and Instagram

Contributing

I'll do my best to keep this maintained. In general:

  • Fork this project
  • Typescript everything
  • Coding convention is enforced by tslint.json
  • Try not to bring new packages in, unless there's a damned good reason
  • File an issue that provides reproduction steps or reasoning for the enhancement
  • Issue a pull request and reference the issue in standard syntax for easy cross referencing
  • Test coverage must not decline

Keywords

og

FAQs

Package last updated on 20 Jan 2020

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