Furlex.Parser behaviour (Furlex v0.5.0) View Source

Link to this section Summary

Functions

Extracts the given tags from the given raw html according to the given match function

Extracts a canonical url from the given raw HTML

Groups colon-separated keys into dynamic map structures

Callbacks

Parses the given HTML, returning a map structure of structured data keys mapping to their respective values, or an error.

Link to this section Functions

Link to this function

extract(tags, html, match)

View Source

Specs

extract(List.t() | String.t(), String.t(), Function.t()) :: Map.t()

Extracts the given tags from the given raw html according to the given match function

Specs

extract_canonical(String.t()) :: nil | String.t()

Extracts a canonical url from the given raw HTML

Specs

group_keys(Map.t()) :: Map.t()

Groups colon-separated keys into dynamic map structures

Examples

iex> Application.put_env(:furlex, :group_keys?, false) iex> Furlex.Parser.group_keys %{"twitter:app:id" => 123, "twitter:app:name" => "YouTube"} %{"twitter:app:id" => 123, "twitter:app:name" => "YouTube"}

iex> Application.put_env(:furlex, :group_keys?, true) iex> Furlex.Parser.group_keys %{"twitter:app:id" => 123, "twitter:app:name" => "YouTube"} %{

"twitter" => %{
  "app" => %{
    "id" => 123,
    "name" => "YouTube"
  }
}

}

Link to this section Callbacks

Specs

parse(html :: String.t()) :: {:ok, Map.t()} | {:error, Atom.t()}

Parses the given HTML, returning a map structure of structured data keys mapping to their respective values, or an error.