Last active
May 26, 2020 17:49
-
-
Save silgon/fb27d237c68e3487f8e01a56a084cee9 to your computer and use it in GitHub Desktop.
This file contains 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
#extracted from: https://www.scrapehero.com/how-to-rotate-proxies-and-ip-addresses-using-python-3/ | |
import requests | |
from lxml.html import fromstring | |
def get_proxies(): | |
url = 'https://free-proxy-list.net/' | |
response = requests.get(url) | |
parser = fromstring(response.text) | |
proxies = set() | |
for i in parser.xpath('//tbody/tr'): | |
if i.xpath('.//td[7][contains(text(),"yes")]'): | |
#Grabbing IP and corresponding PORT | |
proxy = ":".join([i.xpath('.//td[1]/text()')[0], i.xpath('.//td[2]/text()')[0]]) | |
proxies.add(proxy) | |
return proxies |
This file contains 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
#extracted from: https://www.scrapehero.com/how-to-rotate-proxies-and-ip-addresses-using-python-3/ | |
import requests | |
from lxml.html import fromstring | |
def get_proxies(): | |
url = 'https://free-proxy-list.net/' | |
response = requests.get(url) | |
parser = fromstring(response.text) | |
proxies = set() | |
for i in parser.xpath('//tbody/tr'): | |
if i.xpath('.//td[7][contains(text(),"yes")]') and ( | |
i.xpath('.//td[5][contains(text(),"anonymous")]') or | |
i.xpath('.//td[5][contains(text(),"elite proxy")]') ): | |
proxy = ":".join([i.xpath('.//td[1]/text()')[0], i.xpath('.//td[2]/text()')[0]]) | |
proxies.add(proxy) | |
return proxies |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment