From 29de549ef3c1ca4b181d905e8a9a70803a3426ac Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Mon, 11 Jul 2022 17:52:12 +0100 Subject: [PATCH] fix: skip comments that are blank after sanitisation --- reddit/subreddit.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index b64a52a..c316ccf 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -7,6 +7,7 @@ from praw.models import MoreComments from utils.console import print_step, print_substep from utils.subreddit import get_subreddit_undone from utils.videos import check_done +from utils.voice import sanitize_text def get_subreddit_threads(POST_ID: str): @@ -95,6 +96,9 @@ def get_subreddit_threads(POST_ID: str): if top_level_comment.body in ["[removed]", "[deleted]"]: continue # # see https://github.com/JasonLovesDoggo/RedditVideoMakerBot/issues/78 if not top_level_comment.stickied: + sanitised = sanitize_text(top_level_comment.body) + if not sanitised or sanitised != " ": + continue if len(top_level_comment.body) <= int( settings.config["reddit"]["thread"]["max_comment_length"] ):