|
|
|
@ -271,7 +271,7 @@ def fetch_duckduckgo_news_context(title, hours=24): |
|
|
|
return title |
|
|
|
return title |
|
|
|
|
|
|
|
|
|
|
|
def fetch_reddit_posts(): |
|
|
|
def fetch_reddit_posts(): |
|
|
|
"""Fetch Reddit posts from specified subreddits, filtering low-quality posts.""" |
|
|
|
"""Fetch Reddit posts from specified subreddits, filtering low-quality and [homemade] posts.""" |
|
|
|
try: |
|
|
|
try: |
|
|
|
reddit = praw.Reddit( |
|
|
|
reddit = praw.Reddit( |
|
|
|
client_id=REDDIT_CLIENT_ID, |
|
|
|
client_id=REDDIT_CLIENT_ID, |
|
|
|
@ -301,6 +301,9 @@ def fetch_reddit_posts(): |
|
|
|
if pub_date < cutoff_date: |
|
|
|
if pub_date < cutoff_date: |
|
|
|
logging.info(f"Skipping old post: {submission.title} (Published: {pub_date})") |
|
|
|
logging.info(f"Skipping old post: {submission.title} (Published: {pub_date})") |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
if "[homemade]" in submission.title.lower(): |
|
|
|
|
|
|
|
logging.info(f"Skipping homemade post: {submission.title}") |
|
|
|
|
|
|
|
continue |
|
|
|
cleaned_title = clean_reddit_title(submission.title) |
|
|
|
cleaned_title = clean_reddit_title(submission.title) |
|
|
|
if not cleaned_title or len(cleaned_title) < 5: |
|
|
|
if not cleaned_title or len(cleaned_title) < 5: |
|
|
|
logging.info(f"Skipping post with invalid or short title: {submission.title}") |
|
|
|
logging.info(f"Skipping post with invalid or short title: {submission.title}") |
|
|
|
|