• Stars
    star
    109
  • Rank 319,077 (Top 7 %)
  • Language
    Python
  • Created almost 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Python tool for backing up your saved and upvoted posts on reddit to your computer.

reddit-save

A Python utility for backing up your reddit upvoted/saved stuff.

Browsing through the stuff you've liked or saved on reddit is really enjoyable and, depending on the reason you saved something, can be a great way to recap stuff you once thought important. It is a personalised feed of posts and comments by the one person guaranteed to know what you like - past you.

However over time more and more of the older posts will be deleted or missing, and the historical record atrophies. Use this tool to back up those posts and comments to your computer where you can browse them offline, and where they are safe forever.

reddit-save will backup saved posts, saved comments, and upvoted posts. It can't do upvoted comments because the reddit API doesn't expose them. Crucially, when it is run again on the same location it will ignore any posts/comments previously archived - once something is saved, it's saved permanently.

Installation

$ git clone https://github.com/samirelanduk/reddit-save .
$ cd reddit-save
$ pip install -r requirements.txt

If you get permission errors, try using sudo or using a virtual environment.

You will need ffmpeg installed somewhere too.

Rename the file logindata.py.example to logindata.py. You will need to add four things to this file, your reddit username and password, and a reddit client ID and secret. The latter two are obtained using the instructions here. The file should look something like this:

REDDIT_USERNAME = "spez"
REDDIT_PASSWORD = "myredditpassword123"
REDDIT_CLIENT_ID = "sadsU7-zfX"
REDDIT_SECRET = "687DDJSS&999d-hdkjK8h"

(If you have 2FA enabled, you will need to append that to the password, separated by a colon.)

Use

Create a folder that will contain your archive. Then run:

$ ./save.py saved folder_name
$ ./save.py upvoted folder_name

The first command will backup your saved posts/comments to a file called folder_name/saved.html. The second will backup your upvoted posts to a file called folder_name/upvoted.html.

Each post will have its top-level comments saved, as well as each of their immediate child comments (but no further).

Linked media files (images, videos etc.) will be saved locally where possible, though imgur is currently not well supported in all cases.

If you want to also break the resultant HTML file into multiple files (as browsers struggle to display enormous HTML files) you can add the --page-size 100 argument (replacing 100 with whatever the posts-per page you want is).

Use with Docker

Rather than installing dependencies locally, you can use docker to create a local image and use that instead. First build the image:

$ docker build -t redditsave .

Then run reddit-save within a container created from this image:

$ docker run \
-e REDDIT_USERNAME=spez \
-e REDDIT_PASSWORD="myredditpassword123" \
-e REDDIT_CLIENT_ID="sadsU7-zfX" \
-e REDDIT_SECRET="687DDJSS&999d-hdkjK8h" \
-v /Local/location/to/save/in:/opt/app/archive \
redditsave saved

Backing up a specific username

Rather than backing up your own saved/upvoted posts and comments, you can back up the submitted posts and comments of another user:

./save.py user:samirelanduk folder_name

Backing up a specific username

Rather than backing up your own saved/upvoted posts and comments, you can back up the submitted posts and comments of another user:

./save.py user:samirelanduk folder_name

More Repositories

1

atomium

Python macromolecular parsing (with .pdb/.cif/.mmtf parsing and production)
Python
101
star
2

tiktok-save

A Python tool for backing up your liked and bookmarked videos on tiktok to your computer.
Python
47
star
3

samireland.com

My personal/portfolio website
SCSS
20
star
4

molstar-react

Molstar as a react component
JavaScript
18
star
5

election19

Analytics of the 2019 UK general election
JavaScript
14
star
6

ZincBindDB

The database and API backend for ZincBind - the database of zinc binding sites
Python
14
star
7

pygtop

A Python wrapper for the IUPHAR/BPS Guide to PHARMACOLOGY API
Python
8
star
8

Pulse

The source code for the 2019 UCL MedTech Hackathon website (from the eventoz template)
HTML
7
star
9

django-random-id-model

A model base class which creates long, random, integer primary keys.
Python
6
star
10

pdb2json

A lightweight web app for converting molecular structures to JSON over the web.
Python
4
star
11

hoi4.py

hoi4.py is a Python library for parsing HOI4 save files (whether binary or plain text) and for plotting useful information from them.
Python
3
star
12

ZincBindPredict

Predictive models of zinc binding
Python
2
star
13

django-candlestick

Price data in Django
Python
2
star
14

server-scripts

A collection of bash scripts I wrote to make setting up sites on an nginx server easy
Shell
1
star
15

exscientia-code-challenge

JavaScript
1
star
16

kirjava

A lightweight Python GraphQL client.
Python
1
star
17

mirrortime

Does something feel a long time away/ago? See for yourself...
JavaScript
1
star
18

ZincBindWeb

The web interface for ZincBind
JavaScript
1
star
19

TimelineReview

A template for creating a visual literature review
Python
1
star
20

geometrica

A pure-Python geometry library
Python
1
star
21

goodplots

A matplotlib wrapper
Python
1
star
22

pychats

Python project for messages extraction and analytics
Python
1
star
23

django-track

A django app for analytics
Python
1
star
24

omnicanvas

A Python 'generic canvas' which can paint itself to SVG etc.
Python
1
star
25

CDtool

A web app for processing circular dichroism data
Python
1
star
26

pdbsearch

A library for searching for PDB codes by consuming the RCSB web services.
Python
1
star
27

fuzz

A lightweight Python utility providing values with associated uncertainty
Python
1
star