View Single Post
  #232  
Old 06.11.2017, 12:42
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 290
Default Save Link URLs

Code:
// Save Link URLs
// Files will be created in default (Global) download folder
// Trigger Required: A Download Stopped

if (link.isFinished()) {
    var data = "<details><summary>" + link.getName() + "</summary><table>";

    var urls = {
        "Content": link.getContentURL(),
        "Container": link.getContainerURL(),
        "Origin": link.getOriginURL(),
        "Referrer": link.getReferrerURL()
    };

    for (x in urls) {
        if (urls[x]) data += "<tr><td>" + x + "</td><td> : <a href=\"" + urls[x] + "\">" + urls[x] + "</a></td></tr>";
    }

    data += "</table></details>";

    var folder = callAPI("config", "get", "org.jdownloader.settings.GeneralSettings", null, "DefaultDownloadFolder");
    var date = new Date().toDateString().substr(4);
    var file = folder + "/" + date + ".htm";

    writeFile(file, data, true);
}
Reply With Quote