mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-08-18 18:12:23 +02:00
Replace YouTube iframe with clickable thumbnail
- Changed YouTube embed URL from embed format to watch format - Added ThumbnailUrl property to YouTubeVideoEmbedProjection using YouTube's standard thumbnail URL - Updated MessageGroupTemplate to render thumbnail image with link instead of iframe - Updated CSS to style thumbnail appropriately - Updated test to check for anchor link and thumbnail image instead of iframe Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
@@ -181,8 +181,24 @@ public class HtmlEmbedSpecs
|
||||
);
|
||||
|
||||
// Assert
|
||||
var iframeUrl = message.QuerySelector("iframe")?.GetAttribute("src");
|
||||
iframeUrl.Should().StartWith("https://www.youtube.com/embed/qOWW4OlgbvE");
|
||||
var youtubeLink = message
|
||||
.QuerySelectorAll("a")
|
||||
.FirstOrDefault(e =>
|
||||
e.GetAttribute("href")?.Contains("youtube.com/watch?v=", StringComparison.Ordinal)
|
||||
== true
|
||||
);
|
||||
|
||||
youtubeLink.Should().NotBeNull();
|
||||
youtubeLink?.GetAttribute("href").Should().Contain("qOWW4OlgbvE");
|
||||
|
||||
// Check that the thumbnail image exists
|
||||
var thumbnail = youtubeLink
|
||||
?.QuerySelectorAll("img")
|
||||
.FirstOrDefault(e =>
|
||||
e.GetAttribute("class")?.Contains("chatlog__embed-youtube-thumbnail") == true
|
||||
);
|
||||
|
||||
thumbnail.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user