我正在尝试下载流:
try:
r = requests.get(url, stream=True)
except Exception as e:
print(e)
time.sleep(100)
try:
r = requests.get(url, stream=True)
except Exception as e:
print('second request - ', e)
with open(path, 'wb') as f:
print(path)
for chunk in r.iter_content(chunk_size=1024):
# filter out keep-alive new chunks
if chunk:
f.write(chunk)
但是在某些视频上只是“卡住/冻结”,如果未在预定时间内下载,我想进行检查和重置。