diff --git a/Jellyfin.Plugin.OpenSubtitles/OpenSubtitleDownloader.cs b/Jellyfin.Plugin.OpenSubtitles/OpenSubtitleDownloader.cs
index 23fc1a4..99d0a51 100644
--- a/Jellyfin.Plugin.OpenSubtitles/OpenSubtitleDownloader.cs
+++ b/Jellyfin.Plugin.OpenSubtitles/OpenSubtitleDownloader.cs
@@ -314,7 +314,7 @@ namespace Jellyfin.Plugin.OpenSubtitles
var res = await OpenSubtitlesHandler.OpenSubtitles.DownloadSubtitleAsync(info.Data.Link, cancellationToken).ConfigureAwait(false);
- if (!res.Ok || string.IsNullOrWhiteSpace(res.Data))
+ if (res.Code != HttpStatusCode.OK || string.IsNullOrWhiteSpace(res.Body))
{
var msg = string.Format(
CultureInfo.InvariantCulture,
@@ -325,7 +325,7 @@ namespace Jellyfin.Plugin.OpenSubtitles
throw new HttpRequestException(msg);
}
- return new SubtitleResponse { Format = format, Language = language, Stream = new MemoryStream(Encoding.UTF8.GetBytes(res.Data)) };
+ return new SubtitleResponse { Format = format, Language = language, Stream = new MemoryStream(Encoding.UTF8.GetBytes(res.Body)) };
}
private async Task Login(CancellationToken cancellationToken)
diff --git a/Jellyfin.Plugin.OpenSubtitles/OpenSubtitlesHandler/OpenSubtitles.cs b/Jellyfin.Plugin.OpenSubtitles/OpenSubtitlesHandler/OpenSubtitles.cs
index cfe5e08..5918871 100644
--- a/Jellyfin.Plugin.OpenSubtitles/OpenSubtitlesHandler/OpenSubtitles.cs
+++ b/Jellyfin.Plugin.OpenSubtitles/OpenSubtitlesHandler/OpenSubtitles.cs
@@ -101,12 +101,21 @@ namespace Jellyfin.Plugin.OpenSubtitles.OpenSubtitlesHandler
///
/// the subtitle url.
/// The cancellation token.
- /// The subtitle string.
- public static async Task> DownloadSubtitleAsync(string url, CancellationToken cancellationToken)
+ /// The Http response.
+ public static async Task DownloadSubtitleAsync(string url, CancellationToken cancellationToken)
{
- var response = await RequestHandler.SendRequestAsync(url, HttpMethod.Get, null, null, null, 1, cancellationToken).ConfigureAwait(false);
+ var response = await OpenSubtitlesRequestHelper.Instance!.SendRequestAsync(
+ url,
+ HttpMethod.Get,
+ null,
+ new Dictionary(),
+ cancellationToken).ConfigureAwait(false);
- return new ApiResponse(response);
+ return new HttpResponse
+ {
+ Body = response.body,
+ Code = response.statusCode
+ };
}
///