mirror of
https://github.com/tgbot-collection/ytdlbot.git
synced 2025-02-23 14:54:14 +08:00
fix maxsize
This commit is contained in:
parent
876d8f629e
commit
b166729478
1 changed files with 4 additions and 1 deletions
|
@ -327,6 +327,9 @@ def detect_filesize(url: "str") -> "int":
|
||||||
# find the largest file size
|
# find the largest file size
|
||||||
with ytdl.YoutubeDL() as ydl:
|
with ytdl.YoutubeDL() as ydl:
|
||||||
info_dict = ydl.extract_info(url, download=False)
|
info_dict = ydl.extract_info(url, download=False)
|
||||||
max_size = max([i.get("filesize", 0) for i in info_dict["formats"] if i.get("filesize")])
|
max_size = 0
|
||||||
|
max_size_list = [i.get("filesize", 0) for i in info_dict["formats"] if i.get("filesize")]
|
||||||
|
if max_size_list:
|
||||||
|
max_size = max(max_size_list)
|
||||||
logging.info("%s max size is %s", url, max_size)
|
logging.info("%s max size is %s", url, max_size)
|
||||||
return max_size
|
return max_size
|
||||||
|
|
Loading…
Reference in a new issue