diff --git a/.env.template b/.env.template index e95c209..5830840 100644 --- a/.env.template +++ b/.env.template @@ -16,5 +16,14 @@ THEME="" # Enter a subreddit, e.g. "AskReddit" SUBREDDIT="" +# Filters the comments by range of lenght (min and max characters) +# Min has to be less or equal to max +# DO NOT INSERT ANY SPACES BETWEEN THE COMMA AND THE VALUES +COMMENT_LENGTH_RANGE = "min,max" + # Range is 0 -> 1 OPACITY="0.9" + +# The absolute path of the folder where you want to save the final video +# If empty or wrong, the path will be 'assets/' +FINAL_VIDEO_PATH="" \ No newline at end of file diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 2bd1f8a..2ee9235 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -114,7 +114,7 @@ def get_subreddit_threads(subreddit_, thread_link_, number_of_comments): comment_count = 0 for top_level_comment in submission.comments: if number_of_comments is not None: - if comment_count > number_of_comments: + if comment_count == number_of_comments: break if not top_level_comment.stickied: @@ -125,6 +125,7 @@ def get_subreddit_threads(subreddit_, thread_link_, number_of_comments): "comment_id": top_level_comment.id, } ) + count += 1 except AttributeError: pass diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index eb1bbba..df4b9a9 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -38,9 +38,9 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme): page.set_viewport_size(ViewportSize(width=1920, height=1080)) if page.locator('[data-testid="content-gate"]').is_visible(): # This means the post is NSFW and requires to click the proceed button. - print_substep("Post is NSFW. You are spicy...") page.locator('[data-testid="content-gate"] button').click() + page.locator('[data-click-id="text"] button').click() # Remove "Click to see nsfw" Button in Screenshot page.locator('[data-test-id="post-content"]').screenshot(path="assets/png/title.png")