OpenGraph (opengraph_parser v0.4.5)

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"}

Summary

Functions

Parses the given HTML to extract the Open Graph objects.

Types

@type html() :: String.t() | charlist()
@type t() :: %OpenGraph{
  audio: String.t() | nil,
  "audio:secure_url": String.t() | nil,
  "audio:type": String.t() | nil,
  "book:author": [String.t()] | nil,
  "book:isbn": String.t() | nil,
  "book:release_date": String.t() | nil,
  "book:tag": [String.t()] | nil,
  description: String.t() | nil,
  determiner: String.t() | nil,
  image: term(),
  "image:alt": String.t() | nil,
  "image:height": String.t() | nil,
  "image:secure_url": String.t() | nil,
  "image:type": String.t() | nil,
  "image:width": String.t() | nil,
  locale: String.t() | nil,
  "price:amount": String.t() | nil,
  "price:currency": String.t() | nil,
  "product:price:amount": String.t() | nil,
  "product:price:currency": String.t() | nil,
  site_name: String.t() | nil,
  title: String.t() | nil,
  type: String.t() | nil,
  url: String.t() | nil,
  video: String.t() | nil,
  "video:alt": String.t() | nil,
  "video:height": String.t() | nil,
  "video:secure_url": String.t() | nil,
  "video:type": String.t() | nil,
  "video:width": String.t() | nil
}

Functions

@spec 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.