1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-07-31 11:00:13 +02:00

newgrounds no _full

This commit is contained in:
soloturn
2022-04-27 05:07:52 +02:00
parent 4c25aff048
commit 825fd94ced

View File

@@ -53,7 +53,7 @@ public class NewgroundsRipper extends AbstractHTMLRipper {
@Override @Override
protected Document getFirstPage() throws IOException { protected Document getFirstPage() throws IOException {
return Http.url("https://" + this.username + ".newgrounds.com/art").get(); return Http.url("https://" + this.username + ".newgrounds.com/art").timeout(10*1000).get();
} }
@Override @Override
@@ -71,7 +71,7 @@ public class NewgroundsRipper extends AbstractHTMLRipper {
List<String> imageURLs = new ArrayList<>(); List<String> imageURLs = new ArrayList<>();
String documentHTMLString = page.toString().replaceAll("&quot;", ""); String documentHTMLString = page.toString().replaceAll("&quot;", "");
String findStr = "newgrounds.com\\/art\\/view\\/" + this.username; String findStr = "newgrounds.com/art/view/" + this.username;
int lastIndex = 0; int lastIndex = 0;
// Index where findStr is found; each occasion contains the link to an image // Index where findStr is found; each occasion contains the link to an image
@@ -95,7 +95,7 @@ public class NewgroundsRipper extends AbstractHTMLRipper {
if(i == indices.size() - 1){ if(i == indices.size() - 1){
s = documentHTMLString.substring(indices.get(i) + 2); s = documentHTMLString.substring(indices.get(i) + 2);
} else{ } else{
s = documentHTMLString.substring(indices.get(i) + 2, indices.get(i + 1)); s = documentHTMLString.substring(indices.get(i) + 1, indices.get(i + 1));
} }
s = s.replaceAll("\n", "").replaceAll("\t", "") s = s.replaceAll("\n", "").replaceAll("\t", "")
@@ -106,13 +106,14 @@ public class NewgroundsRipper extends AbstractHTMLRipper {
if (m.lookingAt()) { if (m.lookingAt()) {
String testURL = m.group(3) + "_" + this.username + "_" + m.group(1); String testURL = m.group(3) + "_" + this.username + "_" + m.group(1);
testURL = testURL.replace("_full", "");
// Open new document to get full sized image // Open new document to get full sized image
try { try {
Document imagePage = Http.url(inLink + m.group(1)).get(); Document imagePage = Http.url(inLink + m.group(1)).get();
for(String extensions: this.ALLOWED_EXTENSIONS){ for(String extensions: this.ALLOWED_EXTENSIONS){
if(imagePage.toString().contains(testURL + "." + extensions)){ if(imagePage.toString().contains(testURL + "." + extensions)){
imageUrl += m.group(2) + "/" + m.group(3) + "_" + this.username + "_" + m.group(1) + "." + extensions; imageUrl += m.group(2) + "/" + m.group(3).replace("_full","") + "_" + this.username + "_" + m.group(1) + "." + extensions;
imageURLs.add(imageUrl); imageURLs.add(imageUrl);
break; break;
} }