Last active
November 30, 2021 18:30
-
-
Save iNawaR1/57c4cd2f694f71382c34793609105730 to your computer and use it in GitHub Desktop.
A tool that check your proxies. Name your proxy file proxy.txt and put it in same file with the checker.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import threading | |
import time | |
proxies = [] | |
n = 0 | |
fetch = open("proxy.txt", "r").read().splitlines() | |
for proxy in fetch: | |
proxies.append(proxy) | |
n += 1 | |
def save(i): | |
file = open("good_proxy.txt", "a") | |
file.write(i + "\n") | |
file.close() | |
def checker(i): | |
try: | |
global running | |
global good | |
global bad | |
running += 1 | |
except: | |
running = 0 | |
bad = 0 | |
good = 0 | |
s = requests.session() | |
s.proxies = { | |
'http':'http://'+i, | |
'https':'https://'+i | |
} | |
try: | |
rr = s.get(url, timeout=5) | |
print(f'Valid => {i}\n') | |
save(i) | |
good += 1 | |
except: | |
print(f'Not Valid => {i}\n') | |
bad += 1 | |
running -= 1 | |
many = len(proxies) | |
print(f"{many} Proxies To Be Checked.") | |
url = "https://www.google.com/humans.txt" | |
good = 0 | |
bad = 0 | |
running = 0 | |
ch = 0 | |
max = 25 | |
for i in proxies: | |
if running < max: | |
x = threading.Thread(target=checker, args=(i,)) | |
x.start() | |
ch += 1 | |
else: | |
time.sleep(.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment