diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 8fb9e9d..ed1e8cf 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -134,6 +134,7 @@ def get_subreddit_threads(POST_ID: str): content["thread_url"] = threadurl content["thread_title"] = submission.title content["thread_id"] = submission.id + content["is_nsfw"] = submission.over_18 content["comments"] = [] if settings.config["settings"]["storymode"]: if settings.config["settings"]["storymodemethod"] == 1: diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index 8e537d1..f7fe7db 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -110,13 +110,18 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int): page.locator('[data-test-id="post-content"]').screenshot(path=postcontentpath) except TimeoutError as e: - print_step("unable to locate post It is possibly Due to a NSFW post or unstable internet") - resp = input("Do you want to skip the post?(y/n)") - if resp.startswith("y"): - save_data("","","skiped",reddit_id,"") - print("Now you can re run the program this post will skipped") - exit() - raise e + if settings.config["is_nsfw"] : + print_step("Unable to get post It is due to a NSFW post") + resp = input("Do you want to skip the post?(y/n)") + if resp.casefold().startswith("y"): + save_data("","","skiped",reddit_id,"") + print("Now you can re run the program this post will skipped") + exit() + else: + raise e + + + if storymode: page.locator('[data-click-id="text"]').first.screenshot(