How to use the proxy-lists.getProxiesFromSource function in proxy-lists

To help you get started, we’ve selected a few proxy-lists examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wilsonwen / kanmeiju / index.js View on Github external
// count request
    REQUEST_COUNT++;

    // change token
    FAKE_HEADERS['token'] = TOKENS[REQUEST_COUNT%TOKENS.length]


    // Change proxy every 1000 requests
    var proxy_option = {
        countries: ['us'],
        protocols: ['http']
    };
    console.log("REQUEST_COUNT: " + REQUEST_COUNT);
    if (REQUEST_COUNT % 1000 == 1) {
        // `gettingProxies` is an event emitter object.
        var gettingProxies = ProxyLists.getProxiesFromSource('freeproxylist', proxy_option);
        PROXIES = [];
        gettingProxies.on('data', function(proxies) {
            PROXIES = PROXIES.concat(proxies);
        });
        gettingProxies.on('error', function(error) {
            console.error(error);
        });
        gettingProxies.once('end', function() {
            console.log(PROXIES);
        });
    }
    
    var options = {}
    var index = 0;
    if (PROXIES.length == 0 || process.env.PROXY != 1) {
        options = {

proxy-lists

Get proxies from publicly available proxy lists.

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis