Package: redditsweeper
Reddit SweeperThis tool is designed to be an easy-to-use utility to clear out old reddit
comments. It aims for simplicity in terms of use as well as configuration. It
currently supports the following features:Delete comments and/or submissionsExclude one or more subreddits when search for content to deleteInclude only a subset of subreddits when searching for content to deleteOnly delete comments over a given number of days oldSave a record of deleted content in an easy to parse JSON fileIt supports Python 2.7, 3.6, 3.7, and PyPy and usespoetryfor dependency management.InstallationPipThe easiest way to install redditsweeper is via Pip, using the following
command:pip install -U redditsweeperPoetryTo install redditsweeper from Github, clone it to your local filesystem, and
then from the redditsweeper directory, use:poetry installUsageOnce installed, a CLI tool calledredditsweepershould available to use. It
may be configured either via command line arguments, a config file, or
environment variables of the form REDDITSWEEPER_.Configuring Reddit credentialsFirst, it is necessary to obtain script credentials from reddit. You can set
this up easilyhereby doing the
following:Click "create another app..."Enter a name of "redditsweeper"Choose the "script" optionLeave description blank.Just put "http://127.0.0.1" in each URL field (this are just dummy values
and are not used)Click "create app"Get the client ID by looking at the line underneath "personal use script"Get the client secret next to the word "secret"Create a copy ofpraw.ini.samplecalled "praw.ini" and set
up the values for client ID and secret that you just obtained, as well as
entering your username and password.If your account has multi-factor authentication enabled, you will need to
supply redditsweeper with a MFA code each time you run it with the "--mfa"
parameter in addition to the username and password you set up here.Configuring redditsweeperIf you want to store the settings used, make a copy ofredditsweeper.cfg.samplecalled "redditsweeper.cfg"
and fill in the options you need. A brief overview of options is as follows:dry- This isTrueorFalse. IfTrue, redditsweeper will operate in
dry run mode. It will show you what it would do with each comment or
submission, but it will not delete anything.exclude- This is a list of subreddits (in the form r/subreddit name)
that should be excluded from deletion. Anything found belonging to one of
these subreddits will be skipped.include- If you want to provide an explicit list of subreddits to target
for deletion, provide it here. If nothing is provided, redditsweeper simply
considers everything for deletion. Note that if the comment or submission is
either in an excluded subreddit or is too new and the--keepoption was
set, it will be skipped regardless of whether it's in the include list.keep- This is a number of days worth of comments or submissions to keep.
Anything newer will be kept no matter what, and anything older will be
considered for deletion.savefile- If set, a JSON file will be created at the given filename, and
it will be updated with the contents of comments and submissions deleted.
Any existing savefile will be overwritten.type- The type of reddit content to delete. It can be "comment",
"submission", or "both".user- This controls which section of praw.ini will be used. If you have
multiple user accounts and want to switch between deleting content from one
account to the other, just overwrite this setting.Testingredditsweeper uses pytest to run tests, withresponsesused to stub fake responses
from reddit, so no credentials are required for testing. Run the set of tests
using the following command:poetry run py.test --cov=redditsweeper tests/It currently supports Python 2.7, 3.6, 3.7, and PyPy, and multi-version tests
can be run using:poetry run tox