Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. '''fplproxies.py
  2. scrapes 600 http(s) proxies to ip:port
  3.  
  4. https://www.sslproxies.org 100
  5. https://www.us-proxy.org 200
  6. https://free-proxy-list.net 300
  7. '''
  8.  
  9. def z(fpl):
  10.  
  11.     from requests_html import HTMLSession
  12.  
  13.     session = HTMLSession()  # session appears to be currently required for a single get request with this library?
  14.  
  15.     cells = session.get(fpl).html.find('td')  # table cells
  16.  
  17.     s = ''  # string as data stream to then parse
  18.  
  19.     for cell in cells:
  20.         c = cell.text
  21.         if not c.lower().islower():  # lowercase all letters and then check if islower to determine if the cell contains letters (only ip and port cells will remain)
  22.             if '.' in c: c = 'proxy' + c + ':'  # ip's will have .
  23.             s += c  # string together to be parsed
  24.  
  25.     p = s.replace('proxy', '\n')  # proxyip:portproxyip:portproxyip:port -> ip:port\nip:port\n...
  26.  
  27.     print(p)
  28.  
  29. z('https://www.sslproxies.org')
  30. z('https://www.us-proxy.org')
  31. z('https://free-proxy-list.net')
  32. #z('https://www.socks-proxy.net')  # socks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement