jellyfin / jellyfin-plugin-opensubtitles

Home Page:https://jellyfin.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error downloading subtitles from "Open Subtitles"

wanleimin opened this issue · comments

An error occurred when I used OpenSubtitles to download
version:10.7.7
os:Linux X64

[2021-11-01 02:37:36.369 +00:00] [ERR] [42] MediaBrowser.Providers.Subtitles.SubtitleManager: Error downloading subtitles from "Open Subtitles" System.Text.Json.JsonException: Failed to parse response, code: Moved, context: options: System.Collections.Generic.Dictionary2[System.String,System.String], page: 1, body:
""
---> System.Text.Json.JsonException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
---> System.Text.Json.JsonReaderException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0.
at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan1 bytes) at System.Text.Json.Utf8JsonReader.Read() at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadCore[TValue](Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, Type returnType, JsonSerializerOptions options) at OpenSubtitlesHandler.Models.ApiResponse1..ctor(HttpResponse response, String[] context)
--- End of inner exception stack trace ---
at OpenSubtitlesHandler.Models.ApiResponse1..ctor(HttpResponse response, String[] context) at OpenSubtitlesHandler.OpenSubtitles.SearchSubtitlesAsync(Dictionary2 options, String apiKey, CancellationToken cancellationToken)
at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)`

[2021-11-01 02:37:52.029 +00:00] [ERR] [156] MediaBrowser.Providers.Subtitles.SubtitleManager: Error downloading subtitles from "Open Subtitles"
System.Text.Json.JsonException: Failed to parse response, code: Moved, context: options: System.Collections.Generic.Dictionary2[System.String,System.String], page: 1, body: "" ---> System.Text.Json.JsonException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: 0 | BytePositionInLine: 0. ---> System.Text.Json.JsonReaderException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0. at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan1 bytes)
at System.Text.Json.Utf8JsonReader.Read()
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore[TValue](Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, Type returnType, JsonSerializerOptions options)
at OpenSubtitlesHandler.Models.ApiResponse1..ctor(HttpResponse response, String[] context) --- End of inner exception stack trace --- at OpenSubtitlesHandler.Models.ApiResponse1..ctor(HttpResponse response, String[] context)
at OpenSubtitlesHandler.OpenSubtitles.SearchSubtitlesAsync(Dictionary`2 options, String apiKey, CancellationToken cancellationToken)
at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)

Which version of the plugin are you using?

It looks like the opensubtitles api is returning a 301 status code but not providing the location header 🤔
@opensubtitles could this be caused by the current api outage?

strange, I can not duplicate the problem. Please send some requests examples (curl is ok) how to do it, I tried to generated download link and then download and it works.

commented

Hello, I think I have run into the same issue, see my reddit post here. I also noticed that this issue should be solved in newer versions of this plugin. Unfortunately, they are not available yet through the jellyfin stable nor unstable repos.

v13-16 failed to build, but v17 did build, and is available for those running 10.8.

commented

Thanks! Now we just have to wait for 10.8 to be released ;)

I recently discovered the true source of this error (link), this is something that can't be fixed in the plugin so the only thing we can do is wait for opensubtitles to make changes on their side

@MBR-0001 it should be fixed. Also I added new rule to replace "%20" to "+"