View Single Post
  #1255  
Old 17.03.2020, 20:46
tunayx's Avatar
tunayx tunayx is offline
JD Legend
 
Join Date: Mar 2009
Location: Xp Sp3 wth Java 7 No Firewall / Turkey
Posts: 743
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Disable pending links of user-specified hosts, after x retries
// Trigger: A Download Stopped

var myHosts = ["host.com", "host.org", "host.net"]; // <- set host names
var myMaxTries = 5; // <- set max. number of retries allowed

var host = link.getHost();
var totalTries = link.getSessionProperty("count") || 0;

if (myHosts.indexOf(host) > -1) {
    if (totalTries < 5) {
        if (link.isEnabled()) link.setSessionProperty("count", totalTries + 1);
    } else if (totalTries >= 5) {
        link.setSessionProperty("count", 0);

        getAllDownloadLinks().filter(function(link2) {
            return link2.getHost() == host && !link2.isFinished() && !link2.getSpeed();
        }).forEach(function(link3) {
            link3.setEnabled(false);
        })
    }
}
Is it possible set it for all host names? I ask it for all host names because the topic below:
Protecting captcha credits against endless loops:
https://board.jdownloader.org/showth...821#post459821
Reply With Quote