1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-01-29 10:38:14 +01: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
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
@ -71,7 +71,7 @@ public class NewgroundsRipper extends AbstractHTMLRipper {
List<String> imageURLs = new ArrayList<>();
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;
// 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){
s = documentHTMLString.substring(indices.get(i) + 2);
} 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", "")
@ -106,13 +106,14 @@ public class NewgroundsRipper extends AbstractHTMLRipper {
if (m.lookingAt()) {
String testURL = m.group(3) + "_" + this.username + "_" + m.group(1);
testURL = testURL.replace("_full", "");
// Open new document to get full sized image
try {
Document imagePage = Http.url(inLink + m.group(1)).get();
for(String extensions: this.ALLOWED_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);
break;
}