Skip to content

Instantly share code, notes, and snippets.

@cablehead
Last active April 5, 2022 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cablehead/749c9f78e767f582fabece76a40dc589 to your computer and use it in GitHub Desktop.
Save cablehead/749c9f78e767f582fabece76a40dc589 to your computer and use it in GitHub Desktop.
shell snippet to query a webpage and extract it's opengraph meta data as json
curl -s https://ogp.me | pup 'head meta json{}' | \
jq '.[] | select(.property) | select(.property | contains("og:")) | {(.property) : (.content)}' | \
jq -s add
{
"og:title": "Open Graph protocol",
"og:type": "website",
"og:url": "https://ogp.me/",
"og:image": "https://ogp.me/logo.png",
"og:image:type": "image/png",
"og:image:width": "300",
"og:image:height": "300",
"og:image:alt": "The Open Graph logo",
"og:description": "The Open Graph protocol enables any web page to become a rich object in a social graph."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment