如果你也喜欢猫猫(>ω<)喵
import urllib.request
import random
import time
height = random.randint(1,1024)
weight = random.randint(1,1024)
new_url='http://placekitten.com/'+str(height)+'/'+str(weight)
ip_list=['14.116.213.100:8081','14.18.109.42:8081','47.107.128.69:888','47.108.155.96:80','183.7.29.244:9999','36.57.68.239:8888','171.15.65.120:8080']
dynamic_ip=random.choice(ip_list)
proxy_support = urllib.request.ProxyHandler({'https':dynamic_ip})
opener = urllib.request.build_opener(proxy_support)
urllib.request.install_opener(opener)
opener.addheaders = [('User-Agent','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36')]
'''
disguse_url ={}
disguse_url['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0;Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36'
'''
response = urllib.request.urlopen(new_url)
cat_img = response.read()
with open ('cat_img_'+str(height)+str(weight)+'.jpg','wb') as f:
f.write(cat_img)
"""
response = urllib.request.urlopen('https://www.whatismyip.com.tw')
html = response.read().decode('utf-8')
"""
time.sleep(10)