mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-17 03:14:03 +02:00
Skip specified URL file extensions
This commit is contained in:
@@ -342,6 +342,9 @@ public abstract class AbstractHTMLRipper extends AbstractRipper {
|
||||
LOGGER.info("[!] Skipping " + url + " -- already attempted: " + Utils.removeCWD(saveAs));
|
||||
return false;
|
||||
}
|
||||
if (shouldIgnoreURL(url)) {
|
||||
return false;
|
||||
}
|
||||
if (Utils.getConfigBoolean("urls_only.save", false)) {
|
||||
// Output URL to file
|
||||
Path urlFile = Paths.get(this.workingDir + "/urls.txt");
|
||||
|
@@ -160,6 +160,9 @@ public abstract class AbstractJSONRipper extends AbstractRipper {
|
||||
LOGGER.info("[!] Skipping " + url + " -- already attempted: " + Utils.removeCWD(saveAs));
|
||||
return false;
|
||||
}
|
||||
if (shouldIgnoreURL(url)) {
|
||||
return false;
|
||||
}
|
||||
if (Utils.getConfigBoolean("urls_only.save", false)) {
|
||||
// Output URL to file
|
||||
Path urlFile = Paths.get(this.workingDir + "/urls.txt");
|
||||
|
@@ -699,4 +699,18 @@ public abstract class AbstractRipper
|
||||
protected boolean useByteProgessBar() { return false;}
|
||||
// If true ripme will try to resume a broken download for this ripper
|
||||
protected boolean tryResumeDownload() { return false;}
|
||||
|
||||
protected boolean shouldIgnoreURL(URL url) {
|
||||
final String[] ignoredExtensions = Utils.getConfigStringArray("download.ignore_extensions");
|
||||
if (ignoredExtensions == null || ignoredExtensions.length == 0) return false; // nothing ignored
|
||||
String[] pathElements = url.getPath().split("\\.");
|
||||
if (pathElements.length == 0) return false; // no extension, can't filter
|
||||
String extension = pathElements[pathElements.length - 1];
|
||||
for (String ignoredExtension : ignoredExtensions) {
|
||||
if (ignoredExtension.equalsIgnoreCase(extension)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -70,6 +70,9 @@ public abstract class AlbumRipper extends AbstractRipper {
|
||||
LOGGER.info("[!] Skipping " + url + " -- already attempted: " + Utils.removeCWD(saveAs));
|
||||
return false;
|
||||
}
|
||||
if (shouldIgnoreURL(url)) {
|
||||
return false;
|
||||
}
|
||||
if (Utils.getConfigBoolean("urls_only.save", false)) {
|
||||
// Output URL to file
|
||||
Path urlFile = Paths.get(this.workingDir + "/urls.txt");
|
||||
|
@@ -68,6 +68,9 @@ public abstract class VideoRipper extends AbstractRipper {
|
||||
this.url = url;
|
||||
return true;
|
||||
}
|
||||
if (shouldIgnoreURL(url)) {
|
||||
return false;
|
||||
}
|
||||
threadPool.addThread(new DownloadVideoThread(url, saveAs, this));
|
||||
}
|
||||
return true;
|
||||
|
@@ -17,6 +17,9 @@ page.timeout = 5000
|
||||
# Maximum size of downloaded files in bytes (required)
|
||||
download.max_size = 104857600
|
||||
|
||||
# Any URLs ending with one of these comma-separated values will be skipped
|
||||
#download.ignore_extensions = mp4,gif,m4v,webm,html
|
||||
|
||||
# Don't retry on 404 errors
|
||||
error.skip404 = true
|
||||
|
||||
|
Reference in New Issue
Block a user