diff --git a/PostCleaner.py b/PostCleaner.py index aa645fd..c6fcfef 100644 --- a/PostCleaner.py +++ b/PostCleaner.py @@ -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.name}, {submission.score}, {submission.subreddit.display_name}\n") try: submission.edit(".") submission.delete() diff --git a/commentCleaner.py b/commentCleaner.py index 413d90d..b3965ea 100644 --- a/commentCleaner.py +++ b/commentCleaner.py @@ -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.name} | {comment.score} | {comment.body}\n") try: comment.edit(".") comment.delete() @@ -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.name} | {comment.score} | {comment.body}\n") try: comment.edit(".") comment.delete() @@ -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.name} | {comment.score} | {comment.body}\n") try: comment.edit(".") comment.delete() diff --git a/web/app.py b/web/app.py index 3c0df8e..9f30ca2 100644 --- a/web/app.py +++ b/web/app.py @@ -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.name} | {comment.score} | {comment.body}\n") comment.edit(".") comment.delete() deleted_comments += 1 @@ -146,6 +146,7 @@ def api_delete(): f"{submission.title}, " f"{created_at}, " f"{deleted_at}, " + f"{submission.name}, " f"{submission.score}, " f"{submission.subreddit.display_name}\n" ) diff --git a/weekly_cleanup.py b/weekly_cleanup.py index 3291d7c..9e0d694 100644 --- a/weekly_cleanup.py +++ b/weekly_cleanup.py @@ -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.name} | {comment.score} | {comment.body}\n") try: comment.edit(".") comment.delete() @@ -119,6 +119,7 @@ def main(dry_run: bool = False): f"{submission.title}, " f"{created_at}, " f"{deleted_at}, " + f"{submission.name}, " f"{submission.score}, " f"{submission.subreddit.display_name}\n" )