Coder Social home page Coder Social logo

jogerj / reddit-purge Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 93 KB

Simple python script using praw API to mass delete reddit submissions and/or comments.

License: MIT License

Python 100.00%
python3 praw reddit privacy praw-reddit praw-api reddit-api reddit-bot privacy-tools privacy-protection

reddit-purge's Introduction

Reddit-Purge

Simple python script using praw API to mass delete reddit submissions and/or comments.

Features

  • Supports login without password (OAuth), no need to disable 2FA
  • Multiprocessing
  • Redacts your messages (edit to something else) before deletion to prevent archiving.
  • Requires only praw and Python 3.5+ (runs on Windows/macOS/Linux). This project is intended to use minimum dependencies to offer longevity, better support and compatibility

Installation

  1. git clone https://github.com/jogerj/reddit-purge.git
  2. cd reddit-purge
  3. pip -r install requirements.txt
  4. Configure run.py (see below)

Getting API keys

  1. Goto User Settings > Privacy & Security > App Authorization > 'Create App' (Preview)
  2. Enter any name for your script (default = PurgeBot)
  3. Set type to script
  4. Enter http://localhost:8080 as redirect url. (You can leave the rest blank)
  5. Click Create

Use the script name, 14 chars client ID, and 30 chars key you're shown, enter them in run.py.

image

username = '' # optional
password = '' # optional
user_agent = 'PurgeBot'
client_id = 'CLIENTIDq00zTA'
client_secret = 'SECRETswQ_r0u7ftiKlVojc4SECRET'

If username and/or password are left blank, OAuth will be used to acquire an access token.

If you encounter issues with secret key length (due to updating), delete the app from reddit and grab new API keys. Reddit recently changed secret key length from 27 to 30 chars.

Disclaimer: Configuration above is only an example. You will need to setup your own configuration!

Usage

Run with python3 run.py

Purge options

Options Description
limitation = None Number of recent comments/submissions to delete. Set to None if no limits (purge ALL comments/submissions). Set to 10 will purge recent 10, etc.
purge_comments = True purge_submissions = True Set to False to not purge comments/submissions.
redact_msg = "[redacted]" Edit comments/submissions to this before deletion. This prevents archiving.
redact_only = False Set to True to only edit posts to redact_msg without deleting them.
use_multiprocessing = True Use multiprocessing. Set to False if problems occur
show_comment = True Show comment body
show_title = True Show submission titles
controversial_first = True Start purge from controversial first instead of newest
max_score = None Only purge posts with score <= max_score. Set to None if no threshold
no_prompt = False Set to True to not prompt at all. Use with EXTRA caution!
comment_whitelist = [] submissions_whitelist = [] Whitelist by ID e.g. ['id1', 'id2', 'id3']
debug = False Debug mode

To-Do

  • Add whitelisting Use whitelist.txt
  • Use .cfg file
  • Logging deleted posts

More info

reddit-purge's People

Contributors

jogerj avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

reddit-purge's Issues

run.py not deletings posts

First issue I had, from the installation instructions:

pip -r install requirements.txt

being told no such option: -r , on latest Windows and pip is up to date.

2nd issue, being told Comment blah blah blah skipped (above max score), the max_score = None which according to the purge options should mean everything is to be deleted, but every single comment is being skipped.

Secret length

I just used this script recently.
The secret length is now 30.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.