From: Niki Roo Date: Thu, 2 Apr 2020 13:39:16 +0000 (+0200) Subject: e621: allow old urls for pools X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=c4b18c94e7f8413abdc5b760c9bbbd9ae5226f13;p=nikiroo-utils.git e621: allow old urls for pools --- diff --git a/src/be/nikiroo/fanfix/supported/E621.java b/src/be/nikiroo/fanfix/supported/E621.java index 316ac2c..4b2fb90 100644 --- a/src/be/nikiroo/fanfix/supported/E621.java +++ b/src/be/nikiroo/fanfix/supported/E621.java @@ -3,6 +3,7 @@ package be.nikiroo.fanfix.supported; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; import java.net.URL; import java.net.URLDecoder; import java.util.AbstractMap; @@ -170,6 +171,13 @@ class E621 extends BasicSupport { } } + if (isPool(source)) { + try { + return new URL(source.toString().replace("/pool/show/", "/pools/")); + } catch (MalformedURLException e) { + } + } + return super.getCanonicalUrl(source); } @@ -287,7 +295,7 @@ class E621 extends BasicSupport { } private boolean isPool(URL url) { - return url.getPath().startsWith("/pools/"); + return url.getPath().startsWith("/pools/") || url.getPath().startsWith("/pool/show/"); } // set will be renamed into search by canonical url