#coding:utf-8

from requests import * import re import threading

def check_proxy(proxy): proxy = proxy.replace('\n','') proxies={"http":proxy,"https":proxy} headers = { "Host": "www.google.com", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0", "Accept": "/", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Referer": "https://www.google.com/" }

url = 'https://www.google.com'
try:
	html = get(url,timeout=10,headers=headers,proxies=proxies)
	if html.status_code == 200:
		proxy = proxy.split('https://')[1]
	f =  open('./proxyip.txt','a')
	print(proxy,file=f)
except Exception as e:
	pass

threads = [] for proxy in open("proxy.txt"): t = threading.Thread(target=check_proxy,args=(proxy,)) threads.append(t)

for t in threads: t.start()

for t in threads: t.join(

加个多线程#codingutf-8from requests import import refor proxy in openproxytxt	proxy = proxyreplacen	proxies=httpproxyhttpsproxy	headers = 		Host wwwgooglecom		User-Agent Mozilla50 Windows NT 100; Win64; x6

原文地址: http://www.cveoy.top/t/topic/fkhZ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录