dont retry known-good hosts

master
Felix Pankratz 3 years ago
parent cea5062d10
commit cfe8e578b8

@ -31,6 +31,9 @@ def test_proxy(prx):
try: try:
result = opener.open(target, timeout=6) result = opener.open(target, timeout=6)
content = result.read().decode() content = result.read().decode()
if prx.split(':')[0] not in content:
print(srv_string + 'bait.')
return False
print(srv_string + 'ok. \u2705') print(srv_string + 'ok. \u2705')
return True return True
except error.HTTPError: except error.HTTPError:
@ -47,14 +50,14 @@ def test_proxy(prx):
return False return False
def get_proxies(): def get_proxies():
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)
try: try:
for entry in proxy_list: for entry in proxy_list:
if test_proxy(entry): if entry not in working_list:
working_list.append(entry) if test_proxy(entry):
working_list.append(entry)
else: else:
pass pass
except KeyboardInterrupt: except KeyboardInterrupt:

Loading…
Cancel
Save