mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-22 05:23:06 +02:00
reorder prefix parameter to be close to filename
This commit is contained in:
@@ -244,8 +244,9 @@ public abstract class AbstractRipper
|
|||||||
protected boolean addURLToDownload(URL url, Map<String, String> options, Map<String, String> cookies) {
|
protected boolean addURLToDownload(URL url, Map<String, String> options, Map<String, String> cookies) {
|
||||||
// Bit of a hack but this lets us pass a bool using a map<string,String>
|
// Bit of a hack but this lets us pass a bool using a map<string,String>
|
||||||
boolean useMIME = options.getOrDefault("getFileExtFromMIME", "false").equalsIgnoreCase("true");
|
boolean useMIME = options.getOrDefault("getFileExtFromMIME", "false").equalsIgnoreCase("true");
|
||||||
return addURLToDownload(url, options.getOrDefault("prefix", ""), options.getOrDefault("subdirectory", ""), options.getOrDefault("referrer", null),
|
return addURLToDownload(url, options.getOrDefault("subdirectory", ""), options.getOrDefault("referrer", null), cookies,
|
||||||
cookies, options.getOrDefault("fileName", null), options.getOrDefault("extension", null), useMIME);
|
options.getOrDefault("prefix", ""), options.getOrDefault("fileName", null), options.getOrDefault("extension", null),
|
||||||
|
useMIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -283,7 +284,7 @@ public abstract class AbstractRipper
|
|||||||
* True if downloaded successfully
|
* True if downloaded successfully
|
||||||
* False if failed to download
|
* False if failed to download
|
||||||
*/
|
*/
|
||||||
protected boolean addURLToDownload(URL url, String prefix, String subdirectory, String referrer, Map<String, String> cookies, String fileName, String extension, Boolean getFileExtFromMIME) {
|
protected boolean addURLToDownload(URL url, String subdirectory, String referrer, Map<String, String> cookies, String prefix, String fileName, String extension, Boolean getFileExtFromMIME) {
|
||||||
// A common bug is rippers adding urls that are just "http:". This rejects said urls
|
// A common bug is rippers adding urls that are just "http:". This rejects said urls
|
||||||
if (url.toExternalForm().equals("http:") || url.toExternalForm().equals("https:")) {
|
if (url.toExternalForm().equals("http:") || url.toExternalForm().equals("https:")) {
|
||||||
LOGGER.info(url.toExternalForm() + " is a invalid url amd will be changed");
|
LOGGER.info(url.toExternalForm() + " is a invalid url amd will be changed");
|
||||||
@@ -314,7 +315,7 @@ public abstract class AbstractRipper
|
|||||||
LOGGER.debug("Ripper has been stopped");
|
LOGGER.debug("Ripper has been stopped");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LOGGER.debug("url: " + url + ", prefix: " + prefix + ", subdirectory" + subdirectory + ", referrer: " + referrer + ", cookies: " + cookies + ", fileName: " + fileName);
|
LOGGER.debug("url: " + url + ", subdirectory" + subdirectory + ", referrer: " + referrer + ", cookies: " + cookies + ", prefix: " + prefix + ", fileName: " + fileName);
|
||||||
String saveAs = getFileName(url, fileName, extension);
|
String saveAs = getFileName(url, fileName, extension);
|
||||||
File saveFileAs;
|
File saveFileAs;
|
||||||
try {
|
try {
|
||||||
@@ -354,7 +355,7 @@ public abstract class AbstractRipper
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean addURLToDownload(URL url, String prefix, String subdirectory, String referrer, Map<String,String> cookies, String fileName, String extension) {
|
protected boolean addURLToDownload(URL url, String prefix, String subdirectory, String referrer, Map<String,String> cookies, String fileName, String extension) {
|
||||||
return addURLToDownload(url, prefix, subdirectory, referrer, cookies, fileName, extension, false);
|
return addURLToDownload(url, subdirectory, referrer, cookies, prefix, fileName, extension, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean addURLToDownload(URL url, String prefix, String subdirectory, String referrer, Map<String, String> cookies, String fileName) {
|
protected boolean addURLToDownload(URL url, String prefix, String subdirectory, String referrer, Map<String, String> cookies, String fileName) {
|
||||||
|
@@ -127,7 +127,7 @@ public class ComicextraRipper extends AbstractHTMLRipper {
|
|||||||
String subdirectory = getSubDirectoryName();
|
String subdirectory = getSubDirectoryName();
|
||||||
String prefix = getPrefix(++imageIndex);
|
String prefix = getPrefix(++imageIndex);
|
||||||
|
|
||||||
addURLToDownload(url, prefix, subdirectory, null, null, FILE_NAME, null, Boolean.TRUE);
|
addURLToDownload(url, subdirectory, null, null, prefix, FILE_NAME, null, Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -124,7 +124,7 @@ public class EightmusesRipper extends AbstractHTMLRipper {
|
|||||||
for (int i = 0; i != json.getJSONArray("pictures").length(); i++) {
|
for (int i = 0; i != json.getJSONArray("pictures").length(); i++) {
|
||||||
image = "https://www.8muses.com/image/fl/" + json.getJSONArray("pictures").getJSONObject(i).getString("publicUri");
|
image = "https://www.8muses.com/image/fl/" + json.getJSONArray("pictures").getJSONObject(i).getString("publicUri");
|
||||||
URL imageUrl = new URL(image);
|
URL imageUrl = new URL(image);
|
||||||
addURLToDownload(imageUrl, getPrefixShort(x), getSubdir(page.select("title").text()), this.url.toExternalForm(), cookies, "", null, true);
|
addURLToDownload(imageUrl, getSubdir(page.select("title").text()), this.url.toExternalForm(), cookies, getPrefixShort(x), "", null, true);
|
||||||
// X is our page index
|
// X is our page index
|
||||||
x++;
|
x++;
|
||||||
if (isThisATest()) {
|
if (isThisATest()) {
|
||||||
|
@@ -127,6 +127,6 @@ public class TsuminoRipper extends AbstractHTMLRipper {
|
|||||||
There is no way to tell if an image returned from tsumino.com is a png to jpg. The content-type header is always
|
There is no way to tell if an image returned from tsumino.com is a png to jpg. The content-type header is always
|
||||||
"image/jpeg" even when the image is a png. The file ext is not included in the url.
|
"image/jpeg" even when the image is a png. The file ext is not included in the url.
|
||||||
*/
|
*/
|
||||||
addURLToDownload(url, getPrefix(index), "", null, null, null, null, true);
|
addURLToDownload(url, "", null, null, getPrefix(index), null, null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user