Run this notebook

Use Livebook to open this notebook and explore new ideas.

It is easy to get started, on your machine or the cloud.

Click below to open and run it in your Livebook at .

(or change your Livebook location)

# ogp ```elixir Mix.install([ {:ogp, "~> 1.1"}, {:kino, "~> 0.17.0"} ]) ``` ## Usage ### Parse HTML #### [Basic metadata](https://ogp.me/#metadata) ```elixir # Basic Metadata basic_metadata = """ <meta property="og:title" content="The Rock" /> <meta property="og:type" content="video.movie" /> <meta property="og:url" content="https://www.imdb.com/title/tt0117500/" /> <meta property="og:image" content="https://ia.media-imdb.com/images/rock.jpg" /> <meta property="og:image" content="https://ia.media-imdb.com/images/rock2.jpg" /> """ OpenGraph.parse(basic_metadata) ``` #### [Optional metadata](https://ogp.me/#optional) ```elixir # Optional Metadata optional_metadata = """ <meta property="og:audio" content="https://example.com/bond/theme.mp3" /> <meta property="og:description" content="Sean Connery found fame and fortune as the suave, sophisticated British agent, James Bond." /> <meta property="og:determiner" content="the" /> <meta property="og:locale" content="en_GB" /> <meta property="og:locale:alternate" content="fr_FR" /> <meta property="og:site_name" content="IMDb" /> <meta property="og:video" content="https://example.com/bond/trailer.swf" /> """ OpenGraph.parse(optional_metadata) ``` ### Fetch URL #### Input URL ```elixir url_input = Kino.Input.url("Enter URL") ``` ```elixir url = Kino.Input.read(url_input) OpenGraph.fetch!(url) ```
See source

Have you already installed Livebook?

If you already installed Livebook, you can configure the default Livebook location where you want to open notebooks.
Livebook up Checking status We can't reach this Livebook (but we saved your preference anyway)
Run notebook

Not yet? Install Livebook in just a minute

Livebook is open source, free, and ready to run anywhere.

Run in the cloud

on select platforms

To run on Linux, Docker, embedded devices, or Elixir’s Mix, check our README.

PLATINUM SPONSORS
SPONSORS
Code navigation with go to definition of modules and functions Read More