diff --git a/lib/pleroma/web/rich_media/parsers/meta_tags_parser.ex b/lib/pleroma/web/rich_media/parsers/meta_tags_parser.ex index 82f1cce29..fb79630e4 100644 --- a/lib/pleroma/web/rich_media/parsers/meta_tags_parser.ex +++ b/lib/pleroma/web/rich_media/parsers/meta_tags_parser.ex @@ -34,13 +34,15 @@ defp normalize_attributes(html_node, prefix, key_name, value_name) do defp maybe_put_title(%{title: _} = meta, _), do: meta - defp maybe_put_title(meta, html) do + defp maybe_put_title(meta, html) when meta != %{} do case get_page_title(html) do "" -> meta title -> Map.put_new(meta, :title, title) end end + defp maybe_put_title(meta, _), do: meta + defp get_page_title(html) do Floki.find(html, "title") |> Floki.text() end diff --git a/test/fixtures/rich_media/non_ogp_embed.html b/test/fixtures/rich_media/non_ogp_embed.html new file mode 100644 index 000000000..62a1d677a --- /dev/null +++ b/test/fixtures/rich_media/non_ogp_embed.html @@ -0,0 +1,1479 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Your Time: | ++ |
MyFreeCams Time: | ++ |
Get Listed on My Wall of Fame
+ElmosEgo 6570 Tks
+Rw2lite 4800 Tks
+Toastboi 2093 Tks
+Acoolahole 1850 Tks
+Gonodog 1299 Tks
+Pumpy_G 800 Tks
+Fowser 690 Tks
+Aquanautic 600 Tks
+Daveonthelake 535 Tks
+Wildpervert2 500 Tks
+Cloud10101 350 Tks
+Branson102 337 Tks
+TheCopperhead 329 Tks
+Mouche99 250 Tks
+The88drummer 233 Tks
+Stringtrees86 199 Tks
+Blazegordon 183 Tks
+Waiting_4 183 Tks
+Sam_mie 170 Tks
+UtterTripe 150 Tks
+Darth_penguin 150 Tks
+Playfullpurv 120 Tks
+Jordnsprings 103 Tks
+Travelinlover 100 Tks
+Da884 100 Tks
+ +Get Listed on My Wall of Fame
+ +LOVE YA ANGELS
+Monday - Outfits Strip
+Tusday - Raffle
+Wensday - Gamblers Night
+Thusday - Orgasmic Vibra or Dildos
+Friday - Wheel/Treat or Trick
+Saturday - Phrase
+Sunday - Keno and Boyfriend choice
+ + + +