diff --git a/TwitchDownloaderCore/ChatDownloader.cs b/TwitchDownloaderCore/ChatDownloader.cs index 0e20aaf0..1a3acee6 100644 --- a/TwitchDownloaderCore/ChatDownloader.cs +++ b/TwitchDownloaderCore/ChatDownloader.cs @@ -336,8 +336,8 @@ private async Task DownloadAsyncImpl(FileInfo outputFileInfo, FileStream outputF chatRoot.video.description = videoInfoResponse.data.video.description?.Replace(" \n", "\n").Replace("\n\n", "\n").TrimEnd(); chatRoot.video.title = videoInfoResponse.data.video.title; chatRoot.video.created_at = videoInfoResponse.data.video.createdAt; - chatRoot.video.start = downloadOptions.TrimBeginning ? downloadOptions.TrimBeginningTime : 0.0; - chatRoot.video.end = downloadOptions.TrimEnding ? downloadOptions.TrimEndingTime : videoInfoResponse.data.video.lengthSeconds; + chatRoot.video.start = downloadOptions.TrimBeginning ? Math.Max(0, downloadOptions.TrimBeginningTime) : 0.0; + chatRoot.video.end = downloadOptions.TrimEnding ? Math.Min(downloadOptions.TrimEndingTime, videoInfoResponse.data.video.lengthSeconds) : videoInfoResponse.data.video.lengthSeconds; chatRoot.video.length = videoInfoResponse.data.video.lengthSeconds; chatRoot.video.viewCount = videoInfoResponse.data.video.viewCount; chatRoot.video.game = videoInfoResponse.data.video.game?.displayName ?? "Unknown";