This commit is contained in:
Bhupesh-V 2024-01-19 19:39:51 +05:30
parent 5d7700d61b
commit 9cce47796f

View File

@ -26,6 +26,7 @@ def get_posts_by_flair(subreddit, flair):
for post in subreddit.search(f'flair_name:"{flair}"', time_filter='month'):
post_date = datetime.datetime.fromtimestamp(post.created_utc)
if post_date.year == current_year and post_date.month == current_month:
post.title = post.title.replace("|", "\\|") # Escape the "|" character
posts.append(post)
posts = sorted(posts, key=lambda post: post.created_utc, reverse=True)