summaryrefslogtreecommitdiff
path: root/lib/plugins/link/quirks.ex
blob: 5acfdac27818c280764d2d2cbb7a644e425d6823 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
defmodule Nola.Plugins.Link.Quirks do
  # def uri(%URI{host: "x.com"} = uri) do
  #  %URI{uri | host: "vxtwitter.com"}
  # end

  # reddit: new reddit don't have titles for pages we don't handle in the reddit module
  # fallback to old. which has nice titles
  def uri(%URI{host: reddit} = uri) when reddit in ["www.reddit.com", "reddit.com"] do
    %URI{uri | host: "old.reddit.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