Code:
//check if downloads are running at all
if (isDownloadControllerRunning() && !isDownloadControllerStopping()) {
var running = getRunningDownloadLinks();
//loop through all running Downloads
for (var i = 0; i < running.length; i++) {
//check if host is youtube.com
if (running[i].getHost() == "youtube.com") {
//check if the download has been running at least 30 seconds
if (running[i].getDownloadDuration() > 30000) {
//check if the current speed is below 30kb/s
if (running[i].getSpeed() < 30 * 1024) {
//Get link UUID
var long1 = [running[i].getUUID()]
//Disable Link
callAPI("downloadsV2", "setEnabled", false, long1, [])
}
}
}
}
}