e-flex / Shreddit

My own maintained fork of x89's Reddit post/comment mass deletion program, which they stopped updating.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shreddit

Original repo and Readme.md here.

FAQ - Common Error(s)

<something> installed but version <something> is required.

Upgrade 'setuptools'

pip install --upgrade setuptools

Command "python setup.py egg_info" failed with error code 1

You are missing a dependency. Try installing using manual instructions below.

Invalid requirement: '<<<<<<< HEAD'
Traceback (most recent call last):
et cetera, et cetera

You are trying to install the original repo's broken code. Clone and install mine with the fixes.

Pre-install conditions:

Make sure you install pip

$ apt install python-pip

Then update pip with

$ pip install --updgrade pip

Pip Installation

$ pip install -U shreddit will install the package and its dependencies, and it will add a shreddit command line utility to your PATH. This is typically either run in a virtualenv or using administrative privileges for global installation.

Manual Installation

  1. Clone the shreddit repository to a directory.
  2. From the directory, run $ pip install -r requirements.txt
  3. Run $ python setup.py install to install the package and the shreddit command line utility. This is typically either run in a virtualenv or using administrative privileges for global installation.

Usage

After installing the shreddit command line utility, the first step is setting up the tool's configuration files. Simply typing shreddit -g will generate configs. After configuring credentials, running the tool with the shreddit command will begin the tool's operation.

Configuring Credentials

Running shreddit -g will generate a blank praw.ini file that looks like this:

# Credentials go here. Fill out default, or provide one or more names and call shreddit with the -u option to specify
# which set to use.
[default]
client_id=
client_secret=
username=
password=

You must provide values for each of these. As strange as it may seem to provide both a username/password pair and a client id/secret pair, that is how the Reddit API does "OAuth" script applications.

Username and password are simply your Reddit login credentials for the account that will be used. However, to obtain the client ID and secret, follow these steps (taken from PRAW documentation):

  1. Open your Reddit application preferences by clicking here.
  2. Add a new application. It doesn't matter what it's named, but calling it "shreddit" makes it easier to remember.
  3. Select "script".
  4. Redirect URL does not matter for script applications, so enter something like http://127.0.0.1:8080
  5. Once created, you should see the name of your application followed by 14 character string. Enter this 14 character string as your client_id.
  6. Copy the 27 character "secret" string into the client_secret field.

Finally, your praw.ini should look like this (with fake data provided here):

[default]
client_id=f3FaKeD4t40PsJ
client_secret=dfK3pfMoReFAkEDaTa123456789
username=testuser
password=123passwordgoeshere123

Keep your praw.ini either in the current directory when running shreddit, or in one of the config folders described here such as ~/.config in Linux or %APPDATA% in Windows.

To use more than one account, you can add multiple profiles instead of just [default] and use the -u option to shreddit to choose which one each time.

Automating

The easiest way to automate this tool after the first run is by using the cron utility. Run crontab -e to edit your user's crontab settings.

Examples:

The following examples require that the PRAW configuration file is located in the config directory. See this PRAW documentation for more information.

  • Run every hour on the hour 0 * * * * shreddit -c <full path to shreddit.yml>

  • Run at 3am every morning 0 3 * * * shreddit -c <full path to shreddit.yml>

  • Run once a month on the 1st of the month 0 0 1 * * shreddit -c <full path to shreddit.yml>

If virtualenv was used, be sure to add source /full/path/to/venv/bin/activate && before the command. For example:

0 * * * * source /full/path/to/venv/bin/activate && shreddit -c <full path to shreddit.yml>

Command Line Options

$ shreddit --help
usage: app.py [-h] [-c CONFIG] [-g] [-u USER]

Command-line frontend to the shreddit library.

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Config file to use instead of the default shreddit.yml
  -g, --generate-configs
                        Write shreddit and praw config files to current
                        directory.
  -u USER, --user USER  User section from praw.ini if not default

For Windows users

  1. Get Linux. No really...

  2. Make sure you have Python installed. Click here for the Python download page. - Note: Install python 3.x, not 2.x.

  3. Follow the pip installation instructions.

  4. Open a new command prompt and verify that the shreddit command works before moving on to the usage section.

About

My own maintained fork of x89's Reddit post/comment mass deletion program, which they stopped updating.

License:Other


Languages

Language:Python 100.0%