fix downloading size check issue

pull/266/head
butaixianran 2023-09-28 10:24:53 +08:00
parent 6932a9e871
commit 32555824bb
2 changed files with 7 additions and 1 deletions

View File

@ -109,6 +109,12 @@ def dl(url, folder, filename, filepath):
print() print()
# check file size
downloaded_size = os.path.getsize(dl_file_path)
if downloaded_size < total_size:
util.printD(f"Download failed due to insufficient file size. Try again later or download it manually: {url}")
return
# rename file # rename file
os.rename(dl_file_path, file_path) os.rename(dl_file_path, file_path)
util.printD(f"File Downloaded to: {file_path}") util.printD(f"File Downloaded to: {file_path}")

View File

@ -6,7 +6,7 @@ import requests
import shutil import shutil
version = "1.8.1" version = "1.8.2"
def_headers = {'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'} def_headers = {'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'}