renix1

get proxies with urllib3

Jan 23rd, 2017
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. import urllib3
  2.  
  3. def proxies():
  4.     html = ""
  5.     http = urllib3.PoolManager().request('GET', 'https://www.us-proxy.org/')
  6.     ips = []
  7.     if http.status:
  8.         html = http.data
  9.         tabela_ips = html[html.find("<tbody>"):html.find("</tbody>")].split()
  10.         for l in tabela_ips:
  11.             data = l[l.find('<td>')+4:l.find('</td>')]
  12.             if not data.isalnum():
  13.                 ips.append(data)
  14.         return filter(None, ips)
Advertisement
Add Comment
Please, Sign In to add comment