feat(scrapers/twitter): highest quality image url (#207)

This commit is contained in:
mdashlw 2024-03-14 16:28:59 +03:00 committed by GitHub
parent 886539c514
commit 3b2f5f36cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,7 +17,7 @@ defmodule Philomena.Scrapers.Twitter do
images = images =
Enum.map(json["tweet"]["media"]["photos"], fn p -> Enum.map(json["tweet"]["media"]["photos"], fn p ->
%{ %{
url: large_format(p["url"]), url: "#{p["url"]}:orig",
camo_url: Camo.Image.image_url(p["url"]) camo_url: Camo.Image.image_url(p["url"])
} }
end) end)
@ -28,8 +28,4 @@ defmodule Philomena.Scrapers.Twitter do
images: images images: images
} }
end end
defp large_format(str) do
String.replace_suffix(str, ".jpg", "?format=jpg&name=large")
end
end end