philomena/lib/philomena_web/controllers/image/scrape_controller.ex
2019-11-28 18:19:47 -05:00

17 lines
No EOL
301 B
Elixir

defmodule PhilomenaWeb.Image.ScrapeController do
use PhilomenaWeb, :controller
alias Philomena.Scrapers
def create(conn, params) do
result =
params
|> Map.get("url")
|> to_string()
|> String.trim()
|> Scrapers.scrape!()
conn
|> json(result)
end
end