Skip to content
/ opengraph Public

❗ This is a read-only mirror of the CRAN R package repository. opengraph — Process Metadata from the Open Graph Protocol. Homepage: https://github.com/christopherkenny/opengraphhttps://christophertkenny.com/opengraph/

License

Notifications You must be signed in to change notification settings

cran/opengraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opengraph

opengraph status badge Lifecycle: stable R-CMD-check Codecov test coverage

The goal of opengraph is to read and process Open Graph Protocol metadata on websites.

Installation

You can install the development version of opengraph from GitHub with:

# install.packages('pak')
pak::pak('christopherkenny/opengraph')

Example

This is a relatively simple package. The main function is og_parse() which returns a named vector of Open Graph metadata found on a given webpage.

library(opengraph)
url <- 'https://christophertkenny.com/opengraph/'
og_parse(url)
#>                                                           title 
#>                               "Process the Open Graph Protocol" 
#>                                                     description 
#> "Parse metadata on websites which use the Open Graph Protocol." 
#>                                                           image 
#>               "http://christophertkenny.com/opengraph/logo.png"

The package can also read specific Open Graph properties with og_property(). Properties can be prefixed with og: or not.

og_property(url, 'og:title')
#> [1] "Process the Open Graph Protocol"
og_property(url, 'title')
#> [1] "Process the Open Graph Protocol"

If there is no Open Graph metadata found, og_parse() will return an empty named vector.

og_parse('https://cran.r-project.org/')
#> named character(0)

About

❗ This is a read-only mirror of the CRAN R package repository. opengraph — Process Metadata from the Open Graph Protocol. Homepage: https://github.com/christopherkenny/opengraphhttps://christophertkenny.com/opengraph/

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages