| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Readability2 is a tool for extracting and curating the primary readable content of a webpage. It's primarily a fork of readability with more up to date dependencies. Check out The Documentation for full and detailed guides
If available in Hex, the package can be installed as:
def deps do
[{:readability2, "~> 0.7"}]
enddef application do
[applications: [:readability2]]
endNote: Readability requires Elixir 1.10 or higher and OTP from 20 - 25.
url = "https://medium.com/@kenmazaika/why-im-betting-on-elixir-7c8f847b58"
summary = Readability.summarize(url)
summary.title
#=> "Why I’m betting on Elixir"
summary.authors
#=> ["Ken Mazaika"]
summary.article_html
#=>
# <div><div><p id=\"3476\"><strong><em>Background: </em></strong><em>I’ve spent...
# ...
# ...button!</em></h3></div></div>
summary.article_text
#=>
# Background: I’ve spent the past 6 years building web applications in Ruby and.....
# ...
# ... value in this article, it would mean a lot to me if you hit the recommend button!### Extract the title.
Readability.title(html)
### Extract authors.
Readability.authors(html)
### Extract the primary content with transformed html.
html
|> Readability.article
|> Readability.readable_html
### Extract only text from the primary content.
html
|> Readability.article
|> Readability.readable_text
### you can extract the primary images with Floki
html
|> Readability.article
|> Floki.find("img")
|> Floki.attribute("src")If the result is different from your expectations, you can add options to customize it.
url = "https://medium.com/@kenmazaika/why-im-betting-on-elixir-7c8f847b58"
summary = Readability.summarize(url, [clean_conditionally: false])You can find other algorithm and regex options in readability.ex
To run the test suite:
$ mix test
Contributing
NOTE: Be sure to merge the latest from "upstream" before making a pull request!
This code is under the Apache License 2.0. See http://www.apache.org/licenses/LICENSE-2.0.
| Back | FazBrowse Home | New Git URL |