SnooArchive is a command-line Reddit submission and comment archiver that saves each item as a Markdown file in a folder.
This script only saves text posts. It does not save offsite links or links to image galleries.
Note: This is alpha software, and my first ever NodeJS project. There's always a chance you could encounter world-ending bugs. Use at your own risk.
I created this because I have a few Reddit accounts with posts that I wanted to keep in an archive. Most of the scripts that I found would save these in a big HTML file. What I wanted instead were Markdown documents that I could easily import into one of my Markdown apps like iAWriter or Ulysses, or convert to a variety of other formats with Pandoc.
Fortunately, this was made even easier since Reddit includes both the Markdown version and the HTML version of the post in their JSON response file.
Reddit itself has API limitation that does not allow more than 1000 items in a response, so you may not get your whole history.
This script was developed for NodeJS version 6 (LTS) or above.
- Clone this repository
- On your computer, run
npm install
using the command line inside the repository folder - Create a Reddit API key and setup the
.env
file (see below)
- Log into your Reddit account
- Navigate to https://ssl.reddit.com/prefs/apps/
- Scroll to the bottom and click "create an app.."
- In the form, name it "SnooArchive"
- Select "script" as the application type
- You can safely ignore 'description' and 'about url'
- 'Redirect url' is required, but it can be anything—I used my Reddit profile URL
- Click "create app"
Note the string of characters below the app name. This is your CLIENT_ID
.
Note the string of characters beside the word "secret". This is your CLIENT_SECRET
.
- In a text editor, open the
env.example
file - As noted above, copy and paste in the value for
CLIENT_ID
- Copy and paste in the value for
CLIENT_SECRET
- Insert your Reddit username and password
- Save the file as
.env
in the same directory
The script's default action is to collect all of your submissions (to the Reddit limit of 1000) and save them in a folder called ./submissions
with a unique set of numbers.
node snooarchive.js
To download comments, use the -c
or --comments
flag. Comments will download into a directory called ./comments
followed by a unique set of numbers.
node snooarchive.js -c
To download saved items, use the -s
or --saved
flag. Saved items will download into a directory called ./saved
followed by a unique set of numbers.
node snooarchive.js -s
Especially with comments, sometimes the content isn't very valuable. To filter by upvotes, add use the -u
or --upvotes
flag followed by a number. This will add a -n
between the folder name and unique set of numbers, where 'n' is the minimum upvotes specified.
Submissions
node snooarchive.js -u 10
Comments
node snooarchive.js -c -u 10
Saved
node snooarchive.js -s -u 10
Let me know if you'd like to see a feature in the "issues" section of this repo. I'm also happy to take a look at pull requests if anyone is inspired to contribute.
SnooArchive would not be possible without the brilliant work of the devs who created snoowrap, the JavaScript Reddit API wrapper.
I'm releasing this under the ISC License which is fully MIT/BSD/GPL compatible with even fewer words.