diff options
Diffstat (limited to 'lib/plugins/link')
-rw-r--r-- | lib/plugins/link/html.ex | 3 | ||||
-rw-r--r-- | lib/plugins/link/quirks.ex | 26 |
2 files changed, 29 insertions, 0 deletions
diff --git a/lib/plugins/link/html.ex b/lib/plugins/link/html.ex index 78f3192..aa78810 100644 --- a/lib/plugins/link/html.ex +++ b/lib/plugins/link/html.ex @@ -144,6 +144,9 @@ defmodule Nola.Plugins.Link.HTML do defp clean_text(text) do text |> String.replace("\n", " ") + |> String.replace("<br>", " ") + |> String.replace("<br/>", " ") + |> String.replace("<br />", " ") |> HtmlEntities.decode() end end diff --git a/lib/plugins/link/quirks.ex b/lib/plugins/link/quirks.ex new file mode 100644 index 0000000..af259a2 --- /dev/null +++ b/lib/plugins/link/quirks.ex @@ -0,0 +1,26 @@ +defmodule Nola.Plugins.Link.Quirks do + # def uri(%URI{host: "x.com"} = uri) do + # %URI{uri | host: "vxtwitter.com"} + # end + + def uri(url) do + url + end + + def user_agent(host) + when host in [ + "x.com", + "vxtwitter.com", + "fxtwitter.com", + "instagram.com", + "facebook.com", + "xnstagram.com", + "ddinstagram.com" + ] do + "TelegramBot (like TwitterBot)" + end + + def user_agent(_host) do + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36" + end +end |