Skip to content

Instantly share code, notes, and snippets.

@shellkore
Created April 23, 2019 13:29
Show Gist options
  • Save shellkore/8e43f1edb5316c5fa7da777ad8deeb6d to your computer and use it in GitHub Desktop.
Save shellkore/8e43f1edb5316c5fa7da777ad8deeb6d to your computer and use it in GitHub Desktop.
a code snippet to get list of HTTPS proxies from "free-proxy-list.net".
import requests
import re
proxy_url = "https://free-proxy-list.net/"
def getProxyBuffer():
headers = {'User-Agent': "Mozilla/5.0"}
source = str(requests.get(proxy_url, headers=headers, timeout=10).text)
data = [list(filter(None, i))[0] for i in re.findall("<td>(.*?)</td>|<td class='hx'>(.*?)</td>", source)]
groupings = [dict(zip(['ip', 'port', 'code', 'using_anonymous', 'https'], data[i:i + 5])) for i in
range(0, len(data), 5)]
for item in groupings:
try:
if item['https'] == 'no':
groupings.remove(item)
except:
pass
final_groupings = ["{ip}:{port}".format(**i) for i in groupings]
return final_groupings
getProxyBuffer()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment