A simple wrapper for the Mercury Web Parser API, powered by HTTPoison.
If available in Hex, the package can be installed as:
- Add
mercury
to your list of dependencies inmix.exs
:
def deps do
[
{:mercury, "~> 0.1.1"},
]
end
- Add your Mercury API key to your
config.exs
config :mercury, api_key: "<your_mercury_api_key>"
If you don't already have one, you can sign up for a Mercury Parser API key here.
To fetch the content for an article, run:
{:ok, response} = Mercury.parse("https://trackchanges.postlight.com/extracting-content-from-the-chaos-of-the-web-introducing-the-mercury-web-parser-e920a1db7f86")
# -- OR --
%{body: body} = Mercury.parse!("https://trackchanges.postlight.com/extracting-content-from-the-chaos-of-the-web-introducing-the-mercury-web-parser-e920a1db7f86")