|
|
@ -33,33 +33,37 @@ def test_proxy(prx):
|
|
|
|
content = result.read().decode()
|
|
|
|
content = result.read().decode()
|
|
|
|
if prx.split(':')[0] not in content:
|
|
|
|
if prx.split(':')[0] not in content:
|
|
|
|
print(srv_string + 'bait.')
|
|
|
|
print(srv_string + 'bait.')
|
|
|
|
return False
|
|
|
|
return False, prx
|
|
|
|
print(srv_string + 'ok. \u2705')
|
|
|
|
print(srv_string + 'ok. \u2705')
|
|
|
|
return True
|
|
|
|
return True, prx
|
|
|
|
except error.HTTPError:
|
|
|
|
except error.HTTPError:
|
|
|
|
print(srv_string + 'fail. \u274c')
|
|
|
|
print(srv_string + 'fail. \u274c')
|
|
|
|
return False
|
|
|
|
return False, prx
|
|
|
|
except error.URLError:
|
|
|
|
except error.URLError:
|
|
|
|
print(srv_string + 'down! \u2935')
|
|
|
|
print(srv_string + 'down! \u2935')
|
|
|
|
return False
|
|
|
|
return False, prx
|
|
|
|
except RemoteDisconnected:
|
|
|
|
except RemoteDisconnected:
|
|
|
|
print(srv_string + 'connection fail!')
|
|
|
|
print(srv_string + 'connection fail!')
|
|
|
|
return False
|
|
|
|
return False, prx
|
|
|
|
except socket.timeout:
|
|
|
|
except socket.timeout:
|
|
|
|
print(srv_string + 'timeout! \u23f3')
|
|
|
|
print(srv_string + 'timeout! \u23f3')
|
|
|
|
return False
|
|
|
|
return False, prx
|
|
|
|
|
|
|
|
|
|
|
|
def get_proxies():
|
|
|
|
def get_proxies():
|
|
|
|
|
|
|
|
#from threading import Thread
|
|
|
|
|
|
|
|
import concurrent.futures
|
|
|
|
proxy_list = get_list_from_api()
|
|
|
|
proxy_list = get_list_from_api()
|
|
|
|
working_list = []
|
|
|
|
working_list = []
|
|
|
|
start_length = len(proxy_list)
|
|
|
|
start_length = len(proxy_list)
|
|
|
|
|
|
|
|
threads = []
|
|
|
|
|
|
|
|
print('Got {} proxies.'.format(len(proxy_list)))
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
for entry in proxy_list:
|
|
|
|
with concurrent.futures.ThreadPoolExecutor() as executor:
|
|
|
|
if entry not in working_list:
|
|
|
|
stuff = [executor.submit(test_proxy, entry) for entry in proxy_list if entry not in working_list]
|
|
|
|
if test_proxy(entry):
|
|
|
|
for f in stuff:
|
|
|
|
working_list.append(entry)
|
|
|
|
result = f.result()
|
|
|
|
else:
|
|
|
|
if result[0]:
|
|
|
|
pass
|
|
|
|
working_list.append(result[1])
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
print(' Impatient? Interrupt again to terminate')
|
|
|
|
print(' Impatient? Interrupt again to terminate')
|
|
|
|
|
|
|
|
|
|
|
|