Remove HTTPoison dependency

This commit is contained in:
Shadowfacts 2018-11-22 13:00:53 -05:00
parent 96b2621ff5
commit 71fa17caaf
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 0 additions and 32 deletions

View File

@ -74,37 +74,6 @@ defmodule Readability do
@type options :: list
@type headers :: list[tuple]
@doc """
summarize the primary readable content of a webpage.
"""
@spec summarize(url, options) :: Summary.t()
def summarize(url, opts \\ []) do
opts = Keyword.merge(opts, page_url: url)
httpoison_options = Application.get_env(:readability, :httpoison_options, [])
%{status_code: _, body: raw, headers: headers} = HTTPoison.get!(url, [], httpoison_options)
case is_response_markup(headers) do
true ->
html_tree =
raw
|> Helper.normalize(url: url)
article_tree =
html_tree
|> ArticleBuilder.build(opts)
%Summary{
title: title(html_tree),
authors: authors(html_tree),
article_html: readable_html(article_tree),
article_text: readable_text(article_tree)
}
_ ->
%Summary{title: nil, authors: nil, article_html: nil, article_text: raw}
end
end
@doc """
Extract MIME Type from headers

View File

@ -41,7 +41,6 @@ defmodule Readability.Mixfile do
defp deps do
[
{:floki, "~> 0.20"},
{:httpoison, "~> 0.13.0"},
{:ex_doc, "~> 0.14", only: :dev},
{:credo, "~> 0.9", only: [:dev, :test]},
{:dialyxir, "~> 0.3", only: [:dev]},