From 087043811f3418a96240e30a4bea9f4d00071725 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 7 May 2022 09:34:33 +0700 Subject: [PATCH] avoid unneeded cookie open --- tubearchivist/home/src/download/yt_cookie.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tubearchivist/home/src/download/yt_cookie.py b/tubearchivist/home/src/download/yt_cookie.py index 3b16ca5..3a7244e 100644 --- a/tubearchivist/home/src/download/yt_cookie.py +++ b/tubearchivist/home/src/download/yt_cookie.py @@ -40,6 +40,9 @@ class CookieHandler: print("no cookie imported") raise FileNotFoundError + if os.path.exists(self.COOKIE_PATH): + return self.COOKIE_PATH + with open(self.COOKIE_PATH, "w", encoding="utf-8") as cookie_file: cookie_file.write(cookie)