我在第 7 行出错。我只有这个托管(https://prnt.sc/)有问题,我收到下一个错误:requests.exceptions.SSLError:EOF发生违反协议(_ssl.c:777)
我尝试使用其他库,如 urllib 和 wget,遇到了同样的问题
import requests
from random import choice
alph = 'abcdefghijklmnopqrstuvwxyz1234567890'
url_start = 'm3sm4x'
url_finish = 'https://prnt.sc/'+url_start+'.img'
filename = 'D:\\imgur\\content\\'+url_finish.split('/')[-1]
img = requests.get(url_finish, stream=True)
n = 0
while n != 100:
url_start = url_start.replace(choice(url_start),choice(alph))
url_finish = 'https://prnt.sc/'+url_start+'.img'
n+=1
try:
img = requests.get(url_finish, stream=True)
except:
print('invalid')
if img.status_code == 200:
with open('D:\\imgur\\content\\'+filename,' wb') as f:
f.write(img)
杨__羊羊
相关分类