Level 2 comments
This commit is contained in:
parent
301e95b450
commit
61015c6087
@ -3,4 +3,7 @@
|
|||||||
<div class="score"><!--score--></div>
|
<div class="score"><!--score--></div>
|
||||||
<a href="<!--link-->"><time title="<!--timestamp-->"><!--date--></time></a>
|
<a href="<!--link-->"><time title="<!--timestamp-->"><!--date--></time></a>
|
||||||
<div class="body"><!--body--></div>
|
<div class="body"><!--body--></div>
|
||||||
|
<div class="child-comments">
|
||||||
|
<!--children-->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
@ -28,7 +28,7 @@ def get_saved_posts(client):
|
|||||||
"""Gets a list of posts that the user has saved."""
|
"""Gets a list of posts that the user has saved."""
|
||||||
|
|
||||||
return [
|
return [
|
||||||
saved for saved in client.user.me().saved(limit=20)
|
saved for saved in client.user.me().saved(limit=None)
|
||||||
if saved.__class__.__name__ == "Submission"
|
if saved.__class__.__name__ == "Submission"
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ def create_post_page_html(post, post_html):
|
|||||||
return html
|
return html
|
||||||
|
|
||||||
|
|
||||||
def get_comment_html(comment):
|
def get_comment_html(comment, children=True):
|
||||||
with open(os.path.join("html", "comment-div.html")) as f:
|
with open(os.path.join("html", "comment-div.html")) as f:
|
||||||
html = f.read()
|
html = f.read()
|
||||||
dt = datetime.utcfromtimestamp(comment.created_utc)
|
dt = datetime.utcfromtimestamp(comment.created_utc)
|
||||||
@ -185,4 +185,9 @@ def get_comment_html(comment):
|
|||||||
html = html.replace("<!--link-->", f"https://reddit.com{comment.permalink}")
|
html = html.replace("<!--link-->", f"https://reddit.com{comment.permalink}")
|
||||||
html = html.replace("<!--timestamp-->", str(dt))
|
html = html.replace("<!--timestamp-->", str(dt))
|
||||||
html = html.replace("<!--date-->", dt.strftime("%H:%M - %d %B, %Y"))
|
html = html.replace("<!--date-->", dt.strftime("%H:%M - %d %B, %Y"))
|
||||||
|
if children:
|
||||||
|
children_html = []
|
||||||
|
for child in comment.replies:
|
||||||
|
children_html.append(get_comment_html(child, children=False))
|
||||||
|
html = html.replace("<!--children-->", "\n".join(children_html))
|
||||||
return html
|
return html
|
Loading…
Reference in New Issue
Block a user