View Single Post
  #84  
Old 07.01.2020, 00:02
Fetter Biff Fetter Biff is offline
JD Legend
 
Join Date: Oct 2014
Posts: 945
Default

Momentan lädt JD von uloz gar nicht mehr, gibt es etwas, das man am Skript anpassen sollte?

Code:
//zippy und uloz

//disablePermissionChecks();
//setNotifyOnException(false);
//setAdvancedAlert(true);

// Proxylist updates for hosters (e.g. Zippyshare.com)
// Trigger: Interval (e.g. 10000ms)

var refreshtime = "900"; // (e.g. 900s)
var myCountries = ["GB", "DE", "FR"]; //1. Filterlist for countries
var myCountries2 = ["CA"]; //2. Filterlist for countries
var max_response_time = 1.5; //1.5 or higher (e.g. 2), 1 is too low
var proxy_test = 0; //1=ON,0=OFF (very slow)
var testsite = "http://www.google.de/";
var eventname = "Geoblocking: zippy";
var ownproxies = ""; // your proxies (e.g. X.X.X.X,X.X.X.X)
var max_proxies = 0; //0=Unlimited

// 1. Filterlist
var standard_filter = " \"filter\" : {\"type\" : \"WHITELIST\",\"entries\" : [ \"zippyshare.com\"]},"; //\"filter\" : null,
var add_proxy = JSON.parse("{\"proxy\" : {\"username\" : null,\"password\" : null,\"port\" : 80,\"address\" : null,\"type\" : \"NONE\",\"preferNativeImplementation\" : false,\"resolveHostName\" : false,\"connectMethodPrefered\" : false},\"rangeRequestsSupported\" : true," + standard_filter + "\"pac\" : false,\"reconnectSupported\" : false,\"enabled\" : true}");

// 2. Filterlist
var standard_filter2 = " \"filter\" : {\"type\" : \"WHITELIST\",\"entries\" : [ \"zippyshare.com\",\"uloz.to\",\"ulozto.net\"]},"; //\"filter\" : null,
var add_proxy2 = JSON.parse("{\"proxy\" : {\"username\" : null,\"password\" : null,\"port\" : 80,\"address\" : null,\"type\" : \"NONE\",\"preferNativeImplementation\" : false,\"resolveHostName\" : false,\"connectMethodPrefered\" : false},\"rangeRequestsSupported\" : true," + standard_filter2 + "\"pac\" : false,\"reconnectSupported\" : false,\"enabled\" : true}");

// Script
var filter = new Array();
var old_proxylist = [];
var new_proxylist = "";

var settings = "org.jdownloader.updatev2.InternetConnectionSettings";
var storage = "cfg/org.jdownloader.settings.InternetConnectionSettings";
old_proxylist = callAPI("config", "get", settings, storage, "customproxylist");

if (IsValidname() || IsValidinterval() && ((Math.round(Date.now() / 1000) - getProperty("LastProxyUpdate", true)) >= refreshtime) && !getProperty("updatingProxy", true) || getProperty("updatingProxy", true)) {
    if (!getProperty("updatingProxy", true)) {
        setProperty("LastProxyUpdate", Math.round(Date.now() / 1000), true);
    } else {
        if (getProperty("updatingProxy", true)) {
            setProperty("updatingProxy", false, true);
        }
    }

    var html;
    for (var i = 0; i < 3; ++i) {
        try {
            html = getPage("https" + "://raw.githubusercontent.com/fate0/proxylist/master/proxy.list");
        } catch (e) {}
        if (html != null && html != "") {
            break;
        } else {
            sleep(1000);
        }
    }
    if (html != null && html != "") {
        var lines = html.split("\n");

        for (var key in old_proxylist) {
            if (old_proxylist.hasOwnProperty(key)) {
                if (old_proxylist[key].proxy.type == "DIRECT" || old_proxylist[key].proxy.type == "NONE" || old_proxylist[key].enabled == false || ownproxies.indexOf(old_proxylist[key].host) > -1) {
                    if (new_proxylist == "") {
                        new_proxylist += JSON.stringify(old_proxylist[key]);
                    } else {
                        new_proxylist += "," + JSON.stringify(old_proxylist[key]);
                    }
                }
            }
        }

        var myBr = getBrowser();
        for (var i = 0; i < lines.length; ++i) {
            if (IsValidJSONString(lines[i])) {
                var temp_JSON = JSON.parse(lines[i]);
                var add_proxy_new = add_proxy;
                var add_proxy_new2 = add_proxy2;
                add_proxy_new.proxy.type = temp_JSON.type.toUpperCase();
                add_proxy_new.proxy.port = temp_JSON.port;
                add_proxy_new.proxy.address = temp_JSON.host;
                add_proxy_new2.proxy.type = temp_JSON.type.toUpperCase();
                add_proxy_new2.proxy.port = temp_JSON.port;
                add_proxy_new2.proxy.address = temp_JSON.host;
                if (myCountries.indexOf(temp_JSON.country) > -1 || temp_JSON.response_time > max_response_time) {
                    continue; //skip proxy
                }
                var errorcheck = 0;
                if (proxy_test == 1) {
                    myBr.setProxy(temp_JSON.type + "://" + temp_JSON.host + ":" + temp_JSON.port);
                    try {
                        myBr.getPage(testsite);
                    } catch (e) {
                        errorcheck = 1;
                    }
                }

                if (errorcheck == 0 && proxy_test == 1 || proxy_test != 1) {

                    if (add_proxy_new.proxy.address && add_proxy_new2.proxy.address && filter[temp_JSON.host] != true) {
                        filter[temp_JSON.host] = true;
                        if (myCountries2.indexOf(temp_JSON.country) > -1) {
                            if (new_proxylist == "") {
                                new_proxylist += JSON.stringify(add_proxy_new2);
                            } else {
                                new_proxylist += "," + JSON.stringify(add_proxy_new2);
                            }
                        } else {
                            if (new_proxylist == "") {
                                new_proxylist += JSON.stringify(add_proxy_new);
                            } else {
                                new_proxylist += "," + JSON.stringify(add_proxy_new);
                            }
                        }
                    }
                }
            }
            if (i >= max_proxies && max_proxies > 0) {
                break;
            }
        }
    }
    callAPI("config", "set", settings, storage, "customproxylist", "[" + new_proxylist + "]");
}

function IsValidJSONString(str) {
    if (typeof str !== "string") {
        return false;
    }
    try {
        JSON.parse(str);
    } catch (e) {
        return false;
    }
    return true;
}

function IsValidname() {
    try {
        if (name == eventname) {
            return true;
        }
    } catch (e) {
        return false;
    }
    return true;
}

function IsValidinterval() {
    try {
        if (interval >= 10000) {
            return true;
        }
    } catch (e) {
        return false;
    }
    return true;
}
Reply With Quote