From 71fa17caaf8103ef213e2c7dde4b447a48669122 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 22 Nov 2018 13:00:53 -0500 Subject: [PATCH] Remove HTTPoison dependency --- lib/readability.ex | 31 ------------------------------- mix.exs | 1 - 2 files changed, 32 deletions(-) diff --git a/lib/readability.ex b/lib/readability.ex index 4681caa..2b85395 100644 --- a/lib/readability.ex +++ b/lib/readability.ex @@ -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 diff --git a/mix.exs b/mix.exs index 7bd616f..c71ad91 100644 --- a/mix.exs +++ b/mix.exs @@ -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]},