Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download error: System.Xml.XmlException: Root element is missin #41

Closed
Robpizza opened this issue Mar 9, 2021 · 32 comments · Fixed by #54
Closed

Download error: System.Xml.XmlException: Root element is missin #41

Robpizza opened this issue Mar 9, 2021 · 32 comments · Fixed by #54

Comments

@Robpizza
Copy link

Robpizza commented Mar 9, 2021

Describe the bug
The plugin does not work in the latest version.

System (please complete the following information):

  • OS: Ubuntu 20.04.2 LTS
  • Virtualization: LXC
  • Clients: Browser
  • Browser: Chrome 88.0.4324.190
  • Jellyfin Version: 10.6.4
  • Playback: n.a
  • Installed Plugins: OpenSubtitles
  • Reverse Proxy: n.a
  • Base URL: /
  • Networking: Bridge
  • Storage: local

To Reproduce
Install the plugin, login and run the scheduled task.

Expected behavior
Subtitle download, but it throws errors.

Logs

System.Xml.XmlException: Root element is missing.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at XmlRpcHandler.XmlRpcGenerator.DecodeMethodResponse(String xmlResponse)
at OpenSubtitlesHandler.OpenSubtitles.LogInAsync(String username, String password, String language, CancellationToken cancellationToken)
at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Login(CancellationToken cancellationToken)
at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)
[2021-03-09 11:32:31.357 +00:00] [INF] "Download missing subtitles" Completed after 0 minute(s) and 42 seconds
[2021-03-09 11:32:31.357 +00:00] [INF] ExecuteQueuedTasks

Additional context
This is Anime content, I do not know if this is a direct problem!

@AlexDias95
Copy link

I am having problems with opensubtitles too. My logs are:

[2021-03-09 11:38:55.725 +00:00] [ERR] [57] MediaBrowser.Providers.Subtitles.SubtitleManager: Error downloading subtitles from "Open Subtitles"
System.Xml.XmlException: The 'hr' start tag on line 6 position 2 does not match the end tag of 'body'. Line 7, position 3.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at XmlRpcHandler.XmlRpcGenerator.DecodeMethodResponse(String xmlResponse)
at OpenSubtitlesHandler.OpenSubtitles.LogInAsync(String username, String password, String language, CancellationToken cancellationToken)
at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Login(CancellationToken cancellationToken)
at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)

@cvium
Copy link
Member

cvium commented Mar 9, 2021

Wrong repository. Moved.

@cvium cvium transferred this issue from jellyfin/jellyfin Mar 9, 2021
@Robpizza
Copy link
Author

Any updates on this?

@voarsh2
Copy link

voarsh2 commented Mar 13, 2021

I am getting this on 10.7.0
Open Subtitles 9.0.0.0 - malfunctioned status

@theroflcoptr
Copy link

I am having problems with opensubtitles too. My logs are:

[2021-03-09 11:38:55.725 +00:00] [ERR] [57] MediaBrowser.Providers.Subtitles.SubtitleManager: Error downloading subtitles from "Open Subtitles"
System.Xml.XmlException: The 'hr' start tag on line 6 position 2 does not match the end tag of 'body'. Line 7, position 3.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at XmlRpcHandler.XmlRpcGenerator.DecodeMethodResponse(String xmlResponse)
at OpenSubtitlesHandler.OpenSubtitles.LogInAsync(String username, String password, String language, CancellationToken cancellationToken)
at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Login(CancellationToken cancellationToken)
at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)

I was getting this error. I uninstalled the plugin, restarted jellyfin, re-installed the plugin, and restarted jellyfin again and that seemed to take care of it.

@MayeulC
Copy link

MayeulC commented Apr 7, 2021

I can reproduce on jellyfin/jellyfin:latest docker image.

I am logged in to a premium opensubtitle account, have a few plugins installed, and running 10.7.1.

[2021-04-07 09:06:59.481 +00:00] [ERR] [5] MediaBrowser.Providers.Subtitles.SubtitleManager: Error downloading subtitles from "Open Subtitles"
System.Xml.XmlException: Root element is missing.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at XmlRpcHandler.XmlRpcGenerator.DecodeMethodResponse(String xmlResponse)
   at OpenSubtitlesHandler.OpenSubtitles.LogInAsync(String username, String password, String language, CancellationToken cancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Login(CancellationToken cancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)

Before updating to the latest tag (was using stable-rc), I used to get:

[2021-04-07 08:56:03.246 +00:00] [ERR] [42] MediaBrowser.Providers.Subtitles.SubtitleManager: Error downloading subtitles from "Open Subtitles"
System.Xml.XmlException: The 'hr' start tag on line 6 position 2 does not match the end tag of 'body'. Line 7, position 3.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
   at System.Xml.XmlTextReaderImpl.ParseEndElement()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at XmlRpcHandler.XmlRpcGenerator.DecodeMethodResponse(String xmlResponse)
   at OpenSubtitlesHandler.OpenSubtitles.LogInAsync(String username, String password, String language, CancellationToken cancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Login(CancellationToken cancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)

I will try the workaround posted above with reinstalling the plugin.

@MayeulC
Copy link

MayeulC commented Apr 13, 2021

Reinstalling the plugin and deleted config doesn't work. The only thing I can think of that would be specific to my configuration is that I have a premium Opensubtitles account.

The error seems to come from that function, but I don't yet have a dev environment, so debugging is tricky:

public static XmlRpcMethodCall[] DecodeMethodResponse(string xmlResponse)

@Robpizza
Copy link
Author

I think OpenSubTitles changed their api responses, atleast thats what I can think of when errors like The 'hr' start tag on line 6 position 2 does not match the end tag of 'body'. Line 7, position 3. start ocurring without any changes in Jellyfin.

@MayeulC
Copy link

MayeulC commented Apr 13, 2021

Yes, that wouldn't be surprising. BTW, would you mind changing this issue title so something a bit more descriptive like Download error: System.Xml.XmlException: Root element is missing ?

@Robpizza Robpizza changed the title OpenSubtitle Plugin Download error: System.Xml.XmlException: Root element is missin Apr 16, 2021
@uranderu
Copy link

I am getting this on 10.7.0
Open Subtitles 9.0.0.0 - malfunctioned status

@voarsh2 fyi Open Subtitles 10 is the version you should use for 10.7.
I get the same errors as OP in my logs:
[2021-04-22 15:58:04.678 +00:00] [ERR] Error downloading subtitles from "Open Subtitles" System.Xml.XmlException: Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at XmlRpcHandler.XmlRpcGenerator.DecodeMethodResponse(String xmlResponse) at OpenSubtitlesHandler.OpenSubtitles.LogInAsync(String username, String password, String language, CancellationToken cancellationToken) at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Login(CancellationToken cancellationToken) at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken) at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)

@ManuLinares
Copy link

ManuLinares commented Apr 26, 2021

OpenSubtitles plugin 10, jellyfin 10.7.2, same errors

abr 26 19:15:54 think jellyfin[76235]: [19:15:54] [ERR] [42] Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader: Invalid response type
abr 26 19:15:55 think jellyfin[76235]: [19:15:55] [ERR] [42] Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader: Invalid response type
abr 26 19:15:55 think jellyfin[76235]: [19:15:55] [ERR] [42] Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader: Invalid response type
abr 26 19:15:55 think jellyfin[76235]: [19:15:55] [ERR] [26] Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader: Invalid response type
abr 26 19:15:55 think jellyfin[76235]: [19:15:55] [ERR] [26] MediaBrowser.Providers.Subtitles.SubtitleManager: Error downloading subtitles from Open Subtitles
abr 26 19:15:55 think jellyfin[76235]: System.Xml.XmlException: 'src' is an unexpected token. The expected token is '='. Line 10, position 16.
abr 26 19:15:55 think jellyfin[76235]:    at System.Xml.XmlTextReaderImpl.Throw(Exception e)
abr 26 19:15:55 think jellyfin[76235]:    at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
abr 26 19:15:55 think jellyfin[76235]:    at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(String expectedToken1, String expectedToken2)
abr 26 19:15:55 think jellyfin[76235]:    at System.Xml.XmlTextReaderImpl.ParseAttributes()
abr 26 19:15:55 think jellyfin[76235]:    at System.Xml.XmlTextReaderImpl.ParseElement()
abr 26 19:15:55 think jellyfin[76235]:    at System.Xml.XmlTextReaderImpl.ParseElementContent()
abr 26 19:15:55 think jellyfin[76235]:    at XmlRpcHandler.XmlRpcGenerator.DecodeMethodResponse(String xmlResponse)
abr 26 19:15:55 think jellyfin[76235]:    at OpenSubtitlesHandler.OpenSubtitles.SearchSubtitlesAsync(SubtitleSearchParameters[] parameters, CancellationToken cancellationToken)
abr 26 19:15:55 think jellyfin[76235]:    at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
abr 26 19:15:55 think jellyfin[76235]:    at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)

abr 26 18:24:02 think jellyfin[16785]: [18:24:02] [ERR] [176] MediaBrowser.Providers.Subtitles.SubtitleManager: Error downloading subtitles from Open Subtitles
abr 26 18:24:02 think jellyfin[16785]: System.Xml.XmlException: Root element is missing.
abr 26 18:24:02 think jellyfin[16785]:    at System.Xml.XmlTextReaderImpl.Throw(Exception e)
abr 26 18:24:02 think jellyfin[16785]:    at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
abr 26 18:24:02 think jellyfin[16785]:    at XmlRpcHandler.XmlRpcGenerator.DecodeMethodResponse(String xmlResponse)
abr 26 18:24:02 think jellyfin[16785]:    at OpenSubtitlesHandler.OpenSubtitles.LogInAsync(String username, String password, String language, CancellationToken cancellationToken)
abr 26 18:24:02 think jellyfin[16785]:    at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Login(CancellationToken cancellationToken)
abr 26 18:24:02 think jellyfin[16785]:    at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
abr 26 18:24:02 think jellyfin[16785]:    at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)

@douglasparker
Copy link

Does anyone know if this bug is going to be resolved soon?

@hackmonker
Copy link

I guess I am not the only one. This a major plugin bug afaik

@zjeffer
Copy link

zjeffer commented May 16, 2021

Has anyone found a fix yet?

@douglasparker
Copy link

Has anyone found a fix yet?

No fix or response from the dev team it seems.

@MayeulC
Copy link

MayeulC commented May 24, 2021

Looks like the plugin still works for some people, though.

I have a VIP account, I wonder if this is related.

To whoever reads this, could you react with:

  • 👎 if you have no issue and a VIP account
  • 😕 if you have no issue and a regular account
  • 👀 if you have this issue and a regular account
  • 🚀 if you have this issue and a VIP account

Thanks. This could help diagnosing the issue.

@uranderu
Copy link

I have changed my password to a very simple one (no ciphers or symbols) and now I get different errors:
[2021-05-24 23:27:18.382 +00:00] [ERR] Error downloading subtitles from "Open Subtitles" System.Xml.XmlException: The 'hr' start tag on line 6 position 2 does not match the end tag of 'body'. Line 7, position 3. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag) at System.Xml.XmlTextReaderImpl.ParseEndElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at XmlRpcHandler.XmlRpcGenerator.DecodeMethodResponse(String xmlResponse) at OpenSubtitlesHandler.OpenSubtitles.LogInAsync(String username, String password, String language, CancellationToken cancellationToken) at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Login(CancellationToken cancellationToken) at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken) at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)
Can anyone else try to do the same so we could diagnose the problem better?

@gabri94
Copy link

gabri94 commented May 25, 2021

I'm having the same error. Jellyfin: v10.7.1 on Docker. Plugin version: 10.0.0

Glad to help if I can

@Robpizza
Copy link
Author

Well to me it still looks like an endpoint problem. Like OpenSubtitles changed the way the API requests response, I do not have time to look into it, but if someone else could try looking into their api and maybe look into the changes made since begin April maybe.

@zjeffer
Copy link

zjeffer commented May 25, 2021

If I build the plugin using the latest git version, I get this error instead after running the Download missing subtitles task:

[2021-05-25 19:28:19.632 +02:00] [ERR] Error downloading subtitles from "Open Subtitles"
System.NullReferenceException: Object reference not set to an instance of an object.
   at OpenSubtitlesHandler.Utilities.SendRequestAsync(Byte[] request, String userAgent, CancellationToken cancellationToken)
   at OpenSubtitlesHandler.OpenSubtitles.LogInAsync(String username, String password, String language, CancellationToken cancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Login(CancellationToken cancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)

I'm not sure if it's related.

@uranderu
Copy link

@Robpizza I tried looking for some kind of changelog but personally I find it really hard to find some kind of official source. Their NPM package was last updated over a year ago (don't know if that is official or not). However they upgrading their API as you can see here: https://trac.opensubtitles.org/projects/opensubtitles. Maybe that is causing this error? However I would also like to point out that these issues have started appearing with V10 of this plugin, this can be a coincidence but I doubt it to be honest.

@MBR-0001
Copy link
Contributor

If I build the plugin using the latest git version, I get this error instead after running the Download missing subtitles task:

Latest git version is broken

I've rewritten the plugin to use the new REST API, mostly for my personal use but if anyone wants I can give instructions on how to get it running (it uses the new version of opensubtitles, opensubtitles.com so you'd need to migrate your account). From what I've seen so far it works fine, definitely better than the 10.0.0.0 lol

@zjeffer
Copy link

zjeffer commented Jun 17, 2021

I've rewritten the plugin to use the new REST API, mostly for my personal use but if anyone wants I can give instructions on how to get it running (it uses the new version of opensubtitles, opensubtitles.com so you'd need to migrate your account). From what I've seen so far it works fine, definitely better than the 10.0.0.0 lol

@MBR-0001 I tested your fork, but I get this error:

<html><body>You are being <a href="http://api.opensubtitles.com/users/sign_in">redirected</a>.</body></html>
   at RESTOpenSubtitlesHandler.APIResponse`1..ctor(ValueTuple`4 obj)
   at RESTOpenSubtitlesHandler.OpenSubtitles.LogInAsync(String username, String password, CancellationToken cancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Login(CancellationToken cancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)
[2021-06-17 22:26:27.239 +02:00] [ERR] Error downloading subtitles from "Open Subtitles"
System.Exception: Failed to parse JSON: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.

EDIT: Nevermind, it suddenly started working.

@crobibero
Copy link
Member

I've rewritten the plugin to use the new REST API

Since you have it working, why not make a PR to bring your changes into the org? Every time I've tested this plugin it works fine for me, so it's very difficult to fix.

@MBR-0001
Copy link
Contributor

I've rewritten the plugin to use the new REST API

Since you have it working, why not make a PR to bring your changes into the org? Every time I've tested this plugin it works fine for me, so it's very difficult to fix.

Well I originally thought about it but then I found out the new API is in beta and it requires account migration, if that's not a problem I guess I could open a PR 🤔

@crobibero
Copy link
Member

Ah I see.. Glad you have it working, hopefully the new API will be ready for production use soon

@uranderu
Copy link

Well, this is just my opinion, but I would rather use a beta API that works (or partially works) than nothing at all.

@MBR-0001
Copy link
Contributor

I asked the developer what the current state of new API is and got the following response

Well it is rather stable, but we run without safety net, we don't have any monitoring, backup or replication,
so in case of problem we could have some pretty long downtime.

We are now configuring new servers to handle this, but we are surfing in so much unknown territory,
I really can't tell if it's gonna take 2 or 6 month

I'll open a PR if you think this is considered good enough

@douglasparker
Copy link

I asked the developer what the current state of new API is and got the following response

Well it is rather stable, but we run without safety net, we don't have any monitoring, backup or replication,
so in case of problem we could have some pretty long downtime.

We are now configuring new servers to handle this, but we are surfing in so much unknown territory,
I really can't tell if it's gonna take 2 or 6 month

I'll open a PR if you think this is considered good enough

I think a PR should be opened. Simply because as it stands the current implementation isn't working, so it might as well be considered down 24/7 for those of us experiencing this issue.

As for their lack of monitoring, they can easily use a free service like UptimeRobot to monitor http endpoints or even better, a NetData server for in depth metrics and monitoring.

@pieterhouwen
Copy link

@MBR-0001 I've built and ran the plugin and it works very nicely. However now I'm getting alot of Authentication to Opensubtitles failed errors while the username, password and api key are all correct. Any idea what might be causing this?

@pieterhouwen
Copy link

pieterhouwen commented Aug 8, 2021

This shows up in the frontend:

image

Which is weird because I can still login to OS using my username and password.

@MBR-0001
Copy link
Contributor

MBR-0001 commented Aug 8, 2021

This shows up in the frontend:

image

Which is weird because I can still login to OS using my username and password.

Their API seems to be down, I believe the website doesn't use it which is why it works

It'd probably be a good idea to include a link to the status page in the error message 🤔

EDIT: to keep this issue "clean" it would probably be best to do rewrite-related discussions in #54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.