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"
USER_COMMENTS = "u"
"author_username": item["author"],
"author_id": item["author_fullname"],
"subreddit_name": item["subreddit"],
"subreddit_id": item["subreddit_id"],
"subreddit_subscribers": item["subreddit_subscribers"],
class RedditPageData:
def __init__(self, uri: str = "", posts: list = [], comments: list = [], after: str = ""):
self.uri = uri
self.posts = posts
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"],
"upvotes": item["ups"],