-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.py
More file actions
83 lines (72 loc) · 3.94 KB
/
Copy pathproxy.py
File metadata and controls
83 lines (72 loc) · 3.94 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import requests
import os
import re
proxy_sources = [
"https://www.proxy-list.download/api/v1/get?type=socks5",
"https://api.openproxylist.xyz/socks5.txt",
"https://api.proxyscrape.com/v2/?request=getproxies&protocol=socks5",
"https://openproxy.space/list/socks5",
"https://proxyspace.pro/socks5.txt",
"https://spys.me/socks.txt",
"https://raw.githubusercontent.com/AGDDoS/AGProxy/master/proxies/socks5.txt",
"https://raw.githubusercontent.com/ALIILAPRO/Proxy/main/socks5.txt",
"https://raw.githubusercontent.com/Anonym0usWork1221/Free-Proxies/main/proxy_files/socks5_proxies.txt",
"https://raw.githubusercontent.com/elliottophellia/yakumo/master/results/socks5/global/socks5_checked.txt",
"https://raw.githubusercontent.com/ErcinDedeoglu/proxies/main/proxies/socks5.txt",
"https://raw.githubusercontent.com/hookzof/socks5_list/master/proxy.txt",
"https://raw.githubusercontent.com/im-razvan/proxy_list/main/socks5.txt",
"https://raw.githubusercontent.com/Master-Mind-007/Auto-Parse-Proxy/main/socks5.txt",
"https://raw.githubusercontent.com/mmpx12/proxy-list/master/socks5.txt",
"https://raw.githubusercontent.com/MuRongPIG/Proxy-Master/main/socks5.txt",
"https://raw.githubusercontent.com/NotUnko/autoproxies/main/proxies/socks5",
"https://raw.githubusercontent.com/ObcbO/getproxy/master/file/socks5.txt",
"https://raw.githubusercontent.com/officialputuid/KangProxy/KangProxy/socks5/socks5.txt",
"https://raw.githubusercontent.com/proxifly/free-proxy-list/main/proxies/protocols/socks5/data.txt",
"https://raw.githubusercontent.com/prxchk/proxy-list/main/socks5.txt",
"https://raw.githubusercontent.com/r00tee/Proxy-List/main/Socks5.txt",
"https://raw.githubusercontent.com/roosterkid/openproxylist/main/SOCKS5_RAW.txt",
"https://raw.githubusercontent.com/Sage520/Proxy-List/main/socks5.txt",
"https://raw.githubusercontent.com/sunny9577/proxy-scraper/master/generated/socks5_proxies.txt",
"https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks5.txt",
"https://raw.githubusercontent.com/Tsprnay/Proxy-lists/master/proxies/socks5.txt",
"https://raw.githubusercontent.com/tuanminpay/live-proxy/master/socks5.txt",
"https://raw.githubusercontent.com/vakhov/fresh-proxy-list/master/socks5.txt",
"https://raw.githubusercontent.com/Vann-Dev/proxy-list/main/proxies/socks5.txt",
"https://raw.githubusercontent.com/yemixzy/proxy-list/main/proxies/socks5.txt",
"https://raw.githubusercontent.com/Zaeem20/FREE_PROXIES_LIST/master/socks5.txt",
"https://raw.githubusercontent.com/zevtyardt/proxy-list/main/socks5.txt",
"https://raw.githubusercontent.com/zloi-user/hideip.me/main/socks5.txt",
]
proxies = []
def parseProxy():
global proxies
print("Search Proxies...")
for url in proxy_sources:
try:
response = requests.get(url)
response.raise_for_status()
proxy_lines = response.text.splitlines()
for line in proxy_lines:
if re.match(r"\d+\.\d+\.\d+\.\d+:\d+", line):
proxy = line.split()[0]
clean_proxy = proxy.split(':')[0:2]
clean_proxy = ":".join(clean_proxy)
proxies.append(clean_proxy)
print(f"Successfully received proxies from {url}")
except Exception as e:
print(f"Error at {url}: {e}")
continue
proxies = list(set(proxies))
proxies.sort(key=lambda x: tuple(map(int, x.split(':')[0].split('.'))))
# Saving the proxy to a file
proxy_file = os.path.join("proxy.txt")
with open(proxy_file, "w") as file:
file.write("\n".join(proxies))
print(f"The proxies have been saved to a file {proxy_file}.")
def getCount():
return len(proxies)
# Usage
if __name__ == "__main__":
parseProxy()
print(f"Proxy count: {getCount()}")
print(f"Proxies successfully saved to proxy.txt!")