Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDownloader2 Proxy List #15

Open
Protektor-Desura opened this issue Aug 2, 2022 · 4 comments
Open

JDownloader2 Proxy List #15

Protektor-Desura opened this issue Aug 2, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@Protektor-Desura
Copy link
Owner

Protektor-Desura commented Aug 2, 2022

Come up with a script to download and add a list of proxy servers to JDownloader 2 automatically.

@Protektor-Desura Protektor-Desura added the enhancement New feature or request label Aug 2, 2022
@Protektor-Desura
Copy link
Owner Author

Protektor-Desura commented Aug 2, 2022

@Protektor-Desura
Copy link
Owner Author

Protektor-Desura commented Aug 2, 2022

Script to auto download a list of proxys on launch for JDownloader. Go to Settings, then Event Scripter, then add this script, tell it to activate on "Jdownloader started".

//Proxylist updates
//disablePermissionChecks();
//setNotifyOnException(true);


var proxy_test = 1; //1=ON,0=OFF
var max_proxies = 0; //0=Unlimited
var old_proxylist = [];
var new_proxylist = "";
var add_proxy = JSON.parse("{\"proxy\" : {\"username\" : null,\"password\" : null,\"port\" : 80,\"address\" : null,\"type\" : \"NONE\",\"preferNativeImplementation\" : false,\"resolveHostName\" : false,\"connectMethodPrefered\" : false},\"rangeRequestsSupported\" : true,\"filter\" : null,\"pac\" : false,\"reconnectSupported\" : false,\"enabled\" : true}");
var filter = new Array();

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

var html = getPage("https" + "://raw.githubusercontent.com/fate0/proxylist/master/proxy.list");
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) {
            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;
        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;

        var errorcheck = 0;
        if (proxy_test == 1) {
            myBr.setProxy(temp_JSON.type + "://" + temp_JSON.host + ":" + temp_JSON.port);
            try {
                myBr.getPage("http://www.google.com/");
            } catch (e) {
                errorcheck = 1;
            }
        }

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

            if (add_proxy_new.proxy.address && filter[temp_JSON.host] != true) {
                filter[temp_JSON.host] = true;
                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;
}

@Protektor-Desura
Copy link
Owner Author

Protektor-Desura commented Aug 2, 2022

Here is a docker to handle proxies.

https://github.com/39ff/docker-rotating-proxy

@Protektor-Desura
Copy link
Owner Author

Protektor-Desura commented Aug 2, 2022

By default JDownloader will only use first possible proxy for free download and then switch to next one once the limit is
reached -> doesn't increase parallel downloads.
You can change:

Settings->Advanced Settings-> GeneralSettings.freeproxybalancemode

to let JDownloader use multiple proxies at the same time and thus download multiple files at the same time as free user.

RANDOM -> Choose next possible random proxy
CYCLE -> First, next, next,next..
BALANCE-> try to balance free downloads over available proxies. (RECOMMENDED)

JDownloader will NOT use multiple proxies/switch for downloads with accounts to prevent account blocking because of multiple IPs.

@Protektor-Desura Protektor-Desura changed the title JDownloader 2 Proxy List JDownloader2 Proxy List Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant