This commit is contained in:
shikong 2024-03-15 15:16:33 +08:00
parent b4423f9084
commit 41c6c887f5

View File

@ -61,11 +61,13 @@ def tasks(device: str, start_time: str, end_time: str):
start = datetime.datetime.now()
start_str = start.strftime("%Y-%m-%d %H:%M:%S.%f")
print(f"{start_str} 开始下载: {url}")
urllib.request.urlretrieve(url,
f"{tmp_path}/{device}_{start_time}_{end_time}.mp4")
file_path = f"{tmp_path}/{device}_{start_time}_{end_time}.mp4"
urllib.request.urlretrieve(url, file_path)
end = datetime.datetime.now()
print(
f"{device} {start_time}-{end_time}: 下载用时: {(end - start).total_seconds()}")
stats = os.stat(file_path)
print(f"文件 {file_path} 大小: {stats.st_size}")
if __name__ == '__main__':