当前位置:网站首页>proxy server

proxy server

2022-04-23 17:58:00 Feng Ye 520

l = [
     '106.39.179.236:80',
    '23.94.191.219:1080',
    '121.41.175.199:80',
    '122.183.139.98:8080',
    '118.193.107.182:80',
    '92.42.109.45:1080',
    '128.199.77.93:8080',
    '46.101.60.239:8118',
    '185.106.121.98:1080',
    '185.82.203.81:1080',
    '112.114.93.27:8118',
    '104.131.69.203:80',
    '138.201.0.184:1080',
    '46.101.46.174:8118',
    '178.62.123.38:8118',
    '217.23.15.193:1080',
    '60.168.207.208:8010',
    '139.59.170.110:8118',
    '223.241.118.228:8010',
    '123.192.114.113:80',
    '103.37.95.110:8000',
    '180.179.43.250:80',
    '185.117.74.81:1080',
    '116.199.2.196:80',
    '118.193.107.119:80',
    '128.199.77.93:8000',
    '170.246.114.213:8080',
    '104.243.47.146:1080',
    '111.3.108.44:8118',
    '124.42.7.103:80',
    '39.134.161.18:80',
    '146.185.156.221:8118',
    '47.89.249.110:80',
    '118.193.107.192:80',
    '124.232.163.10:3128',
    '223.19.105.206:80',
    '46.166.168.243:1080',
    '118.114.77.47:8080',
    '182.253.205.85:8090',
    '45.55.132.29:9999',
    '58.251.227.238:8118',
    '118.193.107.142:80',
    '118.193.107.135:80',
    '118.193.107.219:80',
    '46.101.45.212:8118',
    '114.249.45.176:8118',
    '80.152.201.116:8080',
    '94.177.254.86:80',
    '197.155.158.22:80',
    '196.200.173.83:80',
    '212.237.10.45:8080',
    '188.166.144.173:8118',
    '210.71.198.230:8118',
    '177.114.228.112:8080',
    '218.50.2.102:8080',
    '198.204.251.158:1080',
    '188.166.204.221:8118',
    '185.117.74.126:1080',
    '106.39.179.244:80',
    '39.134.161.14:8080',
    '85.10.247.136:1080',
    '46.166.168.245:1080',
    '5.167.50.35:3129',
    '118.178.227.171:80',
    '122.96.59.102:82',
    '52.174.89.111:80',
    '103.25.173.237:808',
    '121.232.145.168:9000',
    '103.251.167.8:1080',
    '46.101.26.217:8118',
    '171.37.178.175:9797',
    '103.251.166.18:1080',
    '186.225.176.93:8080',
    '121.232.147.132:9000',
    '104.224.168.178:8888',
    '47.90.2.253:8118',
    '121.232.145.82:9000',
    '118.193.107.36:80',
    '58.56.128.84:9001',
    '139.59.153.59:80',
    '122.183.139.101:8080',
    '163.172.184.226:8118',
    '198.204.251.146:1080',
    '213.133.100.195:1080',
    '42.104.84.106:8080',
    '117.2.64.109:8888',
    '121.232.144.229:9000',
    '156.67.219.61:8080',
    '138.36.106.90:80',
    '1.179.233.66:80',
    '222.33.192.238:8118',
    '138.197.224.12:8118',
    '151.106.10.6:1080',
    '134.35.250.204:8080',
    '58.251.227.233:8118',
    '52.221.40.19:80',
    '222.73.68.144:8090',
    '46.166.168.247:1080',
    '192.99.222.207:80',
    '1.23.160.212:8080',
 ]
#394996257  aljnn6er
#116.62.112.142  16816

from urllib import request
import re

# Detect proxy server
def checkProxy(html):
    data = re.compile("<title> use Baidu Search , You will know </title>")
    title = data.findall(html)
    if title:
        return True
    return False


def user_http_proxy(proxy_addr, url):
    # Construct proxy server handler
    proxyH = request.ProxyHandler({"http":proxy_addr})
    # By this proxy handler Create a http Of opener
    opener = request.build_opener(proxyH, request.HTTPHandler)
    # Put this opener Pack in urllib
    request.install_opener(opener)
    
    # request
    res = request.urlopen(url, timeout=6)
    # Read information
    data = res.read().decode()
    return data


if __name__ == "__main__":
#    proxy_addr = "394996257:[email protected]:16816"

#    Test the free proxy server
#    for i in l:
#        proxy_addr = i
#        try:
#            data = user_http_proxy(proxy_addr, "http://www.sina.com")
#            print(i)
#        except:
#            continue
        
#121.41.175.199:80
#124.42.7.103:80
#197.155.158.22:80
#218.50.2.102:8080
#58.56.128.84:9001
    
    
    proxy_addr = "124.42.7.103:80"
    data = user_http_proxy(proxy_addr, "http://www.baidu.com")
    print(checkProxy(data))
    with open('1.html','wb') as f:
        f.write(data.encode())
        
    
#    print(data)
 

版权声明
本文为[Feng Ye 520]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230546152289.html