Proxy Scraper
Library for Node.js for proxy collection and validation
Install
OS Dependencies
Lib Dependencies
JSDoc
Usage example
const socksScraper = new SocksScraper([
"https://raw.githubusercontent.com/officialputuid/KangProxy/KangProxy/http/http.txt",
"https://raw.githubusercontent.com/officialputuid/KangProxy/KangProxy/socks4/socks4.txt",
"https://raw.githubusercontent.com/officialputuid/KangProxy/KangProxy/socks5/socks5.txt",
'https://api.proxyscrape.com/?request=displayproxies&status=alive&proxytype=socks4',
'https://api.proxyscrape.com/?request=displayproxies&status=alive&proxytype=socks5',
])
socksScraper.addSites(["https://api.proxyscrape.com/?request=displayproxies&status=alive"])
const timeout = 10000
const chunkSize = 5000;
const retryCount = 5;
console.log('Updating unchecked proxies...');
await socksScraper.updateUncheckedProxies()
console.log(`Done updating unchecked proxies! (${socksScraper.unCheckedProxies.size})`);
const wsp4 = await socksScraper.getWorkedSocksProxies('socks4', timeout, chunkSize, undefined, undefined, retryCount)
const bestWSP4 = SocksScraper.filterByLatency(wsp4)[0]
console.log(`The best socks4 proxy is ${bestWSP4.address} with latency ${bestWSP4.latency}ms (${wsp4.length})`)
const wsp5 = await socksScraper.getWorkedSocksProxies('socks5', timeout, chunkSize, undefined, undefined, retryCount)
const bestWSP5 = SocksScraper.filterByLatency(wsp5)[0]
console.log(`The best socks5 proxy is ${bestWSP5.address} with latency ${bestWSP5.latency}ms (${wsp5.length})`)
const mySocks4Proxy = await SocksScraper.isAliveProxy('socks4', '3.10.93.50:80', 10000)
const isAlive = Boolean(mySocks4Proxy)
console.log(`My socks4 proxy is ${isAlive ? 'alive' : 'dead'}`)
console.log(mySocks4Proxy);
My socks5 proxy is alive!
{
address: '3.122.84.99:3128',
host: '3.122.84.99',
port: 3128,
latency: 32
}