minor fixes

This commit is contained in:
Dantenerosas 2023-09-29 13:46:52 +03:00 committed by nikili0n
parent 314b44aca7
commit eb0a041de5

View File

@ -24,10 +24,17 @@ class BaseParser:
} }
downloader = VideoDownloader(link=self.params["link"], ydl_opts=ydl_opts) downloader = VideoDownloader(link=self.params["link"], ydl_opts=ydl_opts)
downloader.get_info() downloader.get_info()
path_to_video = f"{downloader.info['extractor_key']}/{downloader.info['id']}_{downloader.info['resolution']}.{downloader.info['ext']}"
if 'resolution' in downloader.info and downloader.info["resolution"]:
resolution = downloader.info['resolution']
else:
resolution = "NA"
path_to_video = f"{downloader.info['extractor_key']}/{downloader.info['id']}_{resolution}.{downloader.info['ext']}"
if os.path.exists(os.path.join(os.getcwd() + "/downloads/" + path_to_video)): if os.path.exists(os.path.join(os.getcwd() + "/downloads/" + path_to_video)):
raise FileAlreadyExistException(message=path_to_video) raise FileAlreadyExistException(message=path_to_video)
downloader.ydl_opts["quiet"] = False downloader.ydl_opts["quiet"] = False
downloader.ydl_opts["quiet"] = False
downloader.download() downloader.download()
return path_to_video return path_to_video