Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PostCleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def delete_old_posts(reddit, username, days_old):
with open("deleted_posts.txt", "a", encoding="utf-8") as f:
created_at = datetime.utcfromtimestamp(submission.created_utc).strftime("%Y-%m-%dT%H:%M:%SZ")
deleted_at = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
f.write(f"{submission.title}, {created_at}, {deleted_at}, {submission.score}, {submission.subreddit.display_name}\n")
f.write(f"{submission.title}, {created_at}, {deleted_at}, {submission.score}, {submission.subreddit.display_name}, https://reddit.com{submission.permalink}\n")
try:
submission.edit(".")
submission.delete()
Expand Down
6 changes: 3 additions & 3 deletions commentCleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def delete_old_comments(reddit, username, days_old, comments_deleted):
created_at = datetime.utcfromtimestamp(comment.created_utc).strftime("%Y-%m-%dT%H:%M:%SZ")
deleted_at = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
with open('deleted_comments.txt', 'a', encoding='utf-8') as f:
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.body}\n")
f.write(f"{deleted_at} | {created_at} | {comment.score} | https://reddit.com{comment.permalink} | {comment.body}\n")
try:
comment.edit(".")
comment.delete()
Expand All @@ -131,7 +131,7 @@ def remove_comments_with_negative_karma(reddit, username, comments_deleted):
created_at = datetime.utcfromtimestamp(comment.created_utc).strftime("%Y-%m-%dT%H:%M:%SZ")
deleted_at = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
with open('deleted_comments.txt', 'a', encoding='utf-8') as f:
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.body}\n")
f.write(f"{deleted_at} | {created_at} | {comment.score} | https://reddit.com{comment.permalink} | {comment.body}\n")
try:
comment.edit(".")
comment.delete()
Expand Down Expand Up @@ -164,7 +164,7 @@ def remove_comments_with_one_karma_and_no_replies(reddit, username, comments_del
created_at = datetime.utcfromtimestamp(comment.created_utc).strftime("%Y-%m-%dT%H:%M:%SZ")
deleted_at = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
with open('deleted_comments.txt', 'a', encoding='utf-8') as f:
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.body}\n")
f.write(f"{deleted_at} | {created_at} | {comment.score} | https://reddit.com{comment.permalink} | {comment.body}\n")
try:
comment.edit(".")
comment.delete()
Expand Down
5 changes: 3 additions & 2 deletions web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def api_delete():
created_at = datetime.utcfromtimestamp(comment.created_utc).strftime("%Y-%m-%dT%H:%M:%SZ")
deleted_at = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
with open(DELETED_COMMENTS_FILE, "a", encoding="utf-8") as f:
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.body}\n")
f.write(f"{deleted_at} | {created_at} | {comment.score} | https://reddit.com{comment.permalink} | {comment.body}\n")
comment.edit(".")
comment.delete()
deleted_comments += 1
Expand All @@ -147,7 +147,8 @@ def api_delete():
f"{created_at}, "
f"{deleted_at}, "
f"{submission.score}, "
f"{submission.subreddit.display_name}\n"
f"{submission.subreddit.display_name}, "
f"https://reddit.com{submission.permalink}\n"
)
submission.edit(".")
submission.delete()
Expand Down
5 changes: 3 additions & 2 deletions weekly_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def main(dry_run: bool = False):
print(f" [DRY RUN] Would delete comment (score={comment.score}) in r/{comment.subreddit}: {comment.body[:80]!r}")
else:
with open("deleted_comments.txt", "a", encoding="utf-8") as f:
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.body}\n")
f.write(f"{deleted_at} | {created_at} | {comment.score} | https://reddit.com{comment.permalink} | {comment.body}\n")
try:
comment.edit(".")
comment.delete()
Expand All @@ -120,7 +120,8 @@ def main(dry_run: bool = False):
f"{created_at}, "
f"{deleted_at}, "
f"{submission.score}, "
f"{submission.subreddit.display_name}\n"
f"{submission.subreddit.display_name}, "
f"https://reddit.com{submission.permalink}\n"
)
try:
submission.edit(".")
Expand Down
Loading