Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This script only removes comments visible on your profile page! #55

Open
jimmydg opened this issue Feb 8, 2024 · 2 comments
Open

This script only removes comments visible on your profile page! #55

jimmydg opened this issue Feb 8, 2024 · 2 comments

Comments

@jimmydg
Copy link

jimmydg commented Feb 8, 2024

Not really an issue but more a PSA. This script only removes comments visible on your profile page. And does that incredibly well. However, for people with lots of comments this isn't enough. I could still find old comments on Google which had my username/comment intact. The profile page only shows the most recent 1k comments. To quote a reddit support mail:

Please note that Reddit saves the most recent 1,000 comments on your profile. Once you hit that limit, the oldest content will drop off to make room for the newest content. When content has dropped off, we are unable to retrieve it. So it is possible for you to have comments on Reddit that are not visible on your profile.

This isn't a huge problem. We can submit a data request from Reddit containing every comment you ever placed:

  1. Go to: https://www.reddit.com/settings/data-request
  2. Select "CCPA/CPRA"
  3. Select "full time"

In the archive there's a comment.csv file containing all your comments. Here's an incredibly stupidly short python script which just iterates over them and deletes them. You need a reddit api key for this to work (https://github.com/reddit-archive/reddit/wiki/OAuth2-Quick-Start-Example#first-steps)

import praw
import pandas as pd

df = pd.read_csv('comments.csv')
reddit = praw.Reddit(
    client_id="",
    client_secret="",
    password="",
    user_agent="",
    username="",
)
for commentId in df['id']:
    comment = reddit.comment(commentId)
    comment.delete()
    print("deleted comment ", commentId)

Comments are still visible on archive.org. I don't believe it's possible to remove them from there.

@jimmydg jimmydg changed the title Only removes comments visible on your profile page This script only removes comments visible on your profile page! Feb 8, 2024
@confluence
Copy link

@jimmydg Thanks for the links, and for this snippet! I used it as a starting point for this script to overwrite comments instead of deleting them. I also set the maximum possible timeout limit, set an additional property to silence a deprecation warning, added exception handling (if you try to edit a comment which is in a deleted thread you get a 403), and added a check to avoid reprocessing comments (in case the script is interrupted and has to be restarted).

@mbirth
Copy link

mbirth commented Mar 19, 2024

I've expanded upon the script from @confluence and ended up with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants