1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-01-19 05:28:03 +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"); ele.select("p").prepend("\\n\\n");
logger.debug("Returning description at " + page); 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)); 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]"); String title = documentz.select("meta[property=og:title]").attr("content");
if (titles.size() == 0) { String tempText = title;
throw new IOException("No title found");
}
Element title = titles.get(0);
String tempText = title.text();
return tempText + "\n" + tempPage; // Overridden saveText takes first line and makes it the file name. return tempText + "\n" + tempPage; // Overridden saveText takes first line and makes it the file name.
} catch (IOException ioe) { } catch (IOException ioe) {
logger.info("Failed to get description " + page + " : '" + ioe.getMessage() + "'"); logger.info("Failed to get description " + page + " : '" + ioe.getMessage() + "'");
@ -196,10 +192,7 @@ public class FuraffinityRipper extends AbstractHTMLRipper {
workingDir.getCanonicalPath() workingDir.getCanonicalPath()
+ subdirectory + subdirectory
+ File.separator + File.separator
+ getPrefix(index)
+ saveAs + saveAs
+ " "
+ test
+ ".txt"); + ".txt");
// Write the file // Write the file
FileOutputStream out = (new FileOutputStream(saveFileAs)); FileOutputStream out = (new FileOutputStream(saveFileAs));
@ -255,7 +248,15 @@ public class FuraffinityRipper extends AbstractHTMLRipper {
} }
String link = "http:" + donwloadLink.first().attr("href"); String link = "http:" + donwloadLink.first().attr("href");
logger.info("Found URL " + link); 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) { } catch (IOException e) {
logger.error("[!] Exception while loading/parsing " + this.url, e); logger.error("[!] Exception while loading/parsing " + this.url, e);
} }