dbr / tvnamer

Automatic TV episode file renamer, uses data from thetvdb.com via tvdb_api
https://pypi.python.org/pypi/tvnamer/
The Unlicense
909 stars 115 forks source link

Sudden persistent Error with www.thetvdb.com: There was an error with the XML retrieved from thetvdb.com: #137

Closed lozbrown closed 6 years ago

lozbrown commented 7 years ago

The following seems to be occuring with multiple different files persistently

loz@gravity:/media/media1/Unsorted-Downloads$ rm -rf /tmp/tvdb_ap* loz@gravity:/media/media1/Unsorted-Downloads$ tvnamer -br Madam.Secretary.S03E23.HDTV.x264-SVA[rarbg]/ Loading config: /home/loz/.tvnamer.json ####################

Starting tvnamer

Found 1 episode

####################

Processing file: Madam.Secretary.S03E23.HDTV.x264-SVA.mkv

With custom replacements: Madam.Secretary.S03E23.HDTV.x264-SVA.mkv

Detected series: Madam Secretary (season: 3, episode: 23)

Skipping file due to error: Error with www.thetvdb.com: There was an error with the XML retrieved from thetvdb.com: unclosed token: line 1516, column 2 First try emptying the cache folder at.. /tmp/tvdb_api-u1000 If this does not resolve the issue, please try again later. If the error persists, report a bug on http://dbr.lighthouseapp.com/projects/13342-tvdb_api/overview

####################

Done

kyleinprogress commented 7 years ago

I think this is more of an issue with TheTVDB. If you read this thread on their forum, sometimes the XML doesn't get saved properly. That makes sense why you'll get an error sometimes, then if you try later, it works.

https://forums.thetvdb.com/viewtopic.php?f=17&t=36909

I think TVNamer needs to migrate to the new API and a lot of these random XML issues will go away.

dbr commented 7 years ago

Yep this is most likely someone entered some weird characters in the show information - there is little validation, so when the old XML API blindly puts these characters in the output it makes invalid XML

Editing the show data to remove the bad data would fix it (running tvnamer in verbose mode, looking at the .xml file in an online validator will show the problem days). You could also just post on thetvdb forums

And yes, this problem will hopefully disappear with the new version of the API

JohnKacz commented 7 years ago

And yes, this problem will hopefully disappear with the new version of the API

Are there plans for tvnamer to start using the v2 API. I had this error as well and read that

This version of the API will continue to function until October 1st, 2017 at which time it will be discontinued

jefflaing commented 7 years ago

From what I can see, the problem is not in tvnamer per se - it shows up if you directly use tvdb_api.

import tvdb_api tvdb_api.Tvdb()['American Gods'] Traceback (most recent call last): File "", line 1, in File "tvdb_api.py", line 953, in getitem sid = self._nameToSid(key) File "tvdb_api.py", line 938, in _nameToSid self._getShowData(selected_series['id'], selected_series['language']) File "tvdb_api.py", line 885, in _getShowData epsEt = self._getetsrc( url, language=language) File "tvdb_api.py", line 651, in _getetsrc raise tvdb_error(errormsg) tvdb_exceptions.tvdb_error: There was an error with the XML retrieved from thetvdb.com: no element found: line 216, column 23 First try emptying the cache folder at.. /var/folders/yh/p0282tlx7wd_s5sbntc3667c0000gp/T/tvdb_api-u502 If this does not resolve the issue, please try again later. If the error persists, report a bug on http://dbr.lighthouseapp.com/projects/13342-tvdb_api/overview

From what I can see, it looks like tvdb.org is serving badly formed XML responses. If you try this:

curl http://thetvdb.com/api/0629B785CE550C8D/series/253573/all/en.xml

which should retrieve the details for American Gods, it returns 8192 bytes of response, truncated in the middle of a tag.

As to whether this is because the data is broken in the TVDB database, or they have introduced some buffer size limit in constructing the XML response, its hard to say. But there is nothing that tvdb_api can do to the response to "make it good".

dbr commented 6 years ago

Closing - should be fixed in v2 as it no longer uses the deprecated XML API