mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-17 19:26:34 +02:00
Better names for images.
This commit is contained in:
@@ -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";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user