WordpressComicRipper: fix formatting

This commit is contained in:
MetaPrime 2017-06-06 10:25:27 -07:00
parent 90a8ab6f81
commit b8294b8152

View File

@ -16,7 +16,7 @@ import com.rarchives.ripme.ripper.AbstractHTMLRipper;
import com.rarchives.ripme.utils.Http; import com.rarchives.ripme.utils.Http;
public class WordpressComicRipper extends AbstractHTMLRipper { public class WordpressComicRipper extends AbstractHTMLRipper {
String pageTitle =""; String pageTitle = "";
public WordpressComicRipper(URL url) throws IOException { public WordpressComicRipper(URL url) throws IOException {
super(url); super(url);
@ -35,6 +35,7 @@ public class WordpressComicRipper extends AbstractHTMLRipper {
public static List<String> explicit_domains = Arrays.asList("www.totempole666.com", public static List<String> explicit_domains = Arrays.asList("www.totempole666.com",
"buttsmithy.com", "themonsterunderthebed.net", "prismblush.com", "www.konradokonski.com", "freeadultcomix.com", "buttsmithy.com", "themonsterunderthebed.net", "prismblush.com", "www.konradokonski.com", "freeadultcomix.com",
"thisis.delvecomic.com", "comics-xxx.com"); "thisis.delvecomic.com", "comics-xxx.com");
@Override @Override
public String getHost() { public String getHost() {
String host = url.toExternalForm().split("/")[2]; String host = url.toExternalForm().split("/")[2];
@ -51,7 +52,6 @@ public class WordpressComicRipper extends AbstractHTMLRipper {
public boolean canRip(URL url) { public boolean canRip(URL url) {
String url_name = url.toExternalForm(); String url_name = url.toExternalForm();
if (explicit_domains.contains(url_name.split("/")[2])) { if (explicit_domains.contains(url_name.split("/")[2])) {
Pattern totempole666Pat = Pattern.compile("https?://www\\.totempole666.com/comic/([a-zA-Z0-9_-]*)/?$"); Pattern totempole666Pat = Pattern.compile("https?://www\\.totempole666.com/comic/([a-zA-Z0-9_-]*)/?$");
Matcher totempole666Mat = totempole666Pat.matcher(url.toExternalForm()); Matcher totempole666Mat = totempole666Pat.matcher(url.toExternalForm());
if (totempole666Mat.matches()) { if (totempole666Mat.matches()) {
@ -99,8 +99,8 @@ public class WordpressComicRipper extends AbstractHTMLRipper {
if (comicsxxxMat.matches()) { if (comicsxxxMat.matches()) {
return true; return true;
} }
} }
return false; return false;
} }
@ -117,6 +117,7 @@ public class WordpressComicRipper extends AbstractHTMLRipper {
if (buttsmithyMat.matches()) { if (buttsmithyMat.matches()) {
return "buttsmithy.com" + "_" + "Alfie"; return "buttsmithy.com" + "_" + "Alfie";
} }
Pattern konradokonskiSawdustPat = Pattern.compile("http://www.konradokonski.com/sawdust/comic/([a-zA-Z0-9_-]*)/?$"); Pattern konradokonskiSawdustPat = Pattern.compile("http://www.konradokonski.com/sawdust/comic/([a-zA-Z0-9_-]*)/?$");
Matcher konradokonskiSawdustMat = konradokonskiSawdustPat.matcher(url.toExternalForm()); Matcher konradokonskiSawdustMat = konradokonskiSawdustPat.matcher(url.toExternalForm());
if (konradokonskiSawdustMat.matches()) { if (konradokonskiSawdustMat.matches()) {
@ -154,10 +155,10 @@ public class WordpressComicRipper extends AbstractHTMLRipper {
} }
return super.getAlbumTitle(url); return super.getAlbumTitle(url);
} }
@Override @Override
public String getGID(URL url) throws MalformedURLException { public String getGID(URL url) throws MalformedURLException {
String url_name = url.toExternalForm(); String url_name = url.toExternalForm();
// We shouldn't need to return any GID // We shouldn't need to return any GID
if (explicit_domains.contains(url_name.split("/")[2])) { if (explicit_domains.contains(url_name.split("/")[2])) {
@ -185,8 +186,7 @@ public String getGID(URL url) throws MalformedURLException {
} }
if (nextPage == "") { if (nextPage == "") {
throw new IOException("No more pages"); throw new IOException("No more pages");
} } else {
else {
return Http.url(nextPage).get(); return Http.url(nextPage).get();
} }
} }
@ -226,12 +226,10 @@ public String getGID(URL url) throws MalformedURLException {
pageTitle = pageTitle.replace("", ""); pageTitle = pageTitle.replace("", "");
pageTitle = pageTitle.replace(",", ""); pageTitle = pageTitle.replace(",", "");
pageTitle = pageTitle.replace(" ", ""); pageTitle = pageTitle.replace(" ", "");
} }
result.add(elem.attr("src")); result.add(elem.attr("src"));
} }
// freeadultcomix gets it own if because it needs to add http://freeadultcomix.com to the start of each link // freeadultcomix gets it own if because it needs to add http://freeadultcomix.com to the start of each link
if (url.toExternalForm().contains("freeadultcomix.com")) { if (url.toExternalForm().contains("freeadultcomix.com")) {
for (Element elem : doc.select("div.single-post > p > img.aligncenter")) { for (Element elem : doc.select("div.single-post > p > img.aligncenter")) {