open_graph v0.0.1 OpenGraph

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

Fetches the raw HTML for the given website URL

Parses the given HTML to extract the Open Graph objects

Functions

fetch(url)

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.

parse(html)

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.