philomena/lib/philomena_web/controllers/image/scrape_controller.ex

18 lines
307 B
Elixir
Raw Permalink Normal View History

2019-11-29 00:19:47 +01:00
defmodule PhilomenaWeb.Image.ScrapeController do
use PhilomenaWeb, :controller
alias PhilomenaProxy.Scrapers
2019-11-29 00:19:47 +01:00
def create(conn, params) do
result =
params
|> Map.get("url")
|> to_string()
|> String.trim()
|> Scrapers.scrape!()
conn
|> json(result)
end
2020-01-11 05:20:19 +01:00
end