ADD: Subreddit search

This commit is contained in:
2025-11-06 14:41:46 +00:00
parent 6533bc2f13
commit a9778f26b2
3 changed files with 37 additions and 9 deletions

View File

@@ -1,9 +1,10 @@
from connectors.reddit_connector import RedditConnector
from datetime import datetime
if __name__ == "__main__":
connector = RedditConnector()
search_results = connector.get_top_posts(limit=5, timeframe='week')
search_results = connector.search_subreddit("China", "all", limit=5, timeframe="month")
for post in search_results:
print(f"Title: {post.title}\nAuthor: {post.author}\nSubreddit: {post.subreddit}\nUpvotes: {post.upvotes}")
print(f"Title: {post.title}\nAuthor: {post.author}\nSubreddit: {post.subreddit}\nUpvotes: {post.upvotes}\nSource: {post.source}\nTimestamp: {datetime.fromtimestamp(post.timestamp)}")
print("---")