diff --git a/external/YoutubeExplode.dll b/external/YoutubeExplode.dll index 2f7ab59..1755d06 100644 Binary files a/external/YoutubeExplode.dll and b/external/YoutubeExplode.dll differ diff --git a/src/Helpers/DataFormattingExtensions.cs b/src/Helpers/DataFormattingExtensions.cs index c8b54f7..6baf03f 100644 --- a/src/Helpers/DataFormattingExtensions.cs +++ b/src/Helpers/DataFormattingExtensions.cs @@ -16,4 +16,13 @@ public static string ToTimestampString(this double totalSeconds) ? $"{viewCount / 1_000_000D:0.#}M" : viewCount >= 1_000 ? $"{viewCount / 1_000D:0.#}K" : viewCount.ToString(); } + + public static string? ToCompactNumberString(this long? viewCount) + { + return viewCount >= 1_000_000_000 + ? $"{viewCount / 1_000_000_000D:0.#}B" + : viewCount >= 1_000_000 + ? $"{viewCount / 1_000_000D:0.#}M" + : viewCount >= 1_000 ? $"{viewCount / 1_000D:0.#}K" : viewCount.ToString(); + } } diff --git a/src/Services/SearchService.cs b/src/Services/SearchService.cs index 187eabb..e1d459c 100644 --- a/src/Services/SearchService.cs +++ b/src/Services/SearchService.cs @@ -37,8 +37,8 @@ public async Task> SearchAsync(string query) Title = video.Title, Timestamp = video.Duration!.Value.TotalSeconds.ToTimestampString(), Author = video.Author.ChannelTitle, - Ago = "No upload date", //video.SimpleUploadDate ?? "No upload date", - Views = "No view count", //video.ViewCount.ToCompactNumberString(), + Ago = video.SimpleUploadDate ?? "No upload date", + Views = video.ViewCount.ToCompactNumberString(), Seconds = (int?)video.Duration.Value.TotalSeconds }; searchResults.Add(result);