diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 5c4b6a1..d2244ff 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -86,7 +86,7 @@ def get_subreddit_threads(POST_ID: str): else: threads = subreddit.hot(limit=25) submission = get_subreddit_undone(threads, subreddit) - submission = check_done(submission) # double-checking + if submission is None: return get_subreddit_threads(POST_ID) # submission already done. rerun @@ -94,9 +94,6 @@ def get_subreddit_threads(POST_ID: str): if not submission.selftext and settings.config["reddit"]["thread"]["post_id"] != "": print_substep("You are trying to use story mode on post with no post text") exit() - elif not submission.selftext: - print_substep("You are trying to use story mode on post with no post text") - return get_subreddit_threads(POST_ID) else: # Check for the length of the post text if len(submission.selftext) > (settings.config["settings"]["storymode_max_length"] or 2000): @@ -106,16 +103,21 @@ def get_subreddit_threads(POST_ID: str): return get_subreddit_threads(POST_ID) elif not submission.num_comments: return get_subreddit_threads(POST_ID) + + submission = check_done(submission) # double-checking + upvotes = submission.score ratio = submission.upvote_ratio * 100 num_comments = submission.num_comments + threadurl = f"https://reddit.com{submission.permalink}" print_substep(f"Video will be: {submission.title} :thumbsup:", style="bold green") + print_substep(f"Thread url is : {threadurl} :thumbsup:", style="bold green") print_substep(f"Thread has {upvotes} upvotes", style="bold blue") print_substep(f"Thread has a upvote ratio of {ratio}%", style="bold blue") print_substep(f"Thread has {num_comments} comments", style="bold blue") - content["thread_url"] = f"https://reddit.com{submission.permalink}" + content["thread_url"] = threadurl content["thread_title"] = submission.title content["thread_id"] = submission.id content["comments"] = []