Last active
April 5, 2022 12:32
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s https://ogp.me | pup 'head meta json{}' | \ | |
jq '.[] | select(.property) | select(.property | contains("og:")) | {(.property) : (.content)}' | \ | |
jq -s add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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