diff --git a/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksImageProvider.cs b/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksImageProvider.cs index 8dcc1d7..cc1dab4 100644 --- a/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksImageProvider.cs +++ b/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksImageProvider.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Net.Http; -using System.Text.Json; +using System.Net.Http.Json; using System.Threading; using System.Threading.Tasks; using Jellyfin.Extensions.Json; @@ -84,9 +84,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks using var response = await httpClient.GetAsync(url, cancellationToken).ConfigureAwait(false); - using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - - return await JsonSerializer.DeserializeAsync(stream, JsonDefaults.Options, cancellationToken).ConfigureAwait(false); + return await response.Content.ReadFromJsonAsync(JsonDefaults.Options, cancellationToken).ConfigureAwait(false); } private List ProcessBookImage(BookResult bookResult) diff --git a/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksProvider.cs b/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksProvider.cs index dabab5e..20211a0 100644 --- a/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksProvider.cs +++ b/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksProvider.cs @@ -4,8 +4,8 @@ using System.Globalization; using System.Linq; using System.Net; using System.Net.Http; +using System.Net.Http.Json; using System.Text; -using System.Text.Json; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; @@ -177,9 +177,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks using var response = await httpClient.GetAsync(url, cancellationToken).ConfigureAwait(false); - using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - - return await JsonSerializer.DeserializeAsync(stream, JsonDefaults.Options, cancellationToken).ConfigureAwait(false); + return await response.Content.ReadFromJsonAsync(JsonDefaults.Options, cancellationToken).ConfigureAwait(false); } private async Task FetchBookId(BookInfo item, CancellationToken cancellationToken) @@ -252,9 +250,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks using var response = await httpClient.GetAsync(url, cancellationToken).ConfigureAwait(false); - using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - - return await JsonSerializer.DeserializeAsync(stream, JsonDefaults.Options, cancellationToken).ConfigureAwait(false); + return await response.Content.ReadFromJsonAsync(JsonDefaults.Options, cancellationToken).ConfigureAwait(false); } private Book? ProcessBookData(BookResult bookResult, CancellationToken cancellationToken)