From 135e55fb0e4fe0a6da56e9c6ef4f541af3f90fd8 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Thu, 14 Jun 2018 20:25:23 -0400 Subject: [PATCH] E621 ripper now accepts urls with order:Score at the end --- .../ripme/ripper/rippers/E621Ripper.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/E621Ripper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/E621Ripper.java index 2f47a0be..d7f4d961 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/E621Ripper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/E621Ripper.java @@ -96,40 +96,40 @@ public class E621Ripper extends AbstractHTMLRipper{ private String getTerm(URL url) throws MalformedURLException{ if(gidPattern==null) - gidPattern=Pattern.compile("^https?://(www\\.)?e621\\.net/post/index/[^/]+/([a-zA-Z0-9$_.+!*'(),%-]+)(/.*)?(#.*)?$"); + gidPattern=Pattern.compile("^https?://(www\\.)?e621\\.net/post/index/[^/]+/([a-zA-Z0-9$_.+!*'():,%\\-]+)(/.*)?(#.*)?$"); if(gidPatternPool==null) - gidPatternPool=Pattern.compile("^https?://(www\\.)?e621\\.net/pool/show/([a-zA-Z0-9$_.+!*'(),%-]+)(\\?.*)?(/.*)?(#.*)?$"); + gidPatternPool=Pattern.compile("^https?://(www\\.)?e621\\.net/pool/show/([a-zA-Z0-9$_.+!*'(),%:\\-]+)(\\?.*)?(/.*)?(#.*)?$"); Matcher m = gidPattern.matcher(url.toExternalForm()); - if(m.matches()) - return m.group(2); + if(m.matches()) { + LOGGER.info(m.group(2)); + return m.group(2); + } m = gidPatternPool.matcher(url.toExternalForm()); - if(m.matches()) - return m.group(2); + if(m.matches()) { + return m.group(2); + } throw new MalformedURLException("Expected e621.net URL format: e621.net/post/index/1/searchterm - got "+url+" instead"); } @Override public String getGID(URL url) throws MalformedURLException { - try { + String prefix=""; - if(url.getPath().startsWith("/pool/show/")) - prefix="pool_"; + if (url.getPath().startsWith("/pool/show/")) { + prefix = "pool_"; + } - return Utils.filesystemSafe(prefix+new URI(getTerm(url)).getPath()); - } catch (URISyntaxException ex) { - logger.error(ex); - } + return Utils.filesystemSafe(prefix+getTerm(url)); - throw new MalformedURLException("Expected e621.net URL format: e621.net/post/index/1/searchterm - got "+url+" instead"); } @Override public URL sanitizeURL(URL url) throws MalformedURLException { if(gidPattern2==null) - gidPattern2=Pattern.compile("^https?://(www\\.)?e621\\.net/post/search\\?tags=([a-zA-Z0-9$_.+!*'(),%-]+)(/.*)?(#.*)?$"); + gidPattern2=Pattern.compile("^https?://(www\\.)?e621\\.net/post/search\\?tags=([a-zA-Z0-9$_.+!*'():,%-]+)(/.*)?(#.*)?$"); Matcher m = gidPattern2.matcher(url.toExternalForm()); if(m.matches())