''' Created on 2020/11/02 @author: chhao ''' import requests import re #Free Proxy Listサイト情報取得 res = requests.get('https://free-proxy-list.net/') res.text #print(res.text) #IPとPort情報の取得 m = re.findall('\d+\.\d+\.\d+\.\d+\:\d+', res.text) #print(re.findall('\d+\.\d+\.\d+\.\d+\:\d+', res.text)) validips = [] for ip in m: #有無効の検証 try: res = requests.get('https://api.ipify.org?format=json',proxies = {'http':ip,'https':ip},timeout = 5) #res.json() validips.append({'ip':ip}) print(res.json()) #print(validips) except: print('FAIL',ip)