# ogp

The [Open Graph protocol]( library in Elixir.


## Installation

def deps do
    {:ogp, "~> 1.0.0"}

## Usage

I recommend to run [ogp.livemd](./ogp.livemd) in [Livebook]( for detail.

- Parse HTML

iex> html = """
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="" />
<meta property="og:url" content="" />
<meta property="og:image" content="" />
<meta property="og:image" content="" />
<meta property="og:audio" content="" />
<meta property="og:description" 
  content="Sean Connery found fame and fortune as the
           suave, sophisticated British agent, James Bond." />
<meta property="og:determiner" content="the" />
<meta property="og:locale" content="en_GB" />
<meta property="og:locale:alternate" content="fr_FR" />
<meta property="og:site_name" content="IMDb" />
<meta property="og:video" content="" />
iex> OpenGraph.parse(html)                                                            
  audio: "",
  description: "Sean Connery found fame and fortune as the\n           suave, sophisticated British agent, James Bond.",
  determiner: "the",
  image: "",
  locale: "en_GB",
  site_name: "IMDb",
  title: "The Rock",
  type: "",
  url: "",
  video: ""

- Fetch URL and parse

iex> OpenGraph.fetch!("")
  audio: nil,
  description: "GitHub is where over 65 million developers shape the future of software, together. Contribute to the open source community, manage your Git repositories, review code like a pro, track bugs and feat...",
  determiner: nil,
  image: "",
  locale: nil,
  site_name: "GitHub",
  title: "GitHub: Where the world builds software",
  type: "object",
  url: "",
  video: nil