Installations
npm install open-graph-scraper-lite
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Min. Node Version
>=16.0.0
Node Version
18.18.0
NPM Version
9.8.1
Score
74.2
Supply Chain
92.6
Quality
76
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (100%)
Developer
jshemas
Download Statistics
Total Downloads
49,136
Last Day
42
Last Week
685
Last Month
4,205
Last Year
35,866
GitHub Statistics
26 Stars
28 Commits
8 Forks
2 Watching
1 Branches
2 Contributors
Bundle Size
484.88 kB
Minified
150.93 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.1.0
Package Id
open-graph-scraper-lite@2.1.0
Unpacked Size
124.86 kB
Size
15.16 kB
File Count
29
NPM Version
9.8.1
Node Version
18.18.0
Publised On
15 Jul 2024
Total Downloads
Cumulative downloads
Total Downloads
49,136
Last day
2.4%
42
Compared to previous day
Last week
10.7%
685
Compared to previous week
Last month
-6.1%
4,205
Compared to previous month
Last year
2,073.7%
35,866
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
openGraphScraperLite
A simple javascript module for scraping Open Graph and Twitter Card info from given HTML. For Node.js usage, we recommend open-graph-scraper
by the same people and can do HTTP requests.
Installation
1npm install open-graph-scraper-lite --save
Usage
1const ogs = require('open-graph-scraper'); 2const options = { 3 html: `<html><head> 4 <link rel="icon" type="image/png" href="https://bar.com/foo.png" /> 5 <meta charset="utf-8" /> 6 <meta property="og:description" name="og:description" content="html description example" /> 7 <meta property="og:image" name="og:image" content="https://www.foo.com/bar.jpg" /> 8 <meta property="og:title" name="og:title" content="foobar" /> 9 <meta property="og:type" name="og:type" content="website" /> 10 </head></html>` 11}; 12ogs(options) 13 .then((data) => { 14 const { result } = data; 15 console.log('result:', result); 16 })
Results JSON
1result: { 2 ogDescription: 'html description example', 3 ogTitle: 'foobar', 4 ogType: 'website', 5 ogImage: [ { url: 'https://www.foo.com/bar.jpg', type: 'jpg' } ], 6 favicon: 'https://bar.com/foo.png', 7 charset: 'utf-8', 8 success: true 9}
Options
Name | Info | Default Value | Required |
---|---|---|---|
html | You can pass in an HTML string to run ogs on it. (use without options.url) | x | |
onlyGetOpenGraphInfo | Only fetch open graph info and don't fall back on anything else. | false | |
customMetaTags | Here you can define custom meta tags you want to scrape. | [] |
Custom Meta Tag Example
1const ogs = require('open-graph-scraper'); 2const options = { 3 html: `<html><head> 4 <link rel="icon" type="image/png" href="https://bar.com/foo.png" /> 5 <meta charset="utf-8" /> 6 <meta property="og:description" name="og:description" content="html description example" /> 7 <meta property="og:image" name="og:image" content="https://www.foo.com/bar.jpg" /> 8 <meta property="og:title" name="og:title" content="foobar" /> 9 <meta property="og:type" name="og:type" content="website" /> 10 <meta name="hostname" content="github.com"> 11 </head></html>`, 12 customMetaTags: [{ 13 multiple: false, // is there more than one of these tags on a page (normally this is false) 14 property: 'hostname', // meta tag name/property attribute 15 fieldName: 'hostnameMetaTag', // name of the result variable 16 }], 17}; 18ogs(options) 19 .then((data) => { 20 const { result } = data; 21 console.log('hostnameMetaTag:', result.customMetaTags.hostnameMetaTag); // hostnameMetaTag: github.com 22 })
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
3 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
Reason
Found 1/11 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/node.js.yml:1
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/jshemas/openGraphScraperLite/node.js.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/jshemas/openGraphScraperLite/node.js.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/node.js.yml:31
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 20 are checked with a SAST tool
Score
3.5
/10
Last Scanned on 2025-01-06
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More