Quote:
Originally Posted by metozeton
... 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);
}
}