1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-16 19:04:05 +02:00

Better names for images.

This commit is contained in:
Tushar
2019-08-31 21:50:01 +05:30
parent 9637322d48
commit 4711f4f7cb

View File

@@ -138,7 +138,8 @@ public class ListalRipper extends AbstractHTMLRipper {
String imageUrl = doc.getElementsByClass("pure-img").attr("src"); String imageUrl = doc.getElementsByClass("pure-img").attr("src");
if (imageUrl != "") { if (imageUrl != "") {
addURLToDownload(new URL(imageUrl), getPrefix(index)); addURLToDownload(new URL(imageUrl), getPrefix(index), "", null, null,
getImageName());
} else { } else {
LOGGER.error("Couldnt find image from url: " + url); LOGGER.error("Couldnt find image from url: " + url);
} }
@@ -146,5 +147,18 @@ public class ListalRipper extends AbstractHTMLRipper {
LOGGER.error("[!] Exception while downloading image: " + url, e); LOGGER.error("[!] Exception while downloading image: " + url, e);
} }
} }
public String getImageName() {
// Returns the image number of the link if possible.
String name = this.url.toExternalForm();
try {
name = name.substring(name.lastIndexOf("/") + 1);
} catch (Exception e) {
LOGGER.info("Failed to get name for the image.");
name = null;
}
// Listal stores images as .jpg
return name + ".jpg";
}
} }
} }