-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproxy.py
55 lines (34 loc) · 1.25 KB
/
proxy.py
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
def get_next_proxy_soski():
proxy_file = 'socks5.txt'
used_proxies_file = 'used_socks5.txt'
with open(proxy_file, 'r') as file:
proxies = file.readlines()
if not proxies:
print("Нет доступных прокси.")
return None
with open(used_proxies_file, 'a') as used_file:
used_file.write(proxies[0])
with open(proxy_file, 'w') as file:
file.writelines(proxies[1:])
return proxies[0].strip()
def get_next_proxy_http():
proxy_file = 'http.txt'
used_proxies_file = 'used_http.txt'
with open(proxy_file, 'r') as file:
proxies = file.readlines()
if not proxies:
print("Нет доступных прокси.")
return None
with open(used_proxies_file, 'a') as used_file:
used_file.write(proxies[0])
with open(proxy_file, 'w') as file:
file.writelines(proxies[1:])
return proxies[0].strip()
# def main():
# proxy = get_next_proxy()
# if proxy:
# print(f"Использую прокси: socks5://{proxy}")
# else:
# print("Больше нет доступных прокси.")
# if __name__ == "__main__":
# main()