Invaild XML Error

Any questions? Need some help?
DefensiveObject
Posts: 1
Joined: 09 Dec 2019, 03:41

Re: Invaild XML Error

Post by DefensiveObject »

Dannzi wrote: 01 Dec 2019, 15:25 downloaded Recaf and after loading the file into it, it just freezes
preech wrote: 02 Dec 2019, 19:55 The jar editor also freeze for me under windows, but managed to get it working under linux.
( The java 8 install was a real pain tho )

Is there anything logged in console when it "freezes", if so I'm sure the developer would appreciate a bug report.
genuinefafa
Posts: 4
Joined: 26 Oct 2014, 16:56

Re: Invaild XML Error

Post by genuinefafa »

In case somebody is looking for a way to do this (that works pretty well), you can do

Code: Select all

# put current jar and new WebRequest.java in same directory, the run
javac WebRequest -cp FileBot.jar
# this will generate a .class file that you should override the one in filebot.jar\net\filebot\web
# i use 7z gui, but you can do it via command line
kalgon wrote: 01 Dec 2019, 19:30 I modified net.filebot.web.WebRequest.fetch(URL, long, Object, Map<>, Consumer<>) to check if the connection response's code is 301. If it is, then the method calls itself with the new URL I got from the Location header. I tried setting connection.setInstanceFollowRedirects(true) but it did not work.

Code: Select all

public static ByteBuffer fetch(URL url, long ifModifiedSince, Object etag, Map<String, String> requestParameters, Consumer<Map<String, List<String>>> responseParameters) throws IOException {
    ...
    if (requestParameters != null) {
        requestParameters.forEach(connection::addRequestProperty);
    }

    // NEW CODE
    if (connection instanceof HttpURLConnection) {
        HttpURLConnection httpConnection = (HttpURLConnection) connection;
        if (httpConnection.getResponseCode() == 301) {
            return fetch(new URL(connection.getHeaderField("Location")), ifModifiedSince, etag, requestParameters, responseParameters);
        }
    }
    // END NEW CODE

    int contentLength = connection.getContentLength();
    ...
}   
IReallyDontKnow
Posts: 1
Joined: 14 Dec 2019, 23:28

Re: Invaild XML Error

Post by IReallyDontKnow »

Dannzi wrote: 01 Dec 2019, 15:25
Chrrs wrote: 01 Dec 2019, 02:43
tarad10 wrote: 26 Nov 2019, 16:37 The issue is here: https://thetvdb.com/api/694FAD89942D3827/mirrors.xml. The mirrorpath node is returning the non-secure TVDB URL. Older versions of FileBot build the cache off of that. The easiest workaround mentioned is to use the movie database for television. If that is not granular enough, you can either buy a license for the new version or modify an old instance of the code. Version 4.6.2 is still available via SourceForge. You can either modify the WebRequest class to handle redirects or you can replace "http" with "https" when the TheTVDBClient class gets the mirror and populates the cache.
I modified the Java bytecodes for the getMirror() function to just bypass the cache and always return https://thetvdb.com. I'm not a Java programmer and I'm not sure if this will be viable long term, but my deluge+filebottool Unraid docker is now finally able to process my tv shows.

A proxy solution is probably the best solution though. I just had issues getting nginx to work correctly and going through the decompiled Java source and playing around with bytecode editing sounded more fun.

If anyone wants to reproduce what I did:

You will need a Java bytecode editor such as https://github.com/Col-E/Recaf. Download Recaf and then run it. Go to File -> Load and then point it to your FileBot.jar. From the left side menu go to net/filebot/web and open TheTVDBClientV1 class.

Click the Method's tab. Find the getMirror method and open it. Click the Edit Instructions button.

Find the instruction that goes: "IF_ACMPNE LABEL C" and double click on it. Change the opcode to "IF_ACMPEQ" instead.

Find the instruction that goes LDC "http://thetvdb.com" a couple lines down and double click on it. Change its value to "https://thetvdb.com" without the quotes.

The code should now look like this: https://imgur.com/a/bWBZzEd

Close all the windows you just opened to go back to the main Recaf screen. Go to File -> Export and save this as FileBot.jar.

You can now replace your existing FileBot.jar with your newly edited copy. I also cleared my FileBot's cache by running: filebot -clear-cache.
any chance for you to upload that filebot.jar file anywhere, downloaded Recaf and after loading the file into it, it just freezes, can't edit anything :l
Hello, I modified the bytecode. However now it doesn't seem to find any information, even when it seems to be connecting to TheTVDB.

How did you debug this? Do you know any detailed log that could help me see the request that filebot is sending to TheTVDB?

Thanks
kalgon
Posts: 5
Joined: 26 Jul 2014, 10:58

Re: Invaild XML Error

Post by kalgon »

If some people are still struggling with this issue, here's what you can do:
  • Be sure you have the FileBot 4.7.9 jar
  • Download jojodiff from http://jojodiff.sourceforge.net/
  • Download the patch from https://gofile.io/?c=Dvc6yx
  • Extract the class net/filebot/web/WebRequest.class from the filebot jar file (which is just a zip)
  • Patch the class with jojodiff > jptch.exe WebRequest.class WebRequest.diff WebRequest.patched.class
  • Replace net/filebot/web/WebRequest.class in the jar with the WebRequest.patched.class (rename it to WebRequest.class first)
froogle
Posts: 1
Joined: 14 Jan 2020, 20:12

Re: Invaild XML Error

Post by froogle »

kalgon wrote: 14 Jan 2020, 16:57 If some people are still struggling with this issue, here's what you can do:
  • Be sure you have the FileBot 4.7.9 jar
  • Download jojodiff from http://jojodiff.sourceforge.net/
  • Download the patch from https://gofile.io/?c=Dvc6yx
  • Extract the class net/filebot/web/WebRequest.class from the filebot jar file (which is just a zip)
  • Patch the class with jojodiff > jptch.exe WebRequest.class WebRequest.diff WebRequest.patched.class
  • Replace net/filebot/web/WebRequest.class in the jar with the WebRequest.patched.class (rename it to WebRequest.class first)
Hi,

i just noticed today that i have this issue !!!

i tried your solution but it give me this error msg :

Code: Select all

Fetch failed: Try again in 5 seconds (2 more) => java.io.IOException: Server returned HTTP response code: 502 for URL: http://thetvdb.com/api/GetSeriesByRemoteID.php?imdbid=1520211&language=en
Fetch failed: Try again in 10 seconds (1 more) => java.io.IOException: Server returned HTTP response code: 502 for URL: http://thetvdb.com/api/GetSeriesByRemoteID.php?imdbid=1520211&language=en
Fetch failed: http://thetvdb.com/api/GetSeriesByRemoteID.php?imdbid=1520211&language=en
java.io.IOException: Server returned HTTP response code: 502 for URL: http://thetvdb.com/api/GetSeriesByRemoteID.php?imdbid=1520211&language=en
        at net.filebot.web.WebRequest.fetch(WebRequest.java:143)
        at net.filebot.CachedResource.lambda$fetchIfModified$9(CachedResource.java:215)
        at net.filebot.CachedResource.lambda$null$0(CachedResource.java:87)
        at net.filebot.CachedResource.retry(CachedResource.java:121)
        at net.filebot.CachedResource.retry(CachedResource.java:133)
        at net.filebot.CachedResource.retry(CachedResource.java:133)
        at net.filebot.CachedResource.lambda$get$1(CachedResource.java:87)
        at net.filebot.Cache.computeIf(Cache.java:90)
        at net.filebot.CachedResource.get(CachedResource.java:82)
        at net.filebot.web.TheTVDBClientV1.getXmlResource(TheTVDBClientV1.java:269)
        at net.filebot.web.TheTVDBClientV1.lambda$lookupByIMDbID$3(TheTVDBClientV1.java:222)
        at net.filebot.Cache.computeIf(Cache.java:90)
        at net.filebot.Cache$TypedCache.computeIf(Cache.java:176)
        at net.filebot.Cache.computeIfAbsent(Cache.java:96)
        at net.filebot.Cache$TypedCache.computeIfAbsent(Cache.java:181)
        at net.filebot.web.TheTVDBClientV1.lookupByIMDbID(TheTVDBClientV1.java:221)
        at net.filebot.media.MediaDetection.lookupSeriesNameByInfoFile(MediaDetection.java:1248)
        at net.filebot.media.MediaDetection.detectSeriesNames(MediaDetection.java:344)
        at net.filebot.media.MediaDetection.detectSeriesNames(MediaDetection.java:322)
        at net.filebot.cli.ScriptShellBaseClass.detectSeriesName(ScriptShellBaseClass.java:244)
        at net.filebot.cli.ScriptShellBaseClass.detectSeriesName(ScriptShellBaseClass.java:232)
        at Script1$_run_closure50.doCall(Script1.groovy:363)
        at Script1.run(Script1.groovy:349)
        at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:64)
        at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:74)
        at net.filebot.cli.ArgumentProcessor.runScript(ArgumentProcessor.java:119)
        at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:29)
        at net.filebot.Main.main(Main.java:115)
Caused by: java.io.IOException: Server returned HTTP response code: 502 for URL: http://thetvdb.com/api/GetSeriesByRemoteID.php?imdbid=1520211&language=en
        at net.filebot.web.WebRequest.fetch(WebRequest.java:140)
        ... 27 more

Failed to lookup info by id: java.io.IOException: Server returned HTTP response code: 502 for URL: http://thetvdb.com/api/GetSeriesByRemoteID.php?imdbid=1520211&language=en
where did i messed up ???
kalgon
Posts: 5
Joined: 26 Jul 2014, 10:58

Re: Invaild XML Error

Post by kalgon »

Well, it does not seem to be the same problem as the original one.
The original problem was caused by a 301 status code (to redirect clients to use https instead of http when accessing thetvdb api).
Here, you have another code: 502 (Bad Gateway).
Can you access the link from the logs (http://thetvdb.com/api/GetSeriesByRemot ... anguage=en) in your browser? It may indicate a (temporary) error on the network.
TehBotol
Supporter
Posts: 34
Joined: 06 Mar 2013, 00:01

Re: Invaild XML Error

Post by TehBotol »

working great thank you :)
edit:
another issue popup, it downloaded the series nfo and landscape/cleartart correctly
but the poster.jpg and folder jpg are not downloaded correctly
inside the poster.jpg and folder.jpg contain

Code: Select all

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>CloudFront</center>
</body>
</html>
is this related to the http:// instead of httpS:// ?
thanks
kalgon wrote: 14 Jan 2020, 16:57 If some people are still struggling with this issue, here's what you can do:
  • Be sure you have the FileBot 4.7.9 jar
  • Download jojodiff from http://jojodiff.sourceforge.net/
  • Download the patch from https://gofile.io/?c=Dvc6yx
  • Extract the class net/filebot/web/WebRequest.class from the filebot jar file (which is just a zip)
  • Patch the class with jojodiff > jptch.exe WebRequest.class WebRequest.diff WebRequest.patched.class
  • Replace net/filebot/web/WebRequest.class in the jar with the WebRequest.patched.class (rename it to WebRequest.class first)
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Invaild XML Error

Post by kim »

yes
"301 Moved Permanently" = move from http:// to httpS://
nutzer
Posts: 1
Joined: 25 Oct 2020, 14:47

Re: Invaild XML Error

Post by nutzer »

kalgon wrote: 14 Jan 2020, 16:57 If some people are still struggling with this issue, here's what you can do:
  • Be sure you have the FileBot 4.7.9 jar
  • Download jojodiff from http://jojodiff.sourceforge.net/
  • Download the patch from https://gofile.io/?c=Dvc6yx
  • Extract the class net/filebot/web/WebRequest.class from the filebot jar file (which is just a zip)
  • Patch the class with jojodiff > jptch.exe WebRequest.class WebRequest.diff WebRequest.patched.class
  • Replace net/filebot/web/WebRequest.class in the jar with the WebRequest.patched.class (rename it to WebRequest.class first)
can you please upload the patch again? not available anymore.

thanks!
Lovechubbs
Posts: 1
Joined: 05 Oct 2022, 13:15

Re: Invaild XML Error

Post by Lovechubbs »

The original method outlined still works for those that are still trying:

Get/Open RECAF
Within RECAF open filebot.jar
EXPAND Classes > Net > Filebot > Web
Double Click TheTVDBClientV1 to open
Right Click TheTVDBClientV1 tab and choose Class Mode > Table
Choose Methods Tab
Look for GetMirror, right click, edit with assembler
Change IF_ACMPNE C to IF_ACMPEQ C
Change http://thetvdb.com to https://thetvdb.com
Press CTRL & S together to save
Close editor screen
Choose File > Export Program
Save as FileBot.jar
Copy to FileBot installation location, overwriting original
Done, TVDB now works
Post Reply