

API Reference — opengraph\_parser v0.4.3

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

API Reference opengraph\_parser v0.4.3

===================================================

[modules](#modules)

 Modules

-----------------------------

[OpenGraph](OpenGraph.html)

Fetch and parse websites to extract Open Graph meta tags.





OpenGraph — opengraph\_parser v0.4.3

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

OpenGraph

(opengraph\_parser v0.4.3)

=================================================

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)

 Summary

==========================================

[Types](#types)

----------------

[html()](#t:html/0)

[t()](#t:t/0)

[Functions](#functions)

------------------------

[parse(html)](#parse/1)

Parses the given HTML to extract the Open Graph objects.

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:html/0 "Link to this type")

html()

======

```

@type html() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [charlist](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this type](#t:t/0 "Link to this type")

t()

===

```

@type t() :: %OpenGraph{

  audio: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "audio:secure_url": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "audio:type": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "book:author": [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil,

  "book:isbn": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "book:release_date": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "book:tag": [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil,

  description: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  determiner: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  image: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  "image:alt": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "image:height": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "image:secure_url": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "image:type": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "image:width": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  locale: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "price:amount": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "price:currency": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  site_name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  title: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  type: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  url: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  video: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "video:alt": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "video:height": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "video:secure_url": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "video:type": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil,

  "video:width": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil

}

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#parse/1 "Link to this function")

parse(html)

===========

```

@spec parse([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [t](#t:t/0)()

```

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.

