Re: Invaild XML Error
Posted: 09 Dec 2019, 03:45
Is there anything logged in console when it "freezes", if so I'm sure the developer would appreciate a bug report.
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(); ... }
Hello, I modified the bytecode. However now it doesn't seem to find any information, even when it seems to be connecting to TheTVDB.Dannzi wrote: ↑01 Dec 2019, 15:25any 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 :lChrrs wrote: ↑01 Dec 2019, 02:43I 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.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.
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.
Hi,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)
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
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>
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.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)