GithubHelp home page GithubHelp logo

antoinevastel / free_proxy_checker Goto Github PK

View Code? Open in Web Editor NEW
23.0 4.0 4.0 32 KB

NodeJS library without any external dependencies to check if free HTTP/SOCKS4/SOCKS5 proxies are working/up

License: MIT License

JavaScript 100.00%
proxy proxy-checker proxy-list

free_proxy_checker's People

Contributors

antoinevastel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

free_proxy_checker's Issues

[enhacement] Getting country codes/names of proxy

It would be interesting to resolve IPs proxies to country codes/names.
To do this, we can use a free service such as

Example ip2c:
https://ip2c.org/1.0.205.8
Result:
1;TH;THA;Thailand

Example ipwhois:
https://ipwhois.app/json/1.0.205.8
Result:

{
  "ip": "1.0.205.8",
  "success": true,
  "type": "IPv4",
  "continent": "Asia",
  "continent_code": "AS",
  "country": "Thailand",
  "country_code": "TH",
  "country_flag": "https://cdn.ipwhois.io/flags/th.svg",
  "country_capital": "Bangkok",
  "country_phone": "+66",
  "country_neighbours": "LA,MM,KH,MY",
  "region": "Phuket",
  "city": "Thalang District",
  "latitude": 8.0320027,
  "longitude": 98.3334626,
  "asn": "AS23969",
  "org": "TOT Public Company Limited",
  "isp": "TOT Public Company Limited",
  "timezone": "Asia/Bangkok",
  "timezone_name": "Indochina Time",
  "timezone_dstOffset": 0,
  "timezone_gmtOffset": 25200,
  "timezone_gmt": "GMT +7:00",
  "currency": "Thai Baht",
  "currency_code": "THB",
  "currency_symbol": "฿",
  "currency_rates": 33.562,
  "currency_plural": "Thai baht",
  "completed_requests": 2
}

[enhacement] Use Flexible ascii progress bar.

For a better understanding of the progress of the proxies checks, here is an example of code using an flexible ascii progress bar: node-progress.

Rem: Pool is not accessible via require('free-proxy-checker')

// https://github.com/antoinevastel/free_proxy_checker
const { ProxyChecker, downloadAllProxies, } = require('free-proxy-checker');
// https://github.com/visionmedia/node-progress
const ProgressBar = require('progress');

const { Pool } = require('./pool.js');

class ProgressProxyChecker extends ProxyChecker {
    async checkProxies() {
        this.lastCheck = Date.now();
        const pool = new Pool(this.options.concurrency);
        const pbar = new ProgressBar('Checking proxies [:bar] :percent :etas', {
            complete: '=',
            incomplete: ' ',
            width: 20,
            total: this.proxies.length
        });

        this.proxies.forEach((proxy) => {
            pool.addTask(async() => {
                try {
                    await proxy._testConnection(this.options.timeout);
                } catch (_) { }
                finally {
                    if (this.options.verbose) {
                        pbar.tick();
                    }
                }
            })
        })

        await pool.run();
    }
}

(async () => {
    // Clear console
    process.stdout.write('\033c');

    // Download all proxies from all proxy providers at once
    const allProxies = await downloadAllProxies();
    console.log(`There are ${allProxies.length} proxies to test`);

    // Check the availability of the proxies we downloaded
    const proxyChecker = new ProgressProxyChecker(allProxies, {
        concurrency: 50,
        timeout: 7500,
        verbose: true
    })

    await proxyChecker.checkProxies();
    const proxiesUp = proxyChecker.getProxiesUp();
    console.log(`There are ${proxiesUp.length} proxies UP:`);
})();

Result:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.