Bulk download Reddit posts and upload to a Google Drive folder. This program uses PyDrive and praw
pip install -r requirements.txt
The new and improved version only needs ~10 MB of free space! 🎉
Open parent.txt
and modify it to your preferences. Here's the format:
Parent_ID
Drive folder ID of where the files should be put. This is the ID of a folder:
If you want it in your My Drive
, put root
here.
Here's an example of a good parent.txt
file:
1-1xxSMUmeZdoKwst052yTzMgcDcT-ZGC
Now, go to the Google Developer Console and create a new project.
Name it whatever you want then click Create.
Now, click on "Enable APIs and Services"
Search for Google Drive and enable Google Drive API
After you get redirected to this screen, click on "Create Credentials"
Choose these settings:
then click next.
Here, you can name your app whatever you want and enter your email in the 2 fields. Also pick an icon.
I'm using a throwaway email so there's no need to try to email me.
When it asks you for scopes, just ignore it and click continue.
In OAuth Client ID, pick these settings:
When you see this, click done.
Now, download the JSON. It will be named something really long. Just change that to client_secrets.json
and move it to H:\
Go to "OAuth consent screen" and add yourself as a test user.
Now, go to settings.yaml
and change the client_id to your client id and the client_secret to your client secret (both are in client_secrets.json
)
Which sub to get posts from. Do not include the r/
, only include the name. For instance, pics
If left unspecified, it will get posts from all the subreddits you are in.
How many posts to get. Cannot be over 1000 due to api limitations.
If you don't want to delete the images after uploading them, pass -k
to the main file.
Wait for it to finish downloading. Once it finishes, it will prompt you to log in. Just select the account where you want the files to be uploaded and allow access. Then, it will upload.
Here's an example of a valid command to download 100 trending memes:
python3 main.py -s memes -n 100
Used to authorize the upload of the files into your Google Drive using the Google Drive API
Contains your settings for what you want downloaded and uploaded
Main code that will download the files, store them in a temporary folder and upload them to Google Drive
Settings containing your client secret and id, also used to authorize the upload of files into your Google Drive
Stores credentials from previous run so you don't have to re-authenticate each time you want to download and upload
Contains your reddit API information in order to make requests
Libraries needed.