Skip to content

Instantly share code, notes, and snippets.

Last active August 12, 2023 18:09
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save goofansu/42276a378588be1c5a7423bfb16ac88f to your computer and use it in GitHub Desktop.


  {:kino, "~> 0.6.1"},
  {:ogp, "~> 1.0"}
Resolving Hex dependencies...
Dependency resolution completed:
  castore 0.1.17
  finch 0.12.0
  floki 0.32.1
  hpax 0.1.1
  html_entities 0.5.2
  kino 0.6.1
  mime 2.0.2
  mint 1.4.2
  nimble_options 0.4.0
  nimble_pool 0.2.6
  ogp 1.0.2
  table 0.1.1
  telemetry 1.1.0
* Getting kino (Hex package)
* Getting ogp (Hex package)
* Getting finch (Hex package)
* Getting floki (Hex package)
* Getting html_entities (Hex package)
* Getting castore (Hex package)
* Getting mime (Hex package)
* Getting mint (Hex package)
* Getting nimble_options (Hex package)
* Getting nimble_pool (Hex package)
* Getting telemetry (Hex package)
* Getting hpax (Hex package)
* Getting table (Hex package)
You have added/upgraded packages you could sponsor, run `mix hex.sponsor` to learn more
==> nimble_options
Compiling 3 files (.ex)
Generated nimble_options app
==> hpax
Compiling 4 files (.ex)
Generated hpax app
==> nimble_pool
Compiling 2 files (.ex)
Generated nimble_pool app
===> Analyzing applications...
===> Compiling telemetry
==> html_entities
Compiling 2 files (.ex)
Generated html_entities app
==> floki
Compiling 1 file (.xrl)
Compiling 2 files (.erl)
Compiling 27 files (.ex)
Generated floki app
==> table
Compiling 3 files (.ex)
Generated table app
==> kino
Compiling 27 files (.ex)
Generated kino app
==> castore
Compiling 1 file (.ex)
Generated castore app
==> mint
Compiling 1 file (.erl)
Compiling 19 files (.ex)
Generated mint app
==> mime
Compiling 1 file (.ex)
Generated mime app
==> finch
Compiling 13 files (.ex)
Generated finch app
==> ogp
Compiling 3 files (.ex)
Generated ogp app


Parse HTML

Basic metadata

# Basic Metadata

basic_metadata = """
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="" />
<meta property="og:url" content="" />
<meta property="og:image" content="" />
<meta property="og:image" content="" />

  audio: nil,
  description: nil,
  determiner: nil,
  image: "",
  locale: nil,
  site_name: nil,
  title: "The Rock",
  type: "",
  url: "",
  video: nil

Optional metadata

# Optional Metadata

optional_metadata = """
<meta property="og:audio" content="" />
<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="" />

  audio: "",
  description: "Sean Connery found fame and fortune as the\n           suave, sophisticated British agent, James Bond.",
  determiner: "the",
  image: nil,
  locale: "en_GB",
  site_name: "IMDb",
  title: nil,
  type: nil,
  url: nil,
  video: ""

Fetch URL

Input URL

url_input = Kino.Input.text("URL")
url = |> String.trim("\n")
  audio: nil,
  description: "GitHub is where over 83 million developers shape the future of software, together. Contribute to the open source community, manage your Git repositories, review code like a pro, track bugs and feat...",
  determiner: nil,
  image: "",
  locale: nil,
  site_name: "GitHub",
  title: "GitHub: Where the world builds software",
  type: "object",
  url: "",
  video: nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment