summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/plugins/link/img_debrid_link.ex9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/plugins/link/img_debrid_link.ex b/lib/plugins/link/img_debrid_link.ex
index b46c430..39a60a9 100644
--- a/lib/plugins/link/img_debrid_link.ex
+++ b/lib/plugins/link/img_debrid_link.ex
@@ -2,7 +2,8 @@ defmodule Nola.Plugins.Link.ImgDebridLink do
@behaviour Nola.Plugins.Link
@impl true
- def match(uri = %URI{host: "img.debrid-link.fr", path: path}, _opts) do
+ def match(uri = %URI{host: host, path: path}, _opts)
+ when host in ["img.debrid-link.fr", "img.debrid-link.com"] do
case String.split(path, "/") do
["", ids] -> {true, %{id: ids}}
_ -> false
@@ -17,7 +18,7 @@ defmodule Nola.Plugins.Link.ImgDebridLink do
@impl true
def expand(_uri, %{id: ids}, _opts) do
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
- HTTPoison.get("https://img.debrid-link.fr/api/v1/images/#{ids}/infos", [], []),
+ HTTPoison.get("https://img.debrid-link.com/api/#{ids}/infos", [], []),
{:ok, %{"success" => true, "value" => values}} <- Jason.decode(body) do
items =
for %{"name" => name, "url" => %{"direct" => direct_url}} <- values do
@@ -26,7 +27,9 @@ defmodule Nola.Plugins.Link.ImgDebridLink do
{:ok, items}
else
- _ -> :error
+ error ->
+ Logger.info("error: #{inspect(error)}")
+ :error
end
end
end