OpenGraph (open_graph v0.0.5) View Source

Fetch and parse websites to extract Open Graph meta tags.

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

iex> OpenGraph.fetch("https://github.com")
{:ok, %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

Fetches the raw HTML for the given website URL.

Parses the given HTML to extract the Open Graph objects.

Link to this section Functions

Fetches the raw HTML for the given website URL.

Args:

  • url - target URL as a binary string or char list

This functions returns {:ok, %OpenGraph{...}} if the request is successful, {:error, reason} otherwise.

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.