-
Notifications
You must be signed in to change notification settings - Fork 2
/
retrieve.py
34 lines (26 loc) · 1.03 KB
/
retrieve.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
import requests
from bs4 import BeautifulSoup
def get_proxies():
anonymity = { 'elite proxy' : {'ip' : True, 'proxy' : True},
'anonymous' : {'ip' : True, 'proxy' : False},
'transparent' : {'ip' : False, 'proxy' : False},
}
r = requests.get('https://www.us-proxy.org/')
soup = BeautifulSoup(r.content, 'html.parser')
tbl = soup.find('table')
rows = tbl.find_all('tr')
proxies = []
for row in rows[1:201]:
cells = row.find_all('td')
ip = cells[0].text + ':' + cells[1].text
https = cells[6].text
is_ip_hidden = anonymity[cells[4].text]['ip']
is_proxy_hidden = anonymity[cells[4].text]['proxy']
last_checked = cells[7].text
if https == 'yes':
proxies.append({'ip_address' : ip,
'last_checked' : last_checked,
'is_proxy_hidden' : is_proxy_hidden,
'is_ip_hidden' : is_ip_hidden,
})
return proxies