OpenGraph (opengraph_parser v0.2.0)

Fetch and parse websites to extract Open Graph meta tags.

The example above shows how to fetch the GitHub Open Graph rich objects.

OpenGraph.fetch("https://github.com")
%OpenGraph{description: "GitHub is where people build software. More than 15 million...",
image: "https://assets-cdn.github.com/images/modules/open_graph/github-octocat.png",
site_name: "GitHub", title: "Build software better, together", type: nil,
url: "https://github.com"}

Link to this section Summary

Functions

Parses the given HTML to extract the Open Graph objects.

Link to this section Types

Specs

html() :: String.t() | charlist()

Specs

t() :: %OpenGraph{
  audio: String.t(),
  "audio:secure_url": String.t(),
  "audio:type": String.t(),
  description: String.t(),
  determiner: String.t(),
  image: term(),
  "image:alt": String.t(),
  "image:height": String.t(),
  "image:secure_url": String.t(),
  "image:type": String.t(),
  "image:width": String.t(),
  locale: String.t(),
  site_name: String.t(),
  title: String.t(),
  type: String.t(),
  url: String.t(),
  video: String.t(),
  "video:alt": String.t(),
  "video:height": String.t(),
  "video:secure_url": String.t(),
  "video:type": String.t(),
  "video:width": String.t()
}

Link to this section Functions

Specs

parse(String.t()) :: t()

Parses the given HTML to extract the Open Graph objects.

Args:

  • html - raw HTML as a binary string or char list

This functions returns an OpenGraph struct.