readability v0.4.0 Readability

Readability library for extracting & curating articles.

Example

@type html :: binary

# Extract title
Readability.title(html)

# Extract authors.
Readability.authors(html)

# Extract only text from article
article = html
          |> Readability.article
          |> Readability.readable_text

# Extract article with transformed html
article = html
          |> Readability.article
          |> Readability.raw_html

Summary

Functions

Using a variety of metrics (content score, classname, element types), find the content that is most likely to be the stuff a user wants to read

Extract authors

Normalize and Parse to html tree(tuple or list)) from binary html

return raw html binary from html_tree

return attributes, tags cleaned html

return only text binary from html_tree

Extract title

Types

html_tree :: tuple | list
options :: list

Functions

article(raw_html, opts \\ [])

Specs

article(binary, options) :: html_tree

Using a variety of metrics (content score, classname, element types), find the content that is most likely to be the stuff a user wants to read

Example

iex> article_tree = Redability(html_str)
# returns article that is tuple
authors(html)

Specs

authors(binary | html_tree) :: list[binary]

Extract authors

Example

iex> authors = Readability.authors(html_str)
["José Valim", "chrismccord"]
default_options()
normalize(raw_html)

Normalize and Parse to html tree(tuple or list)) from binary html

parse(raw_html)

Specs

parse(binary) :: html_tree
raw_html(html_tree)

Specs

raw_html(html_tree) :: binary

return raw html binary from html_tree

readable_html(html_tree)

Specs

readable_html(html_tree) :: binary

return attributes, tags cleaned html

readable_text(html_tree)

Specs

readable_text(html_tree) :: binary

return only text binary from html_tree

regexes()
title(html)

Specs

title(binary | html_tree) :: binary

Extract title

Example

iex> title = Readability.title(html_str)
"Some title in html"