defpe(): for i inrange(1,3400): url = "https://img.loliapi.cn/i/pe/img{}.webp".format(str(i)) print(url) resp = requests.get(url) if resp.status_code == 404: break if os.path.exists("./img/pe/img{}.webp".format(i)): print("./img/pe/img{}.webp已存在".format(i)) pass else: withopen("./img/pe/img{}.webp".format(i), 'wb') as f: f.write(resp.content)
defpc(): for i inrange(690,1000): url = "https://img.loliapi.cn/i/pc/img{}.webp".format(str(i)) print(url) resp = requests.get(url) if resp.status_code == 404: break if os.path.exists("./img/pc/img{}.webp".format(i)): print("./img/pc/img{}.webp已存在".format(i)) pass else: withopen("./img/pc/img{}.webp".format(i),'wb') as f: f.write(resp.content)
if __name__ == '__main__': model = int(input()) if model == 1: pc() elif model == 0: pe()