Skip to content

Instantly share code, notes, and snippets.

@seyed-dev
Created May 30, 2018 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seyed-dev/332d4b2721f1da229c0e898cbee74fbd to your computer and use it in GitHub Desktop.
Save seyed-dev/332d4b2721f1da229c0e898cbee74fbd to your computer and use it in GitHub Desktop.
get free proxy
from bs4 import BeautifulSoup
import requests
import re
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko)'
' Chrome/39.0.2171.95 Safari/537.36'
}
req = requests.get('https://www.sslproxies.org/', headers=headers)
soup = BeautifulSoup(req.text, 'html.parser')
td = soup.find_all("td")
proxy = []
port = []
for x in td:
if re.findall("\d+\.\d+\.\d+\.\d+", str(x)):
#print(x.get_text())
proxy.append(x.get_text())
if re.findall("\d+", str(x)):
if len(x.get_text()) < 6:
#print(x.get_text())
port.append(x.get_text())
with open('proxy.txt','w') as file:
for i in range(0, len(proxy)):
print('{}:{}'.format(proxy[i], port[i]))
file.write('{}:{}\n'.format(proxy[i], port[i]))
file.close()
#SEYED :D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment