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

@notamit/ogpparser

v1.1.3

Published

A simple package to extract Open Graph Protocol (ogp.me) metadata from a given URL that can be used to generate link previews.

Downloads

4

Readme

OGP PARSER

npm npm npm npm npm

A npm package that extracts Open Graph Protocol (ogp.me) metadata from a given URL that can be used to generate link previews.

Installation

To install @notamit/ogpparser

  # with npm:
  npm install @notamit/ogpparser --save

  # with yarn:
  yarn add @notamit/ogpparser

  # with pnpm:
  pnpm add @notamit/ogpparser

  # with bun:
  bun add @notamit/ogpparser

🧰 Usage

@notamit/ogpparser exports parse async function. It requires 1 argument, the URL of the page you want to extract metadata from. It returns a promise that resolves to an object containing the metadata.

Inside your .js/.ts file, import the parse function and use it.

import parse from "@notamit/ogpparser";
async function test() {
    const metadata=await parse('https://www.youtube.com/watch?v=znWS3zkdrq4');
    return metadata;
);
test().then(res =>{
    console.log(res);
}).catch(err =>{
    //handling errors
    console.error(err);
})
}

Sample response:

{
  title: 'Chai aur code Live ☕️ - YouTube',
  og: {
    'og:site_name': 'YouTube',
    'og:url': 'https://www.youtube.com/watch?v=znWS3zkdrq4',
    'og:title': 'Chai aur code Live ☕️',
    'og:image': 'https://i.ytimg.com/vi/znWS3zkdrq4/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGGUgUShHMA8=&rs=AOn4CLBXY4-LhSGoyrs_IWkZeZzimQIANA',
    'og:image:width': '1280',
    'og:image:height': '720',
    'og:description': 'https://courses.chaicode.com/learn/Interview-Preparation-With-JavascriptCoupon: YOUTUBE200',
    'og:type': 'video.other',
    'og:video:url': 'https://www.youtube.com/embed/znWS3zkdrq4',
    'og:video:secure_url': 'https://www.youtube.com/embed/znWS3zkdrq4',
    'og:video:type': 'text/html',
    'og:video:width': '1280',
    'og:video:height': '720'
  },
  twitter: {
    'twitter:card': 'player',
    'twitter:site': '@youtube',
    'twitter:url': 'https://www.youtube.com/watch?v=znWS3zkdrq4',
    'twitter:title': 'Chai aur code Live ☕️',
    'twitter:description': 'https://courses.chaicode.com/learn/Interview-Preparation-With-JavascriptCoupon: YOUTUBE200',
    'twitter:image': 'https://i.ytimg.com/vi/znWS3zkdrq4/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGGUgUShHMA8=&rs=AOn4CLBXY4-LhSGoyrs_IWkZeZzimQIANA',
    'twitter:app:name:iphone': 'YouTube',
    'twitter:app:id:iphone': '544007664',
    'twitter:app:name:ipad': 'YouTube',
    'twitter:app:id:ipad': '544007664',
    'twitter:app:url:iphone': 'vnd.youtube://www.youtube.com/watch?v=znWS3zkdrq4&feature=applinks',
    'twitter:app:url:ipad': 'vnd.youtube://www.youtube.com/watch?v=znWS3zkdrq4&feature=applinks',
    'twitter:app:name:googleplay': 'YouTube',
    'twitter:app:id:googleplay': 'com.google.android.youtube',
    'twitter:app:url:googleplay': 'https://www.youtube.com/watch?v=znWS3zkdrq4',
    'twitter:player': 'https://www.youtube.com/embed/znWS3zkdrq4',
    'twitter:player:width': '1280',
    'twitter:player:height': '720'
  },
  alternateImage: 'https://res.cloudinary.com/dejzy9q65/image/upload/v1706806074/preview_ha6nqf.png',
  description: 'https://courses.chaicode.com/learn/Interview-Preparation-With-JavascriptCoupon: YOUTUBE200',
  keywords: 'video, sharing, camera phone, video phone, free, upload'
}

PACKAGE

@notamit/ogpparser

PARAMS

Parameters

| Name | Description | Location | Sample Value | |------|----------------------------------------------------|----------|---------------------------------------------| | Url | Link of the page that you want to extract metadata | Argument | https://www.youtube.com/watch?v=znWS3zkdrq4 |

⚙️ Configuration

| Setting | Value | | ----------------- | ------------------ | | Runtime | Nodejs>=(18.12.1) | | Entrypoint | src/index.ts | | Build Commands | npm run start |

Author

Amit Jimiwal