ts-open-graph-scraper
v0.0.2
Published
Node.js scraper module for Open Graph and Twitter Card info, based on https://github.com/jshemas/openGraphScraper
Downloads
1,187
Maintainers
Readme
ts-open-graph-scraper
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