Add nsfw flag & improved error handling

pull/1476/head
electro199 2 years ago
parent e6e27f3240
commit c0916c13bb

@ -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:

@ -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(

Loading…
Cancel
Save