Author: Not specified Language: text
Description: Not specified Timestamp: 2018-06-26 19:15:09 +0000
View raw paste Reply
  1. import requests
  2. from bs4 import BeautifulSoup as bs
  3.  
  4. s=requests.get('https://free-proxy-list.net')
  5. soup = bs(s.text)
  6.  
  7. tr = soup.find_all('tr')
  8.  
  9. for x in tr:
  10.  try:
  11.   g = [row for row in x.find_all('td')]
  12.   if len(g) != 8:
  13.    continue
  14.   ip=g[0].text
  15.   port=g[1].text
  16.   country=g[2].text
  17.   # check proxy
  18.   data = "%s:%s" % (ip,port)
  19.   for proto in ['http','https']:
  20.    proxy = {proto:str(proto)+'://'+str(data)}
  21.    gr = requests.get('https://google.com', proxies=proxy, timeout=3)
  22.    if gr:
  23.     print "%s,%s:%s,%s" % (country,ip,port,proto)
  24.  except Exception as e:
  25.   pass
  26.   pass
View raw paste Reply