mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-22 21:43:06 +02:00
Merge pull request #1252 from cyian-1756/addUtlToDownload-clean-up
Can now pass a map of params to addURLToDownload
This commit is contained in:
@@ -218,6 +218,44 @@ public abstract class AbstractRipper
|
|||||||
protected abstract boolean addURLToDownload(URL url, File saveAs, String referrer, Map<String, String> cookies,
|
protected abstract boolean addURLToDownload(URL url, File saveAs, String referrer, Map<String, String> cookies,
|
||||||
Boolean getFileExtFromMIME);
|
Boolean getFileExtFromMIME);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queues image to be downloaded and saved.
|
||||||
|
* @param url
|
||||||
|
* URL of the file
|
||||||
|
* @param options
|
||||||
|
* A map<String,String> containing any changes to the default options.
|
||||||
|
* Options are getFileExtFromMIME, prefix, subdirectory, referrer, fileName, extension, getFileExtFromMIME.
|
||||||
|
* getFileExtFromMIME should be "true" or "false"
|
||||||
|
* @param cookies
|
||||||
|
* The cookies to send to the server while downloading this file.
|
||||||
|
* @return
|
||||||
|
* True if downloaded successfully
|
||||||
|
* False if failed to download
|
||||||
|
*/
|
||||||
|
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>
|
||||||
|
boolean useMIME = options.getOrDefault("getFileExtFromMIME", "false").toLowerCase().equals("true");
|
||||||
|
return addURLToDownload(url, options.getOrDefault("prefix", ""), options.getOrDefault("subdirectory", ""), options.getOrDefault("referrer", null),
|
||||||
|
cookies, options.getOrDefault("fileName", ""), options.getOrDefault("extension", null), useMIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queues image to be downloaded and saved.
|
||||||
|
* @param url
|
||||||
|
* URL of the file
|
||||||
|
* @param options
|
||||||
|
* A map<String,String> containing any changes to the default options.
|
||||||
|
* Options are getFileExtFromMIME, prefix, subdirectory, referrer, fileName, extension, getFileExtFromMIME.
|
||||||
|
* getFileExtFromMIME should be "true" or "false"
|
||||||
|
* @return
|
||||||
|
* True if downloaded successfully
|
||||||
|
* False if failed to download
|
||||||
|
*/
|
||||||
|
protected boolean addURLToDownload(URL url, Map<String, String> options) {
|
||||||
|
return addURLToDownload(url, options, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queues image to be downloaded and saved.
|
* Queues image to be downloaded and saved.
|
||||||
* @param url
|
* @param url
|
||||||
|
Reference in New Issue
Block a user