View Single Post
  #59  
Old 27.02.2020, 08:34
RPNet-user RPNet-user is offline
JD Addict
 
Join Date: Apr 2017
Posts: 171
Default

Quote:
Originally Posted by mgpai View Post
@RPNet-user: Try enabling 'File > is > online - Download is possible' condition. (I cannot view your screenshots, so I am asuuming it has not been enabled).
Thank you mgpai, that fixed the problem.

I re-enabled your script to export the linkgrabber list that I used last year, however, when I click 'test run' it does nothing, there is already a text file in that path from last year so the directory structure is intact 'P:\JDownloader 2.0\auto\export'

I currently have three packages with links in the linkgrabber queue that I'm testing this with:

Code:
//Add your script here. Feel free to use the available api properties and methods
// 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);
}

Last edited by RPNet-user; 27.02.2020 at 09:25.
Reply With Quote