Created RedditPageData class, for outputing various data components from the RedditPage class

This commit is contained in:
Nathan Windisch 2024-07-24 22:37:26 +01:00
parent 3020e015b5
commit 6072d70aea

View File

@ -24,11 +24,14 @@ class RedditPageType(Enum):
SUBREDDIT_COMMENTS = "r" SUBREDDIT_COMMENTS = "r"
USER_COMMENTS = "u" USER_COMMENTS = "u"
"author_username": item["author"], class RedditPageData:
"author_id": item["author_fullname"], def __init__(self, uri: str = "", posts: list = [], comments: list = [], after: str = ""):
"subreddit_name": item["subreddit"], self.uri = uri
"subreddit_id": item["subreddit_id"], self.posts = posts
"subreddit_subscribers": item["subreddit_subscribers"], self.comments = comments
self.after = after
def __str__(self): return json.dumps({ "uri": self.uri, "posts": self.posts, "comments": self.comments, "after": self.after })
"score": item["score"], "score": item["score"],
"upvotes": item["ups"], "upvotes": item["ups"],