Merge pull request #547 from cyian-1756/rule34RipperFix

Added canRip for rule34.xxx
This commit is contained in:
cyian-1756 2018-04-29 16:17:59 -04:00 committed by GitHub
commit a690710a35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,16 @@ public class Rule34Ripper extends AbstractHTMLRipper {
return "rule34.xxx"; return "rule34.xxx";
} }
@Override
public boolean canRip(URL url){
Pattern p = Pattern.compile("https?://rule34.xxx/index.php\\?page=post&s=list&tags=([\\S]+)");
Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) {
return true;
}
return false;
}
@Override @Override
public String getGID(URL url) throws MalformedURLException { public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("https?://rule34.xxx/index.php\\?page=post&s=list&tags=([\\S]+)"); Pattern p = Pattern.compile("https?://rule34.xxx/index.php\\?page=post&s=list&tags=([\\S]+)");
@ -41,7 +51,7 @@ public class Rule34Ripper extends AbstractHTMLRipper {
return m.group(1); return m.group(1);
} }
throw new MalformedURLException("Expected rule34.xxx URL format: " + throw new MalformedURLException("Expected rule34.xxx URL format: " +
"rule34.xxx/index.php\\?page=post&s=list&tags=TAG - got " + url + " instead"); "rule34.xxx/index.php?page=post&s=list&tags=TAG - got " + url + " instead");
} }
public URL getAPIUrl() throws MalformedURLException { public URL getAPIUrl() throws MalformedURLException {