Merge branch 'develop' into feature/new-registrations-digest
[akkoma] / lib / pleroma / web / rich_media / parsers / meta_tags_parser.ex
index fb79630e411a3bb8955c8404ccf56a5d9248928b..fae3c462e72a5d098cea5dd1017d19bb7f157ad5 100644 (file)
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
 defmodule Pleroma.Web.RichMedia.Parsers.MetaTagsParser do
   def parse(html, data, prefix, error_message, key_name, value_name \\ "content") do
     meta_data =
@@ -44,6 +48,6 @@ defmodule Pleroma.Web.RichMedia.Parsers.MetaTagsParser do
   defp maybe_put_title(meta, _), do: meta
 
   defp get_page_title(html) do
-    Floki.find(html, "title") |> Floki.text()
+    Floki.find(html, "html head title") |> List.first() |> Floki.text()
   end
 end