diff --git a/YoutubeExplode.Converter.Tests/GeneralSpecs.cs b/YoutubeExplode.Converter.Tests/GeneralSpecs.cs index 446e1bdf..7657193f 100644 --- a/YoutubeExplode.Converter.Tests/GeneralSpecs.cs +++ b/YoutubeExplode.Converter.Tests/GeneralSpecs.cs @@ -109,12 +109,10 @@ public async Task I_can_download_a_video_as_a_single_mp4_file_with_multiple_stre .Take(3) .ToArray(); - await youtube - .Videos - .DownloadAsync( - videoStreamInfos.Concat(audioStreamInfos).ToArray(), - new ConversionRequestBuilder(filePath).Build() - ); + await youtube.Videos.DownloadAsync( + videoStreamInfos.Concat(audioStreamInfos).ToArray(), + new ConversionRequestBuilder(filePath).Build() + ); // Assert MediaFormat.IsMp4File(filePath).Should().BeTrue(); @@ -155,12 +153,10 @@ public async Task I_can_download_a_video_as_a_single_webm_file_with_multiple_str .Take(3) .ToArray(); - await youtube - .Videos - .DownloadAsync( - videoStreamInfos.Concat(audioStreamInfos).ToArray(), - new ConversionRequestBuilder(filePath).Build() - ); + await youtube.Videos.DownloadAsync( + videoStreamInfos.Concat(audioStreamInfos).ToArray(), + new ConversionRequestBuilder(filePath).Build() + ); // Assert MediaFormat.IsWebMFile(filePath).Should().BeTrue(); @@ -184,16 +180,14 @@ public async Task I_can_download_a_video_using_custom_conversion_settings() var filePath = Path.Combine(dir.Path, "video.mp3"); // Act - await youtube - .Videos - .DownloadAsync( - "9bZkp7q19f0", - filePath, - o => - o.SetFFmpegPath(FFmpeg.FilePath) - .SetContainer("mp4") - .SetPreset(ConversionPreset.UltraFast) - ); + await youtube.Videos.DownloadAsync( + "9bZkp7q19f0", + filePath, + o => + o.SetFFmpegPath(FFmpeg.FilePath) + .SetContainer("mp4") + .SetPreset(ConversionPreset.UltraFast) + ); // Assert MediaFormat.IsMp4File(filePath).Should().BeTrue(); @@ -211,16 +205,14 @@ public async Task I_can_try_to_download_a_video_and_get_an_error_if_the_conversi // Act & assert var ex = await Assert.ThrowsAnyAsync( async () => - await youtube - .Videos - .DownloadAsync( - "9bZkp7q19f0", - filePath, - o => - o.SetFFmpegPath(FFmpeg.FilePath) - .SetContainer("invalid_format") - .SetPreset(ConversionPreset.UltraFast) - ) + await youtube.Videos.DownloadAsync( + "9bZkp7q19f0", + filePath, + o => + o.SetFFmpegPath(FFmpeg.FilePath) + .SetContainer("invalid_format") + .SetPreset(ConversionPreset.UltraFast) + ) ); Directory.EnumerateFiles(dir.Path, "*", SearchOption.AllDirectories).Should().BeEmpty(); diff --git a/YoutubeExplode.Converter.Tests/SubtitleSpecs.cs b/YoutubeExplode.Converter.Tests/SubtitleSpecs.cs index 1682de97..d93d4031 100644 --- a/YoutubeExplode.Converter.Tests/SubtitleSpecs.cs +++ b/YoutubeExplode.Converter.Tests/SubtitleSpecs.cs @@ -36,9 +36,11 @@ public async Task I_can_download_a_video_as_a_single_mp4_file_with_subtitles() var trackInfos = trackManifest.Tracks; // Act - await youtube - .Videos - .DownloadAsync(streamInfos, trackInfos, new ConversionRequestBuilder(filePath).Build()); + await youtube.Videos.DownloadAsync( + streamInfos, + trackInfos, + new ConversionRequestBuilder(filePath).Build() + ); // Assert MediaFormat.IsMp4File(filePath).Should().BeTrue(); @@ -73,9 +75,11 @@ public async Task I_can_download_a_video_as_a_single_webm_file_with_subtitles() var trackInfos = trackManifest.Tracks; // Act - await youtube - .Videos - .DownloadAsync(streamInfos, trackInfos, new ConversionRequestBuilder(filePath).Build()); + await youtube.Videos.DownloadAsync( + streamInfos, + trackInfos, + new ConversionRequestBuilder(filePath).Build() + ); // Assert MediaFormat.IsWebMFile(filePath).Should().BeTrue(); diff --git a/YoutubeExplode.Converter.Tests/YoutubeExplode.Converter.Tests.csproj b/YoutubeExplode.Converter.Tests/YoutubeExplode.Converter.Tests.csproj index 0d8dcd6b..dd60ecb5 100644 --- a/YoutubeExplode.Converter.Tests/YoutubeExplode.Converter.Tests.csproj +++ b/YoutubeExplode.Converter.Tests/YoutubeExplode.Converter.Tests.csproj @@ -10,13 +10,13 @@ - + - - + + diff --git a/YoutubeExplode.Converter/Converter.cs b/YoutubeExplode.Converter/Converter.cs index 405181be..aa8a2349 100644 --- a/YoutubeExplode.Converter/Converter.cs +++ b/YoutubeExplode.Converter/Converter.cs @@ -193,9 +193,12 @@ private async ValueTask PopulateStreamInputsAsync( streamInputs.Add(streamInput); - await videoClient - .Streams - .DownloadAsync(streamInfo, streamInput.FilePath, streamProgress, cancellationToken); + await videoClient.Streams.DownloadAsync( + streamInfo, + streamInput.FilePath, + streamProgress, + cancellationToken + ); } progress?.Report(1); @@ -225,9 +228,12 @@ private async ValueTask PopulateSubtitleInputsAsync( subtitleInputs.Add(subtitleInput); - await videoClient - .ClosedCaptions - .DownloadAsync(trackInfo, subtitleInput.FilePath, trackProgress, cancellationToken); + await videoClient.ClosedCaptions.DownloadAsync( + trackInfo, + subtitleInput.FilePath, + trackProgress, + cancellationToken + ); } progress?.Report(1); diff --git a/YoutubeExplode.Converter/Utils/Extensions/LanguageExtensions.cs b/YoutubeExplode.Converter/Utils/Extensions/LanguageExtensions.cs index 8b999eb4..ed141fd0 100644 --- a/YoutubeExplode.Converter/Utils/Extensions/LanguageExtensions.cs +++ b/YoutubeExplode.Converter/Utils/Extensions/LanguageExtensions.cs @@ -9,9 +9,10 @@ internal static class LanguageExtensions { // YouTube provides either a two-letter or a three-letter language code, // which may or may not also contain a region identifier. - var regionNeutralLanguageCode = language - .Code - .SubstringUntil("-", StringComparison.OrdinalIgnoreCase); + var regionNeutralLanguageCode = language.Code.SubstringUntil( + "-", + StringComparison.OrdinalIgnoreCase + ); // Already a three-letter code if (regionNeutralLanguageCode.Length == 3) diff --git a/YoutubeExplode.Converter/YoutubeExplode.Converter.csproj b/YoutubeExplode.Converter/YoutubeExplode.Converter.csproj index 1ef60865..4e03d49d 100644 --- a/YoutubeExplode.Converter/YoutubeExplode.Converter.csproj +++ b/YoutubeExplode.Converter/YoutubeExplode.Converter.csproj @@ -18,7 +18,7 @@ - + diff --git a/YoutubeExplode.Demo.Cli/YoutubeExplode.Demo.Cli.csproj b/YoutubeExplode.Demo.Cli/YoutubeExplode.Demo.Cli.csproj index ef559415..3f8f4003 100644 --- a/YoutubeExplode.Demo.Cli/YoutubeExplode.Demo.Cli.csproj +++ b/YoutubeExplode.Demo.Cli/YoutubeExplode.Demo.Cli.csproj @@ -7,7 +7,7 @@ - + diff --git a/YoutubeExplode.Demo.Gui/ViewModels/MainViewModel.cs b/YoutubeExplode.Demo.Gui/ViewModels/MainViewModel.cs index 5c005bb5..e5b3d487 100644 --- a/YoutubeExplode.Demo.Gui/ViewModels/MainViewModel.cs +++ b/YoutubeExplode.Demo.Gui/ViewModels/MainViewModel.cs @@ -316,10 +316,11 @@ private async Task DownloadClosedCaptionTrackAsync(ClosedCaptionTrackInfo trackI var progressHandler = new Progress(p => Progress = p); // Download to file - await _youtube - .Videos - .ClosedCaptions - .DownloadAsync(trackInfo, filePath, progressHandler); + await _youtube.Videos.ClosedCaptions.DownloadAsync( + trackInfo, + filePath, + progressHandler + ); } finally { diff --git a/YoutubeExplode.Demo.Gui/YoutubeExplode.Demo.Gui.csproj b/YoutubeExplode.Demo.Gui/YoutubeExplode.Demo.Gui.csproj index 0e8939dd..baa904b3 100644 --- a/YoutubeExplode.Demo.Gui/YoutubeExplode.Demo.Gui.csproj +++ b/YoutubeExplode.Demo.Gui/YoutubeExplode.Demo.Gui.csproj @@ -12,7 +12,7 @@ - + diff --git a/YoutubeExplode.Tests/ClosedCaptionSpecs.cs b/YoutubeExplode.Tests/ClosedCaptionSpecs.cs index 5472dfd0..3b86dead 100644 --- a/YoutubeExplode.Tests/ClosedCaptionSpecs.cs +++ b/YoutubeExplode.Tests/ClosedCaptionSpecs.cs @@ -17,17 +17,15 @@ public async Task I_can_get_the_list_of_available_closed_caption_tracks_on_a_vid var youtube = new YoutubeClient(); // Act - var manifest = await youtube - .Videos - .ClosedCaptions - .GetManifestAsync(VideoIds.WithClosedCaptions); + var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync( + VideoIds.WithClosedCaptions + ); // Assert manifest.Tracks.Should().HaveCountGreaterOrEqualTo(3); manifest - .Tracks - .Should() + .Tracks.Should() .Contain( t => t.Language.Code == "en" @@ -36,8 +34,7 @@ public async Task I_can_get_the_list_of_available_closed_caption_tracks_on_a_vid ); manifest - .Tracks - .Should() + .Tracks.Should() .Contain( t => t.Language.Code == "en-US" @@ -46,8 +43,7 @@ public async Task I_can_get_the_list_of_available_closed_caption_tracks_on_a_vid ); manifest - .Tracks - .Should() + .Tracks.Should() .Contain( t => t.Language.Code == "es-419" @@ -63,10 +59,9 @@ public async Task I_can_get_a_specific_closed_caption_track_from_a_video() var youtube = new YoutubeClient(); // Act - var manifest = await youtube - .Videos - .ClosedCaptions - .GetManifestAsync(VideoIds.WithClosedCaptions); + var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync( + VideoIds.WithClosedCaptions + ); var trackInfo = manifest.GetByLanguage("en-US"); var track = await youtube.Videos.ClosedCaptions.GetAsync(trackInfo); @@ -82,10 +77,9 @@ public async Task I_can_get_a_specific_closed_caption_track_from_a_video_that_ha var youtube = new YoutubeClient(); // Act - var manifest = await youtube - .Videos - .ClosedCaptions - .GetManifestAsync(VideoIds.WithBrokenClosedCaptions); + var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync( + VideoIds.WithBrokenClosedCaptions + ); var trackInfo = manifest.GetByLanguage("en"); var track = await youtube.Videos.ClosedCaptions.GetAsync(trackInfo); @@ -101,10 +95,9 @@ public async Task I_can_get_an_individual_closed_caption_from_a_video() var youtube = new YoutubeClient(); // Act - var manifest = await youtube - .Videos - .ClosedCaptions - .GetManifestAsync(VideoIds.WithClosedCaptions); + var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync( + VideoIds.WithClosedCaptions + ); var trackInfo = manifest.GetByLanguage("en-US"); var track = await youtube.Videos.ClosedCaptions.GetAsync(trackInfo); @@ -122,10 +115,9 @@ public async Task I_can_get_an_individual_closed_caption_part_from_a_video() var youtube = new YoutubeClient(); // Act - var manifest = await youtube - .Videos - .ClosedCaptions - .GetManifestAsync(VideoIds.WithClosedCaptions); + var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync( + VideoIds.WithClosedCaptions + ); var trackInfo = manifest.GetByLanguage("en"); var track = await youtube.Videos.ClosedCaptions.GetAsync(trackInfo); @@ -146,10 +138,9 @@ public async Task I_can_download_a_specific_closed_caption_track_from_a_video() var youtube = new YoutubeClient(); // Act - var manifest = await youtube - .Videos - .ClosedCaptions - .GetManifestAsync(VideoIds.WithClosedCaptions); + var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync( + VideoIds.WithClosedCaptions + ); var trackInfo = manifest.GetByLanguage("en-US"); await youtube.Videos.ClosedCaptions.DownloadAsync(trackInfo, file.Path); diff --git a/YoutubeExplode.Tests/PlaylistSpecs.cs b/YoutubeExplode.Tests/PlaylistSpecs.cs index ce922e8d..5772a62d 100644 --- a/YoutubeExplode.Tests/PlaylistSpecs.cs +++ b/YoutubeExplode.Tests/PlaylistSpecs.cs @@ -29,8 +29,7 @@ public async Task I_can_get_the_metadata_of_a_playlist() playlist.Author?.ChannelUrl.Should().NotBeNullOrWhiteSpace(); playlist.Author?.ChannelTitle.Should().Be("Google Analytics"); playlist - .Description - .Should() + .Description.Should() .Contain("Digital Analytics Fundamentals course on Analytics Academy"); playlist.Thumbnails.Should().NotBeEmpty(); } diff --git a/YoutubeExplode.Tests/StreamSpecs.cs b/YoutubeExplode.Tests/StreamSpecs.cs index 0c2b45c8..d57759e3 100644 --- a/YoutubeExplode.Tests/StreamSpecs.cs +++ b/YoutubeExplode.Tests/StreamSpecs.cs @@ -21,10 +21,9 @@ public async Task I_can_get_the_list_of_available_streams_of_a_video() var youtube = new YoutubeClient(); // Act - var manifest = await youtube - .Videos - .Streams - .GetManifestAsync(VideoIds.WithHighQualityStreams); + var manifest = await youtube.Videos.Streams.GetManifestAsync( + VideoIds.WithHighQualityStreams + ); // Assert manifest.Streams.Should().NotBeEmpty(); diff --git a/YoutubeExplode.Tests/VideoSpecs.cs b/YoutubeExplode.Tests/VideoSpecs.cs index c85ee810..7a514b8e 100644 --- a/YoutubeExplode.Tests/VideoSpecs.cs +++ b/YoutubeExplode.Tests/VideoSpecs.cs @@ -32,8 +32,7 @@ public async Task I_can_get_the_metadata_of_a_video() video.Duration.Should().BeCloseTo(TimeSpan.FromSeconds(252), TimeSpan.FromSeconds(1)); video.Thumbnails.Should().NotBeEmpty(); video - .Keywords - .Should() + .Keywords.Should() .BeEquivalentTo( "PSY", "싸이", diff --git a/YoutubeExplode.Tests/YoutubeExplode.Tests.csproj b/YoutubeExplode.Tests/YoutubeExplode.Tests.csproj index 1d216438..aebf8ba5 100644 --- a/YoutubeExplode.Tests/YoutubeExplode.Tests.csproj +++ b/YoutubeExplode.Tests/YoutubeExplode.Tests.csproj @@ -11,13 +11,13 @@ - + - - + + diff --git a/YoutubeExplode/Bridge/PlayerSource.cs b/YoutubeExplode/Bridge/PlayerSource.cs index 6e9b4c47..f39e6cee 100644 --- a/YoutubeExplode/Bridge/PlayerSource.cs +++ b/YoutubeExplode/Bridge/PlayerSource.cs @@ -18,8 +18,7 @@ public CipherManifest? CipherManifest var signatureTimestamp = Regex .Match(content, @"(?:signatureTimestamp|sts):(\d{5})") .Groups[1] - .Value - .NullIfWhiteSpace(); + .Value.NullIfWhiteSpace(); if (string.IsNullOrWhiteSpace(signatureTimestamp)) return null; @@ -34,8 +33,7 @@ public CipherManifest? CipherManifest RegexOptions.Singleline ) .Groups[0] - .Value - .NullIfWhiteSpace(); + .Value.NullIfWhiteSpace(); if (string.IsNullOrWhiteSpace(cipherCallsite)) return null; @@ -60,8 +58,7 @@ public CipherManifest? CipherManifest RegexOptions.Singleline ) .Groups[0] - .Value - .NullIfWhiteSpace(); + .Value.NullIfWhiteSpace(); if (string.IsNullOrWhiteSpace(cipherDefinition)) return null; @@ -74,8 +71,7 @@ public CipherManifest? CipherManifest RegexOptions.Singleline ) .Groups[1] - .Value - .NullIfWhiteSpace(); + .Value.NullIfWhiteSpace(); // Identify the splice cipher function var spliceFuncName = Regex @@ -85,8 +81,7 @@ public CipherManifest? CipherManifest RegexOptions.Singleline ) .Groups[1] - .Value - .NullIfWhiteSpace(); + .Value.NullIfWhiteSpace(); // Identify the reverse cipher function var reverseFuncName = Regex @@ -96,8 +91,7 @@ public CipherManifest? CipherManifest RegexOptions.Singleline ) .Groups[1] - .Value - .NullIfWhiteSpace(); + .Value.NullIfWhiteSpace(); var operations = new List(); @@ -115,8 +109,7 @@ public CipherManifest? CipherManifest var index = Regex .Match(statement, @"\([$_\w]+,(\d+)\)") .Groups[1] - .Value - .ParseInt(); + .Value.ParseInt(); operations.Add(new SwapCipherOperation(index)); } else if (string.Equals(calledFuncName, spliceFuncName, StringComparison.Ordinal)) @@ -124,8 +117,7 @@ public CipherManifest? CipherManifest var index = Regex .Match(statement, @"\([$_\w]+,(\d+)\)") .Groups[1] - .Value - .ParseInt(); + .Value.ParseInt(); operations.Add(new SpliceCipherOperation(index)); } else if (string.Equals(calledFuncName, reverseFuncName, StringComparison.Ordinal)) diff --git a/YoutubeExplode/Bridge/VideoWatchPage.cs b/YoutubeExplode/Bridge/VideoWatchPage.cs index 37724272..b53e9193 100644 --- a/YoutubeExplode/Bridge/VideoWatchPage.cs +++ b/YoutubeExplode/Bridge/VideoWatchPage.cs @@ -31,9 +31,7 @@ internal partial class VideoWatchPage(IHtmlDocument content) [Lazy] public long? LikeCount => content - .Source - .Text - .Pipe( + .Source.Text.Pipe( s => Regex .Match( @@ -49,9 +47,7 @@ internal partial class VideoWatchPage(IHtmlDocument content) ?.StripNonDigit() .ParseLongOrNull() ?? content - .Source - .Text - .Pipe( + .Source.Text.Pipe( s => Regex .Match( @@ -70,9 +66,7 @@ along with ([\d,\.]+) other people" [Lazy] public long? DislikeCount => content - .Source - .Text - .Pipe( + .Source.Text.Pipe( s => Regex .Match( diff --git a/YoutubeExplode/Channels/ChannelClient.cs b/YoutubeExplode/Channels/ChannelClient.cs index 62c85615..0f347c1c 100644 --- a/YoutubeExplode/Channels/ChannelClient.cs +++ b/YoutubeExplode/Channels/ChannelClient.cs @@ -49,8 +49,7 @@ private Channel Get(ChannelPage channelPage) .ToArray() .LastOrDefault() ?.Groups[1] - .Value - .NullIfWhiteSpace() + .Value.NullIfWhiteSpace() ?.ParseIntOrNull() ?? 100; var thumbnails = new[] { new Thumbnail(logoUrl, new Resolution(logoSize, logoSize)) }; diff --git a/YoutubeExplode/Channels/ChannelHandle.cs b/YoutubeExplode/Channels/ChannelHandle.cs index 44a7d80b..829469ef 100644 --- a/YoutubeExplode/Channels/ChannelHandle.cs +++ b/YoutubeExplode/Channels/ChannelHandle.cs @@ -42,8 +42,7 @@ private static bool IsValid(string channelHandle) => var regularMatch = Regex .Match(channelHandleOrUrl, @"youtube\..+?/@(.*?)(?:\?|&|/|$)") .Groups[1] - .Value - .Pipe(WebUtility.UrlDecode); + .Value.Pipe(WebUtility.UrlDecode); if (!string.IsNullOrWhiteSpace(regularMatch) && IsValid(regularMatch)) return regularMatch; diff --git a/YoutubeExplode/Channels/ChannelId.cs b/YoutubeExplode/Channels/ChannelId.cs index 1047ec1e..5ba34824 100644 --- a/YoutubeExplode/Channels/ChannelId.cs +++ b/YoutubeExplode/Channels/ChannelId.cs @@ -44,8 +44,7 @@ private static bool IsValid(string channelId) => var regularMatch = Regex .Match(channelIdOrUrl, @"youtube\..+?/channel/(.*?)(?:\?|&|/|$)") .Groups[1] - .Value - .Pipe(WebUtility.UrlDecode); + .Value.Pipe(WebUtility.UrlDecode); if (!string.IsNullOrWhiteSpace(regularMatch) && IsValid(regularMatch)) return regularMatch; diff --git a/YoutubeExplode/Channels/ChannelSlug.cs b/YoutubeExplode/Channels/ChannelSlug.cs index 00996d46..f2ee7210 100644 --- a/YoutubeExplode/Channels/ChannelSlug.cs +++ b/YoutubeExplode/Channels/ChannelSlug.cs @@ -41,8 +41,7 @@ public readonly partial struct ChannelSlug var regularMatch = Regex .Match(channelSlugOrUrl, @"youtube\..+?/c/(.*?)(?:\?|&|/|$)") .Groups[1] - .Value - .Pipe(WebUtility.UrlDecode); + .Value.Pipe(WebUtility.UrlDecode); if (!string.IsNullOrWhiteSpace(regularMatch) && IsValid(regularMatch)) return regularMatch; diff --git a/YoutubeExplode/Channels/UserName.cs b/YoutubeExplode/Channels/UserName.cs index 1d12407f..5296ec10 100644 --- a/YoutubeExplode/Channels/UserName.cs +++ b/YoutubeExplode/Channels/UserName.cs @@ -42,8 +42,7 @@ private static bool IsValid(string userName) => var regularMatch = Regex .Match(userNameOrUrl, @"youtube\..+?/user/(.*?)(?:\?|&|/|$)") .Groups[1] - .Value - .Pipe(WebUtility.UrlDecode); + .Value.Pipe(WebUtility.UrlDecode); if (!string.IsNullOrWhiteSpace(regularMatch) && IsValid(regularMatch)) return regularMatch; diff --git a/YoutubeExplode/Playlists/PlaylistClient.cs b/YoutubeExplode/Playlists/PlaylistClient.cs index 8233ea5e..380fbd51 100644 --- a/YoutubeExplode/Playlists/PlaylistClient.cs +++ b/YoutubeExplode/Playlists/PlaylistClient.cs @@ -48,8 +48,7 @@ channelId is not null && channelTitle is not null var description = response.Description ?? ""; var thumbnails = response - .Thumbnails - .Select(t => + .Thumbnails.Select(t => { var thumbnailUrl = t.Url @@ -128,8 +127,7 @@ public async IAsyncEnumerable> GetVideoBatchesAsync( ?? throw new YoutubeExplodeException("Failed to extract the video channel ID."); var videoThumbnails = videoData - .Thumbnails - .Select(t => + .Thumbnails.Select(t => { var thumbnailUrl = t.Url diff --git a/YoutubeExplode/Playlists/PlaylistId.cs b/YoutubeExplode/Playlists/PlaylistId.cs index 3d765d75..4bcd3a84 100644 --- a/YoutubeExplode/Playlists/PlaylistId.cs +++ b/YoutubeExplode/Playlists/PlaylistId.cs @@ -44,8 +44,7 @@ private static bool IsValid(string playlistId) => var regularMatch = Regex .Match(playlistIdOrUrl, @"youtube\..+?/playlist.*?list=(.*?)(?:&|/|$)") .Groups[1] - .Value - .Pipe(WebUtility.UrlDecode); + .Value.Pipe(WebUtility.UrlDecode); if (!string.IsNullOrWhiteSpace(regularMatch) && IsValid(regularMatch)) return regularMatch; @@ -55,8 +54,7 @@ private static bool IsValid(string playlistId) => var compositeMatch = Regex .Match(playlistIdOrUrl, @"youtube\..+?/watch.*?list=(.*?)(?:&|/|$)") .Groups[1] - .Value - .Pipe(WebUtility.UrlDecode); + .Value.Pipe(WebUtility.UrlDecode); if (!string.IsNullOrWhiteSpace(compositeMatch) && IsValid(compositeMatch)) return compositeMatch; @@ -66,8 +64,7 @@ private static bool IsValid(string playlistId) => var shortCompositeMatch = Regex .Match(playlistIdOrUrl, @"youtu\.be/.*?/.*?list=(.*?)(?:&|/|$)") .Groups[1] - .Value - .Pipe(WebUtility.UrlDecode); + .Value.Pipe(WebUtility.UrlDecode); if (!string.IsNullOrWhiteSpace(shortCompositeMatch) && IsValid(shortCompositeMatch)) return shortCompositeMatch; @@ -77,8 +74,7 @@ private static bool IsValid(string playlistId) => var embedCompositeMatch = Regex .Match(playlistIdOrUrl, @"youtube\..+?/embed/.*?/.*?list=(.*?)(?:&|/|$)") .Groups[1] - .Value - .Pipe(WebUtility.UrlDecode); + .Value.Pipe(WebUtility.UrlDecode); if (!string.IsNullOrWhiteSpace(embedCompositeMatch) && IsValid(embedCompositeMatch)) return embedCompositeMatch; diff --git a/YoutubeExplode/Search/SearchClient.cs b/YoutubeExplode/Search/SearchClient.cs index 7003ff43..8a00433e 100644 --- a/YoutubeExplode/Search/SearchClient.cs +++ b/YoutubeExplode/Search/SearchClient.cs @@ -76,8 +76,7 @@ public async IAsyncEnumerable> GetResultBatchesAsync( ?? throw new YoutubeExplodeException("Failed to extract the video channel ID."); var videoThumbnails = videoData - .Thumbnails - .Select(t => + .Thumbnails.Select(t => { var thumbnailUrl = t.Url @@ -144,8 +143,7 @@ public async IAsyncEnumerable> GetResultBatchesAsync( : null; var playlistThumbnails = playlistData - .Thumbnails - .Select(t => + .Thumbnails.Select(t => { var thumbnailUrl = t.Url @@ -199,8 +197,7 @@ public async IAsyncEnumerable> GetResultBatchesAsync( ?? throw new YoutubeExplodeException("Failed to extract the channel title."); var channelThumbnails = channelData - .Thumbnails - .Select(t => + .Thumbnails.Select(t => { var thumbnailUrl = t.Url diff --git a/YoutubeExplode/Videos/ClosedCaptions/ClosedCaptionClient.cs b/YoutubeExplode/Videos/ClosedCaptions/ClosedCaptionClient.cs index f6c0dde6..37a5767e 100644 --- a/YoutubeExplode/Videos/ClosedCaptions/ClosedCaptionClient.cs +++ b/YoutubeExplode/Videos/ClosedCaptions/ClosedCaptionClient.cs @@ -166,18 +166,17 @@ static string FormatTimestamp(TimeSpan value) => .AppendLine() // Content .AppendLine( - caption - .Text - // Caption text may contain valid SRT-formatted data in itself. - // This can happen, for example, if the subtitles for a YouTube video - // were imported from an SRT file, but something went wrong in the - // process, resulting in parts of the file being read as captions - // rather than control sequences. - // SRT file format does not provide any means of escaping special - // characters, so as a workaround we just replace the dashes in the - // arrow sequence with en-dashes, which look similar enough. - // https://github.com/Tyrrrz/YoutubeExplode/issues/755 - .Replace("-->", "––>") + caption.Text + // Caption text may contain valid SRT-formatted data in itself. + // This can happen, for example, if the subtitles for a YouTube video + // were imported from an SRT file, but something went wrong in the + // process, resulting in parts of the file being read as captions + // rather than control sequences. + // SRT file format does not provide any means of escaping special + // characters, so as a workaround we just replace the dashes in the + // arrow sequence with en-dashes, which look similar enough. + // https://github.com/Tyrrrz/YoutubeExplode/issues/755 + .Replace("-->", "––>") ); await writer.WriteLineAsync(buffer.ToString()); diff --git a/YoutubeExplode/Videos/VideoClient.cs b/YoutubeExplode/Videos/VideoClient.cs index f7b24041..46e9059e 100644 --- a/YoutubeExplode/Videos/VideoClient.cs +++ b/YoutubeExplode/Videos/VideoClient.cs @@ -71,8 +71,7 @@ public async ValueTask