Reduce hardcoding in Wordpress comics (#299)

This commit is contained in:
cyian-1756 2017-11-30 01:37:08 -05:00 committed by metaprime
parent be916af8ce
commit 6ea6e7eded

View File

@ -67,15 +67,17 @@ public class WordpressComicRipper extends AbstractHTMLRipper {
return true; return true;
} }
Pattern konradokonskiSawdustPat = Pattern.compile("http://www.konradokonski.com/sawdust/comic/([a-zA-Z0-9_-]*)/?$"); Pattern konradokonskiPat = Pattern.compile("https?://www.konradokonski.com/([a-zA-Z0-9_-]*)/comic/([a-zA-Z0-9_-]*)/?$");
Matcher konradokonskiSawdustMat = konradokonskiSawdustPat.matcher(url.toExternalForm()); Matcher konradokonskiMat = konradokonskiPat.matcher(url.toExternalForm());
if (konradokonskiSawdustMat.matches()) { if (konradokonskiMat.matches()) {
return true; return true;
} }
Pattern konradokonskiWioryPat = Pattern.compile("http://www.konradokonski.com/wiory/comic/([a-zA-Z0-9_-]*)/?$"); // This is hardcoded because it starts on the first page, unlike all the other
Matcher konradokonskiWioryMat = konradokonskiWioryPat.matcher(url.toExternalForm()); // konradokonski which start on the last page
if (konradokonskiWioryMat.matches()) { konradokonskiPat = Pattern.compile("https?://www.konradokonski.com/aquartzbead/?$");
konradokonskiMat = konradokonskiPat.matcher(url.toExternalForm());
if (konradokonskiMat.matches()) {
return true; return true;
} }
@ -128,6 +130,7 @@ public class WordpressComicRipper extends AbstractHTMLRipper {
} }
} }
return false; return false;
} }
@ -145,16 +148,16 @@ public class WordpressComicRipper extends AbstractHTMLRipper {
return "buttsmithy.com" + "_" + "Alfie"; return "buttsmithy.com" + "_" + "Alfie";
} }
Pattern konradokonskiSawdustPat = Pattern.compile("http://www.konradokonski.com/sawdust/comic/([a-zA-Z0-9_-]*)/?$"); Pattern konradokonskiPat = Pattern.compile("http://www.konradokonski.com/([a-zA-Z]+)/comic/([a-zA-Z0-9_-]*)/?$");
Matcher konradokonskiSawdustMat = konradokonskiSawdustPat.matcher(url.toExternalForm()); Matcher konradokonskiMat = konradokonskiPat.matcher(url.toExternalForm());
if (konradokonskiSawdustMat.matches()) { if (konradokonskiMat.matches()) {
return "konradokonski.com_sawdust"; return "konradokonski.com_" + konradokonskiMat.group(1);
} }
Pattern konradokonskiWioryPat = Pattern.compile("http://www.konradokonski.com/wiory/comic/([a-zA-Z0-9_-]*)/?$"); konradokonskiPat = Pattern.compile("https?://www.konradokonski.com/aquartzbead/?$");
Matcher konradokonskiWioryMat = konradokonskiWioryPat.matcher(url.toExternalForm()); konradokonskiMat = konradokonskiPat.matcher(url.toExternalForm());
if (konradokonskiWioryMat.matches()) { if (konradokonskiMat.matches()) {
return "konradokonski.com_wiory"; return "konradokonski.com_aquartzbead";
} }
Pattern freeadultcomixPat = Pattern.compile("https?://freeadultcomix.com/([a-zA-Z0-9_\\-]*)/?$"); Pattern freeadultcomixPat = Pattern.compile("https?://freeadultcomix.com/([a-zA-Z0-9_\\-]*)/?$");