JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1521  
Old 19.08.2020, 14:21
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 964
Default

Quote:
Originally Posted by Dockel View Post
I hope on Monday or Tuesday I will make it, I still have too much to do. Hope, that is OK.
Yes. It's fine.
Reply With Quote
  #1522  
Old 19.08.2020, 14:59
Dockel Dockel is offline
Fibre Channel User
 
Join Date: Feb 2020
Posts: 122
Default

Great! Thank you very much!
__________________
Aktuelles Windows
Reply With Quote
  #1523  
Old 21.08.2020, 22:39
DeusExBestia DeusExBestia is offline
Vacuum Cleaner
 
Join Date: Feb 2018
Posts: 15
Default

I'm looking for a script that will replace any twitter links that contain "/status/NumbersHere" with "/media." I've found some javascript things that claim to replace text with other text, but I have no idea what I'm doing.
Reply With Quote
  #1524  
Old 24.08.2020, 12:30
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 964
Default

Quote:
Originally Posted by DeusExBestia View Post
... script that will replace any twitter links that contain "/status/NumbersHere" with "/media." ...
Code:
/*
    Rewrite URL
    Trigger: New Crawler Job
*/

var re = /(https:\/\/twitter.com\/[^\/]+\/)(status\/\d+)/g;
var text = job.text;

if (re.test(text)) {
    job.text = job.text.replace(re, "$1media");
}
Reply With Quote
  #1525  
Old 26.08.2020, 06:46
DeusExBestia DeusExBestia is offline
Vacuum Cleaner
 
Join Date: Feb 2018
Posts: 15
Thumbs up

Quote:
Originally Posted by mgpai View Post
Code:
/*
    Rewrite URL
    Trigger: New Crawler Job
*/

var re = /(https:\/\/twitter.com\/[^\/]+\/)(status\/\d+)/g;
var text = job.text;

if (re.test(text)) {
    job.text = job.text.replace(re, "$1media");
}
Ahhhhhhhhhh! Perfect! Thank you :D
Reply With Quote
  #1526  
Old 26.08.2020, 15:36
Bilkoff Bilkoff is offline
Baby Loader
 
Join Date: Sep 2019
Posts: 6
Default

Is there something like link.isExtractable or I have to do it only by the file extension?
Reply With Quote
  #1527  
Old 26.08.2020, 15:46
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 964
Default

Quote:
Originally Posted by Bilkoff View Post
Is there something like link.isExtractable or I have to do it only by the file extension?
You can find a list of available methods in the built-in help of the script editor. Following methods return archive object for links/packages, if present. Else, it returns null.

Code:
var myArchive = myCrawledLink.getArchive();
var myArchive[] = myCrawledPackage.getArchives();
var myArchive = myDownloadLink.getArchive();
var myArchive[] = myFilePackage.getArchives();
Reply With Quote
  #1528  
Old 08.09.2020, 23:23
Emp3 Emp3 is offline
Modem User
 
Join Date: Sep 2020
Posts: 1
Default MP3 Event Scripter stopped working

Hi folks,

I have followed the instructions on the forum and successfully installed the script so that the downloaded content is automatically converted to MP3 format.

It worked ok for one day and now its not converting anymore.

Please can someone point me to the right direction?

Kind Regards
Reply With Quote
  #1529  
Old 09.09.2020, 04:46
RedNapalm RedNapalm is offline
Junior Loader
 
Join Date: Dec 2017
Posts: 11
Default

Hey I need a script that simply copies the file directory and pastes it as a comment since there isn't a search function for directories. Thanks!
Reply With Quote
  #1530  
Old 09.09.2020, 07:58
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 964
Default

I was unable to reproduce any errors. Check if the script has been disabled. If the script is getting disabled automatically, provide the url which causes the same.
Reply With Quote
  #1531  
Old 09.09.2020, 08:13
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 964
Default

Quote:
Originally Posted by RedNapalm View Post
... a script that simply copies the file directory and pastes it as a comment ..
Code:
/*
    On download finished, append download folder to comment
    Trigger: A Download Stopped
*/

if (link.finished) {
    var comment = link.comment || "",
        folder = link.package.getDownloadFolder();

    if (comment.indexOf(folder) == -1) {
        link.comment = comment + folder;
    }
}
Reply With Quote
  #1532  
Old 09.09.2020, 09:07
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 964
Default

Requested by dex1983 (IRC)

Code:
/*
    On package finished, if the package does not contain archives, move files to user-specified location
    Trigger: Package finished
*/

var myFolder = "/path/to/folder"; //<- set destination path

if (!package.getArchives().length) {
    package.getDownloadLinks().forEach(function(link) {
        getPath(link.downloadPath).moveTo(myFolder);
    })
}

Code:
/*
    On package finished, move files to user-specified location
    Trigger: Archive extraction finished
*/

var myFolder = "/path/to/folder", //<- set destination path
    links = archive.getDownloadLinks();

if (links) {
    var package = links[0].package;

    if (package.finished) {
        package.getDownloadLinks().forEach(function(link) {
            if (link.getArchive()) {
                archive.getExtractedFilePaths().forEach(function(file) {
                    file.moveTo(myFolder);
                })
            } else {
                getPath(link.downloadPath).moveTo(myFolder);
            }
        })
    }
}
Reply With Quote
  #1533  
Old 09.09.2020, 13:55
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 54,942
Default

Merged EventScripter threads.
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #1534  
Old 09.09.2020, 15:39
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 964
Default

Requested by @RedNapalm (IRC)

Code:
/*
    Append download folder to comment
    Trigger: Downloadlist Contextmenu button pressed
    Customize context menu > Add new "Eventscript Trigger" button > Rename it to "Append folder to comment" (without quotes) > Change Icon (optional))
*/

if (name == "Append folder to comment") {
    dlSelection.getLinks().forEach(function(link) {

        if (link.finished) {
            var comment = link.comment || "",
                folder = link.package.getDownloadFolder();

            if (comment.indexOf(folder) == -1) {
                link.comment = comment + folder;
            }
        }

    })
}
Reply With Quote
  #1535  
Old 15.09.2020, 20:19
quidnunc quidnunc is offline
Modem User
 
Join Date: Aug 2020
Posts: 3
Default blacklist stop captcha notification to mobile?

via the blacklist I disabled captcha to mobile and other manual options except for a few that are whitelisted and the blacklisted does not show up inside the iOS app to solve the captcha - however I still receive the notification (presumably generated via the event scripter) that there is a captcha challenge to solve. Is there a way to disable this notification if the captcha is within the blacklist? (I would still like to receive the notification for the whitelisted hosts)

for context the blacklisted captcha is solved already by external captcha method (CaptchaSolver). maybe the problem is that external captcha method does not figure in the captcha solver priority/timing?
Reply With Quote
  #1536  
Old 16.09.2020, 16:27
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 54,942
Default

Merged EventScripter threads.

@quidnunc
Your script will need functionality to process that blacklist.
You will have to update it accordingly.

-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #1537  
Old 29.09.2020, 01:52
metozeton metozeton is offline
Modem User
 
Join Date: Sep 2020
Posts: 1
Default

Quote:
Originally Posted by mgpai View Post
Export download URLs (Linkgrabber List)
  • Default folder: "<jdownloader>\auto\history" (e.g "c:\jdownloader\auto\export")
  • Default file name: "<timestamp> - LG Selection.txt" (e.g. "Nov 25 2016 17.26.44 - LG Selection.txt")
Code:
// Export download URLs
// Trigger : "Linkgrabber Contextmenu Button Pressed"

if (name == "Export URLs") {
    var exportFolder = JD_HOME + "/auto/export/"; // <- Folder for exporting the text files
    var now = new Date().toString().substring(4, 24).replace(/:/g, "."); // <- Timestamp used in file name
    var exportFile = now + " - LG Selection.txt"; // <- Filename for exporting the URLs
    var links = lgSelection.getLinks();
    var urls = [];

    for (i = 0; i < links.length; i++) {
        var link = links[i];
        var fileName = link.getName();
        var downloadURL = link.getContentURL();
        urls.push(downloadURL + "," + fileName);
    }

    if (!getPath(exportFolder).exists()) getPath(exportFolder).mkdirs();
    writeFile(exportFolder + exportFile, urls.join("\r\n"), true);
}

Export Download URLs (Download List)
  • Default folder: "<jdownloader>\auto\history" (e.g "c:\jdownloader\auto\export")
  • Default file name: "<timestamp> - DL Selection.txt" (e.g. "Nov 25 2016 17.26.44 - DL Selection.txt")
Code:
// Export download URLs
// Trigger : "DownloadList Contextmenu Button Pressed"

if (name == "Export URLs") {
    var exportFolder = JD_HOME + "/auto/export/"; // <- Folder for exporting the text files
    var now = new Date().toString().substring(4, 24).replace(/:/g, "."); // <- Timestamp used in file name
    var exportFile = now + " - DL Selection.txt"; // <- Filename for exporting the URLs
    var links = dlSelection.getDownloadLinks();
    var urls = [];

    for (i = 0; i < links.length; i++) {
        var link = links[i];
        var fileName = link.getName();
        var downloadURL = link.getContentURL();
        urls.push(downloadURL + "," + fileName);
    }

    if (!getPath(exportFolder).exists()) getPath(exportFolder).mkdirs();
    writeFile(exportFolder + exportFile, urls.join("\r\n"), true);
}

Hello,

It works. But how can I add information about the source? (the webpage where found the link)

Last edited by metozeton; 29.09.2020 at 02:35.
Reply With Quote
  #1538  
Old 29.09.2020, 12:14
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 964
Default

Quote:
Originally Posted by metozeton View Post
... how can I add information about the source? (the webpage where found the link)
If available, JD may save the webpage URL as 'origin', 'referrer' or 'container' URL depending on the plugin and/or how it was copied. The following script will export all the available URLs related to a link. It can be used with DL or LG context menu trigger.

Code:
// Export related URLs
// Trigger : Linkgrabber Contextmenu Button Pressed OR DownloadList Contextmenu Button Pressed

if (name == "Export URLs") {
    var lgSelection, dlSelection,
        selection = lgSelection || dlSelection;

    if (selection) {
        var folder = JD_HOME + "/auto/export/", // <- Folder for exporting the text files
            date = new Date().toString().substring(4, 24).replace(/:/g, "."), // <- Timestamp used in file name
            name = lgSelection ? " - LG Selection.txt" : " - DL Selection.txt",
            file = date + name,
            content = [],
            links = selection.links,
            addContent = function(arr, data) {
                if (data && arr.indexOf(data) == -1) {
                    arr.push(data);
                }
            };

        links.forEach(function(link) {
            var arr = [];
            addContent(arr, link.name);
            addContent(arr, link.contentURL);
            addContent(arr, link.pluginURL);
            addContent(arr, link.containerURL);
            addContent(arr, link.referrerURL);
            addContent(arr, link.originURL);
            content.push(arr.join(","));
        })

        if (!getPath(folder).exists()) {
            getPath(folder).mkdirs();
        }
        
        writeFile(folder + file, content.join("\r\n"), true);
    }
}
Reply With Quote
  #1539  
Old 06.10.2020, 08:36
MiloSun MiloSun is offline
I will play nice!
 
Join Date: Oct 2020
Posts: 1
Default Where do I type in this code?

:confused:

Hello
I'm new at this. I want to in convert all audio files into MP3 format.
Can you please explain me where to input this code and how to do it?
Also, if I want to download in OGG format later, how do I revert to the default settings?

THANK YOU SO MUCH!!!
:biggrin:




Quote:
Originally Posted by mgpai View Post
Convert AAC/M4A/OGG files to MP3.
Code:
// Convert aac/m4a/ogg files to mp3.
// Trigger required: "A Download Stopped".
// Requires ffmpeg/ffprobe. Uses JD ffmpeg/ffprobe settings if available.
// Overwrites destination file (mp3) if it already exists.

if (link.isFinished()) {
    var fileName = link.name.replace(/(.+)(\..+$)/, "$1");
    var fileType = link.name.replace(/(.+)(\..+$)/, "$2");
    var sourceFile = link.getDownloadPath();
    var audioFile = /\.(aac|m4a|ogg)$/.test(sourceFile);

    if (audioFile) {
        var downloadFolder = package.getDownloadFolder();
        var destFile = downloadFolder + "/" + fileName + ".mp3";
        var ffmpeg = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypath");
        var ffprobe = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypathprobe");
        var data = JSON.parse(callSync(ffprobe, "-v", "quiet", "-print_format", "json", "-show_streams", "-show_format", sourceFile));
        var streamsBitrate = data.streams[0].bit_rate ? data.streams[0].bit_rate : 0;
        var formatBitrate = data.format.bit_rate ? data.format.bit_rate : 0;
        var bitrate = Math.max(streamsBitrate, formatBitrate) / 1000;
        var deleteSourceFile = false; // Set this to true to delete source file after conversion.

        if (bitrate > 0) {
            callSync(ffmpeg, "-y", "-i", sourceFile, "-b:a", bitrate + "k", destFile);
            if (deleteSourceFile && getPath(destFile).exists()) deleteFile(sourceFile, false);
        }
    }
}
Reply With Quote
  #1540  
Old 09.10.2020, 17:55
marka marka is offline
Modem User
 
Join Date: Oct 2020
Posts: 3
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Add metadata to image file, using external program
// Trigger: "A Download Stopped"
// External program required: ExifTool by Phil Harvey (http://www.sno.phy.queensu.ca/~phil/exiftool/)
// IMPORTANT: Remove any command line parameters included in the executable. For e.g. in Windows OS, rename 'exiftool(-k).exe' to 'exiftool.exe'

if (link.isFinished()) {
    var filePath = link.getDownloadPath();
    var ext = getPath(filePath).getExtension();
    var supported = ["jpg", "tiff"]; // <- Specify supported file types.

    if (supported.indexOf(ext) > -1) {
        var comment = link.getComment();

        if (comment) {
            var exiftool = "c:/portable/exiftool/exiftool.exe"; // <- Set full path to "exiftool.exe"
            var tagName = "comment"; // <- For the comment to be visible in the OS file properties viewer, use OS compatible tag name.
            comment = comment.replace(/"/g, "'");
            callAsync(function() {}, exiftool, "-overwrite_original", "-" + tagName + "=" + comment, filePath);
        }
    }
}
Hello, I would like to change the "Title" from Filname with the exiftool.
Thats the comman I use:
Code:
exiftool '-PDF:Title<${filename;s/\..*?$//}' '-XMP-dc:Tile<${filename;s/\.[^.]*$//}'
Unfortunatly I dont really understand this sript. How can i add this to the provided script?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 16:36.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.