summaryrefslogtreecommitdiff
path: root/lib/pleroma/web/rich_media/parsers/o_embed.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/rich_media/parsers/o_embed.ex')
-rw-r--r--lib/pleroma/web/rich_media/parsers/o_embed.ex7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/pleroma/web/rich_media/parsers/o_embed.ex b/lib/pleroma/web/rich_media/parsers/o_embed.ex
index 09eabec56..24fca56bb 100644
--- a/lib/pleroma/web/rich_media/parsers/o_embed.ex
+++ b/lib/pleroma/web/rich_media/parsers/o_embed.ex
@@ -21,6 +21,13 @@ defmodule Pleroma.Web.RichMedia.Parsers.OEmbed do
Enum.find_value(attributes, fn {k, v} -> if k == "href", do: v end)
end
+ # YouTube's oEmbed implementation is broken, requiring this hack.
+ # https://github.com/oscarotero/Embed/issues/417#issuecomment-746673027
+ defp get_oembed_data("http://www.youtube.com/oembed?" <> params) do
+ # Use HTTPS explicitly, even though YouTube returns HTTP
+ get_oembed_data("https://www.youtube.com/oembed?#{params}")
+ end
+
defp get_oembed_data(url) do
with {:ok, %Tesla.Env{body: json}} <- Pleroma.Web.RichMedia.Helpers.rich_media_get(url) do
Jason.decode(json)