X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fhtml.ex;h=bf5daa9482bdb1da279502b5a8c5b937f805d5fc;hb=7e384a2425b5188ca76aad4b97172b553ca9b640;hp=f5c6e5033fb572b0f02e717101dceafbd3c394c9;hpb=4a278cd80a02fa1882db17397bb97b155c76570e;p=akkoma diff --git a/lib/pleroma/html.ex b/lib/pleroma/html.ex index f5c6e5033..bf5daa948 100644 --- a/lib/pleroma/html.ex +++ b/lib/pleroma/html.ex @@ -58,6 +58,20 @@ defmodule Pleroma.HTML do "#{signature}#{to_string(scrubber)}" end) end + + def extract_first_external_url(object, content) do + key = "URL|#{object.id}" + + Cachex.fetch!(:scrubber_cache, key, fn _key -> + result = + content + |> Floki.filter_out("a.mention") + |> Floki.attribute("a", "href") + |> Enum.at(0) + + {:commit, {:ok, result}} + end) + end end defmodule Pleroma.HTML.Scrubber.TwitterText do