GitHub - joenas/readability.cr: Port of ruby-readability's port of arc90's readability project to Crystal (original) (raw)

readability

Build Status

Crystal port of @cantino's port of arc90's readability project

Still a WIP!

document#images is not implemented. Specs are not passing and some parts of them are probably incorrect... There's also a monkey patch for LibXML while waiting for the changes in crystal-lang/crystal#6910) to be released.

Installation

Add this to your application's shard.yml:

dependencies: readability: github: joenas/readability.cr version: 0.2.0

Usage

require "readability" require "http/client"

response = HTTP::Client.get "http://www.example.com"

document = Readability::Document.new(response.body)

puts document.content puts document.meta_image

With Options

options = Readability::Options.new( tags: %w[article p span div document b strong em h1 h2 h3 h4], remove_empty_nodes: true, attributes: %w[], blacklist: %w[figcaption figure] ) document = Readability::Document.new(response.body, options)

Options

You may provide options to Readability::Options.new, including:

Contributing

  1. Fork it (https://github.com/joenas/readability.cr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors