1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-01-18 21:17:59 +01:00

improved file naming

This commit is contained in:
cyian-1756 2017-03-23 19:23:03 -04:00
parent 48345af6b4
commit ee949ed487

View File

@ -157,12 +157,8 @@ public class FuraffinityRipper extends AbstractHTMLRipper {
ele.select("p").prepend("\\n\\n");
logger.debug("Returning description at " + page);
String tempPage = Jsoup.clean(ele.html().replaceAll("\\\\n", System.getProperty("line.separator")), "", Whitelist.none(), new Document.OutputSettings().prettyPrint(false));
Elements titles = documentz.select("meta[property=og:title]");
if (titles.size() == 0) {
throw new IOException("No title found");
}
Element title = titles.get(0);
String tempText = title.text();
String title = documentz.select("meta[property=og:title]").attr("content");
String tempText = title;
return tempText + "\n" + tempPage; // Overridden saveText takes first line and makes it the file name.
} catch (IOException ioe) {
logger.info("Failed to get description " + page + " : '" + ioe.getMessage() + "'");
@ -196,10 +192,7 @@ public class FuraffinityRipper extends AbstractHTMLRipper {
workingDir.getCanonicalPath()
+ subdirectory
+ File.separator
+ getPrefix(index)
+ saveAs
+ " "
+ test
+ ".txt");
// Write the file
FileOutputStream out = (new FileOutputStream(saveFileAs));
@ -255,7 +248,15 @@ public class FuraffinityRipper extends AbstractHTMLRipper {
}
String link = "http:" + donwloadLink.first().attr("href");
logger.info("Found URL " + link);
addURLToDownload(new URL(link),"","",url.toExternalForm(),cookies);
String[] fileNameSplit = link.split("/");
String fileName = fileNameSplit[fileNameSplit.length -1];
File saveAS;
saveAS = new File(
workingDir.getCanonicalPath()
+ File.separator
+ fileName);
fileName = fileName.replace("[0-9]*\\.", "");
addURLToDownload(new URL(link),saveAS,"",cookies);
} catch (IOException e) {
logger.error("[!] Exception while loading/parsing " + this.url, e);
}