1.在settings文件中添加ip池 IPPOOL=['xxx.xx.xx.xx','xxx.xx.xxx.xx'] 2.在middleware文件中添加自己的代理ip类(首先需要导入ipPOOL,random模块) class Myproxymiddleware(object): def __init__(self,ip=''): self.ip = ip def process_request(self,request,spider) ip = random.choice(IPPOOL)…