-
Notifications
You must be signed in to change notification settings - Fork 3
/
get-all-proxies-from-contry.mjs
44 lines (41 loc) · 1.13 KB
/
get-all-proxies-from-contry.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import proxyLists from 'proxy-lists';
let proxies = []
export const findProxies = () => new Promise((resolve, reject) => {
let tempProxies = []
proxyLists.getProxies({
protocols: [ 'http' ],
sourcesBlackList: [ // not working proxy sites
'blackhatworld',
'coolproxy',
'free-proxy-cz',
'freeproxylist',
'freeproxylists-net',
'freeproxylists',
'new-net-time',
'openproxy-space',
'premproxy',
'proxy50-50-blogspot-com',
'proxies24',
'proxy-daily',
'proxy-list-org',
'proxynova',
'spys-one',
'hidemyname',
'proxydb',
'proxyhttp-net',
'sockslist',
],
})
.on('data', (newProxies) => {
console.log(`got proxies from ${newProxies[0].source}`)
tempProxies = [...tempProxies, ...newProxies]
})
.on('error', reject)
.once('end', () => {
proxies = tempProxies
console.log(`got ${proxies.length} proxies from around de world`)
resolve(proxies)
})
})
export const getAllProxiesFromCountry = async (wantedCountry) =>
proxies.filter(({ country }) => country === wantedCountry.toLowerCase())