Skip to content
Reddit takeout: export your account data as JSON: comments, submissions, upvotes etc. πŸ¦–
Python
Branch: master
Clone or download
Latest commit 13c0e70 Sep 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore initial Sep 4, 2018
LICENSE Update LICENSE Sep 4, 2019
README.md Update README.md Sep 16, 2019
output.json Add example output Sep 6, 2019
rexport.py Add inbox messages Sep 6, 2019

README.md

Script to export your Reddit data as json: saves, upvotes, submissions etc.

Setting up

  1. pip3 install praw -- used to benefit from pagination and rate limiting.
  2. In order to use Reddit API, you need to register a custom 'personal script' app and get client_id and client_secret parameters. See more here.
  3. In order to access user's personal data (e.g. saved posts/comments), reddit API also requires username and password parameters. (yes, your Reddit password).
  4. It might be convenient to dump these in a file like reddit_secrets.py, e.g.
client_id = ...
clien_secret = ...
username = ...
password = ...

Using

Recommended: rexport.py --secrets /path/to/reddit_secrets.py. That way you have to type less and have control over where you're keeping your plaintext reddit password.

Alternatively, you can pass auth arguments directly, e.g. rexport.py --username <user> --password <password> --client_id <client_id> --client_secret <client_secret>. However, this is prone to leaking your password in shell history.

You can also import script and call get_json function directory to get raw json.

Limitations

WARNING: reddit API limits your queries to 1000 entries. It's highly recommended to back up regularly and keep old versions. Easy way to achieve it is command like this: ./rexport.py --secrets secrets.py >reddit-$(date -I).json.

See more:

Example output

See ./output.json, it's got some example data you might find in your data export. I've cleaned it up a bit as it's got lots of different fields many of which are probably not relevant.

However, this is pretty API dependent and changes all the time, so better check with Reddit API if you are looking to something specific.

You can’t perform that action at this time.