From 7c04db40f80dbe40e38fcffe318a1cb440c595c8 Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 13 Feb 2024 18:59:51 +0200 Subject: [PATCH] Skip Twitch clip projections because they can't be rendered locally (#1200) --- .../Specs/HtmlEmbedSpecs.cs | 2 +- .../Exporting/MessageGroupTemplate.cshtml | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs index 765bc52..9de8c0b 100644 --- a/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs +++ b/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs @@ -150,7 +150,7 @@ public class HtmlEmbedSpecs iframeUrl.Should().StartWith("https://open.spotify.com/embed/track/1LHZMWefF9502NPfArRfvP"); } - [Fact] + [Fact(Skip = "Twitch does not allow embeds from inside local HTML files")] public async Task I_can_export_a_channel_that_contains_a_message_with_a_Twitch_clip_embed() { // https://github.com/Tyrrrz/DiscordChatExporter/issues/1196 diff --git a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml index 45f4738..e073055 100644 --- a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml +++ b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml @@ -365,15 +365,6 @@ } - // Twitch embed - else if (embed.TryGetTwitchClip() is { } twitchClipEmbed) - { -
-
- -
-
- } // YouTube embed else if (embed.TryGetYouTubeVideo() is { } youTubeVideoEmbed) { @@ -457,7 +448,10 @@ } // Generic video embed - else if (embed.Kind == EmbedKind.Video && !string.IsNullOrWhiteSpace(embed.Url)) + else if (embed.Kind == EmbedKind.Video + && !string.IsNullOrWhiteSpace(embed.Url) + // Twitch clips cannot be embedded in local HTML files + && embed.TryGetTwitchClip() is null) { var embedVideoUrl = embed.Video?.ProxyUrl ?? embed.Video?.Url ??