View Single Post
  #204  
Old 07.10.2022, 18:41
georgegalily georgegalily is offline
Super Loader
 
Join Date: Oct 2018
Posts: 29
Thumbs up

@Jiaz
Thank you very much
Removing the sleep make it work well but with low removing speed but acceptable.
This is the used script:
Code:
if (state == "AFTER") {
    var url = link.getURL();
    var historyFile = getPath(JD_HOME + "/cfg/history.txt");
    var lock = getModifyLock("history");
    var isDuplicate = false;
    lock.writeLock();
    try {
        var history = historyFile.exists() ? readFile(historyFile) : "";
        isDuplicate = history.indexOf(url) > -1;
        history = null;
    } finally {
        lock.writeUnlock();
    }
    if (isDuplicate) {
        var text = "#duplicatelink";
        var comment = link.getComment();
        comment = comment ? text + " " + comment : text;
        link.setComment(comment);
        link.getCrawledLink().remove();
    }
}
Reply With Quote