-
Notifications
You must be signed in to change notification settings - Fork 3
/
Get_Proxies_List.py
132 lines (123 loc) · 5.13 KB
/
Get_Proxies_List.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
############################################################################
#
# Get_Proxies_List.py
# © 2021 ABDULKADİR GÜNGÖR All Rights Reserved
# Contact email address: abdulkadir_gungor@outlook.com
#
# Developper: Abdulkadir GÜNGÖR (abdulkadir_gungor@outlook.com)
# Date: 04/2021
# All Rights Reserved (Tüm Hakları Saklıdır)
#
############################################################################
import requests, time
### https://www.sslproxies.org/
def get_proxies_www_sslproxies_org():
headers = {
"Accept": "*/*",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0"
}
response = requests.get('https://www.sslproxies.org', headers=headers)
return (response.text).split(sep='\n')[3:103]
### https://free-proxy-list.net/
def get_proxies_www_free_proxy_list_net():
headers = {
"Accept": "*/*",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0"
}
response = requests.get('https://free-proxy-list.net/', headers=headers)
return (response.text).split(sep='\n')[3:303]
### https://www.us-proxy.org/
def get_proxies_www_us_proxy_org():
headers = {
"Accept": "*/*",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0"
}
response = requests.get('https://www.us-proxy.org/', headers=headers)
return (response.text).split(sep='\n')[3:203]
### http://spys.me/proxy.txt
def get_proxies_spys_me():
headers = {
"Accept": "*/*",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0"
}
response = requests.get('http://spys.me/proxy.txt', headers=headers)
result_lines = response.text.split(sep='\n')[9:-2]
proxies = []
for line in result_lines:
line_s = line.split(sep=' ')
if len(line_s) == 4:
proxies.append(line_s[0])
return proxies
### https://api.proxyscrape.com/?request=getproxies&proxytype=all&country=all&ssl=all&anonymity=all
def get_proxies_api_proxyscrape_com():
headers = {
"Accept": "*/*",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0"
}
response = requests.get('https://api.proxyscrape.com/?request=getproxies&proxytype=all&country=all&ssl=all&anonymity=all')
return response.text.split(sep='\r\n')[:-1]
###
def get_all_proxies():
proxies = []
#
tmp_proxies = get_proxies_www_sslproxies_org()
print('\n\t{:<4} adet proxy bulundu. [https://www.sslproxies.org/]'.format(len(tmp_proxies)))
proxies += tmp_proxies
#
tmp_proxies = get_proxies_www_free_proxy_list_net()
print('\t{:<4} adet proxy bulundu. [https://free-proxy-list.net/]'.format(len(tmp_proxies)))
proxies += tmp_proxies
#
tmp_proxies = get_proxies_www_us_proxy_org()
print('\t{:<4} adet proxy bulundu. [https://www.us-proxy.org/]'.format(len(tmp_proxies)))
proxies += tmp_proxies
#
tmp_proxies = get_proxies_spys_me()
print('\t{:<4} adet proxy bulundu. [http://spys.me/proxy.txt]'.format(len(tmp_proxies)))
proxies += tmp_proxies
#
tmp_proxies = get_proxies_api_proxyscrape_com()
print('\t{:<4} adet proxy bulundu. [https://api.proxyscrape.com/?request=getproxies&proxytype=all&country=all&ssl=all&anonymity=all]'.format(len(tmp_proxies)))
proxies += tmp_proxies
#
print('\n\n\tBulunan Toplam Proxy Adedi : {}'.format(len(proxies)) )
return proxies
###
def save_all_proxies(filename='untrusted_proxy_list.txt'):
proxies = []
#
tmp_proxies = get_proxies_www_sslproxies_org()
print('\n\t{:<4} adet proxy bulundu. [https://www.sslproxies.org/]'.format(len(tmp_proxies)))
proxies += tmp_proxies
#
tmp_proxies = get_proxies_www_free_proxy_list_net()
print('\t{:<4} adet proxy bulundu. [https://free-proxy-list.net/]'.format(len(tmp_proxies)))
proxies += tmp_proxies
#
tmp_proxies = get_proxies_www_us_proxy_org()
print('\t{:<4} adet proxy bulundu. [https://www.us-proxy.org/]'.format(len(tmp_proxies)))
proxies += tmp_proxies
#
tmp_proxies = get_proxies_spys_me()
print('\t{:<4} adet proxy bulundu. [http://spys.me/proxy.txt]'.format(len(tmp_proxies)))
proxies += tmp_proxies
#
tmp_proxies = get_proxies_api_proxyscrape_com()
print('\t{:<4} adet proxy bulundu. [https://api.proxyscrape.com/?request=getproxies&proxytype=all&country=all&ssl=all&anonymity=all]'.format(len(tmp_proxies)))
proxies += tmp_proxies
#
print('\n\n\tBulunan Toplam Proxy Adedi : {}'.format(len(proxies)) )
#
with open(file=filename, mode='w') as wfile:
timestr = time.strftime("%d/%m/%Y %H:%M:%S")
file_not = f"# '{timestr}' itibariyle {len(proxies)} adet proxy bulundu.\n"
#
wfile.write('#\n')
wfile.write(file_not)
wfile.write('#\n')
#
for proxy in proxies:
wfile.write(proxy)
wfile.write('\n')
wfile.flush()
print('\tBulunan {} adet proxy "{}" dosyasına kaydedildi.'.format(len(proxies), filename) )