1. Support for nzblnk links with JDownloader + Eventscripter:
2. Usenet password remover (passwordlist)
3. Use NZB data (with prompt) and grab all data ( prompt.js is required)
4. Scan for NZB urls and grab all data (with nzbmonkey)
Spoiler:
Code:
disablePermissionChecks();
setAdvancedAlert(true);
setNotifyOnException(true);
//Scan for NZB urls and grab all data (with nzbmonkey)
//Trigger: New Crawler Job (Neuer Sammel-Job)
//
//Uncheck the advanced setting: LinkgrabberSettings.addlinksdialogcheck
//
// Nzbmonkey: github.com/nzblnk/nzb-monkey/releases
// Config
var nzbmonkey = JD_HOME + "/eventscripter/nzbmonkey.exe"; /* <- Set full path to nzbmonkey */
var nzbmonkey_save = "C:/Users/YOURUSER/Downloads/nzbmonkey"; // save path in nzbmonkey for nzb files
var my_nzbdata = "--help"; //test
// Script
var myCrawlerJob = job;
var myNewLinks = myCrawlerJob.getText();
// Example:
// nzblnk:?t=NAME&h=HEADER&p=PASS
if (myNewLinks.match(/nzblnk:\?/i)) {
var newlines = myNewLinks.split(/\r\n|\r|\n/g);
newlines.forEach(function(listentry) {
if (listentry.match(/^nzblnk:\?/i)) {
var linksplit = listentry.split(/\?/, 2);
var valuesplit = linksplit[1].split(/\&/);
var newname = "";
var newhash = "";
var newpass = "";
valuesplit.forEach(function(value) {
var lastsplit = value.split(/=/, 2);
if (lastsplit[0] == "t") { //title
newname = lastsplit[1];
}
if (lastsplit[0] == "h") { //header
newhash = lastsplit[1];
}
if (lastsplit[0] == "p") { //password
newpass = lastsplit[1];
}
});
if (newhash) {
callAsync(function(exitCode, stdOut, errOut) {
if (stdOut.match('optional arguments')) {
my_nzbdata = listentry;
var linksplit = my_nzbdata.split(/\?/, 2);
var valuesplit = linksplit[1].split(/\&/);
var newname = "";
var newhash = "";
var newpass = "";
valuesplit.forEach(function(value) {
var lastsplit = value.split(/=/, 2);
if (lastsplit[0] == "t") { //title
newname = lastsplit[1];
}
if (lastsplit[0] == "h") { //header
newhash = lastsplit[1];
}
if (lastsplit[0] == "p") { //password
newpass = lastsplit[1];
}
});
var myFilePath = "";
if (newpass != "") {
myFilePath = getPath(nzbmonkey_save + "/" + newname + "{{" + newpass + "}}.nzb");
} else {
myFilePath = getPath(nzbmonkey_save + "/" + newname + ".nzb");
}
deleteFile(myFilePath, false);
callAsync(function(exitCode, stdOut, errOut) {
if (stdOut.match('Saving NZB-file ... OK')) {
if (myFilePath.exists()) {
try {
callAPI("linkgrabberv2", "addLinks", {
"deepDecrypt": false,
"packageName": newname,
"extractPassword": newpass,
"links": "file:"+"//" + myFilePath
});
}catch(e){}
} else {
alert("Kein Ergebnis gefunden.");
}
}
}, nzbmonkey, "\"" + my_nzbdata + "\"");
}
}, nzbmonkey, my_nzbdata);
}
}
});
}
5. And for ftps/ftpes links (JD can ftps as ftp in most cases):
6. Use yt-dl if possible (and if JDownloader has no plugin)
Spoiler:
Code:
// Use yt-dl if possible
// Trigger: New Crawler Job (Neuer Sammel-Job)
// Required: Synchronous execution of script
// Uncheck the advanced setting: LinkgrabberSettings.addlinksdialogcheck
// Config
var all_links = false; //true/false - Use ytdl for all supported links (and not JD)
// Script
var downloadfolder = callAPI("config", "get", "org.jdownloader.settings.GeneralSettings", null, "defaultdownloadfolder");
setAdvancedAlert(true);
var myCrawlerJob = job;
var myNewLinks = myCrawlerJob.getText();
var errors = "";
var ytdl = JD_HOME + getEnvironment().getPathSeparator() + "you" + "tube-dl";
if (getEnvironment().isWindows()) {
ytdl += ".exe";
}
if (!getPath(ytdl).exists() && getEnvironment().isWindows()) {
var br = getBrowser();
br.setFollowRedirects(true);
br.getDownload(ytdl, "https" + "://yt-dl.org/latest/you" + "tube-dl.exe"); //ffmpeg.zeranoe.com/builds/
sleep(1000);
}
if (getPath(ytdl).exists()) {
var ytdl_output = callSync(ytdl);
if (ytdl_output.match("You must provide at least one URL")) {
var new_ytdl_extractors = callSync(ytdl, "--list-extractors");
var checklinks = 0;
var hosts = callAPI("plugins", "getAllPluginRegex");
var newlines = myNewLinks.split(/\r\n|\r|\n/g);
newlines.forEach(function(listentry) {
if (getCheck(listentry.toLowerCase(), hosts) && getCheckDL(getHost(listentry.toLowerCase()), new_ytdl_extractors)) {
checklinks = 1;
downloadfolder = downloadfolder.replace("<jd:packagename>", getHost(listentry.toLowerCase()));
var new_ytdl_output = callSync(ytdl, "--no-check-certificate", "--no-progress", "--no-call-home", "-i", "-o", downloadfolder + getEnvironment().getPathSeparator() + "%(title)s-%(id)s.%(ext)s", listentry);
if (!new_ytdl_output.match("Download completed")) {
errors += "ERROR:\n" + listentry + "\n" + downloadfolder + getEnvironment().getPathSeparator() + "\n" + new_ytdl_output + "\n";
}
}
});
if (errors != "") {
if (getEnvironment().isHeadless() == true) {
log(errors);
} else {
alert(errors);
}
}
} else {
if (getEnvironment().isHeadless() == true) {
log("Software yt-dl under " + ytdl + " not ready:\n" + ytdl_output + "\n");
} else {
alert("Software yt-dl under " + ytdl + " not ready:\n" + ytdl_output + "\n");
}
}
if (checklinks != "" && errors == "") {
myCrawlerJob.setDeepAnalysisEnabled(false);
myCrawlerJob.setText("");
}
}
function getCheckDL(url, extractors) {
var newextractors = extractors.split(/\r\n|\r|\n/g);
var found = 0;
newextractors.forEach(function(extractorentry) {
var extractorentry_good = "";
if ((extractorentry.split(/:/))[0].length > 5) {
extractorentry_good = (extractorentry.split(/:/))[0];
} else {
extractorentry_good = extractorentry;
}
if (url.match(extractorentry_good.toLowerCase()) && extractorentry_good.length > 3) {
found = 1;
}
});
if (found == 1) {
return true;
} else {
return false;
}
}
function getCheck(url, obj) {
if (all_links == true) {
return true;
}
for (var prop in obj) { //prop=host,obj[prop]=regex
if (url.match(prop.toLowerCase())) {
return false;
}
}
return true;
}
function getHost(url) {
var hostname;
if (url.indexOf("//") > -1) {
hostname = url.split('/')[2];
} else {
hostname = url.split('/')[0];
}
hostname = hostname.split(':')[0];
hostname = hostname.split('?')[0];
return hostname;
}
__________________
Join 9kw.eu Captcha Service now and let your JD continue downloads while you sleep.
Last edited by thecoder2012; 12.02.2020 at 07:13.
|