Created
April 18, 2018 02:04
-
-
Save pantuts/36212835168057b2d0c64fd3025e9abd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re, requests | |
from bs4 import BeautifulSoup | |
u = 'https://free-proxy-list.net/' | |
soup = BeautifulSoup(requests.get(u).text, 'lxml') | |
trs = soup.find_all('tr') | |
for tr in trs: | |
_ip = tr.find('td', text=re.compile(r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$')) | |
if not _ip: continue | |
ip = _ip.get_text().strip() | |
port = _ip.find_next('td').get_text().strip() | |
country = _ip.find_next().find_next().get_text().strip() | |
print('{:<20}{:<10}{}'.format(ip, port, country)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment