From 77f68b847c400409a2f19d37cdc1108b4f1ac0bb Mon Sep 17 00:00:00 2001 From: reoccurcat Date: Fri, 3 Jun 2022 12:31:05 -0500 Subject: [PATCH] fixed dark mode bug --- video_creation/screenshot_downloader.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index 9b06ae0..4b07bd7 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -22,11 +22,14 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme): browser = p.chromium.launch() context = browser.new_context() - - if theme.casefold() == "dark": - cookie_file = open('video_creation/cookies.json') - cookies = json.load(cookie_file) - context.add_cookies(cookies) + + try: + if theme.casefold() == "dark": + cookie_file = open('video_creation/cookies.json') + cookies = json.load(cookie_file) + context.add_cookies(cookies) + except AttributeError: + pass # Get the thread screenshot page = context.new_page()