For this you need
- A Reddit account to create an API
- Reddit Image Grabber
- A PC with Python installed
Create Reddit API
First, visit this link and log in to your Reddit account. After logging in, click “Create a Reddit app” that takes you to a new page where you can create an app and get an API token.
To do this, type a name for the app and select the “script” option. Then add a redirect URI for the app. You can add any web address here. After you have added the information, create the app to get the API token.
When you create the app, you can create a page similar to the one in the attached screenshot. This page contains the API ID / client ID and the secret token/client token of the API. Copy the client ID and client secret from this page.
Once you have the API token, download it Reddit Image Grabber. This is a Python script that you must edit to enter API info and subreddit from where you want to download the image.
Open the script file in a compatible editor and enter the following information:
- customer identification
- user name
Below these fields, you will get a SUBREDDIT module where you can add the name of the subreddit from where you want to download the image. By default it is set to subreddit “memes”, you can replace it with any subreddit you want. In addition to the name of the subreddit, you can set the type of message from which you want to download images. And you can also set an image limit for download.
For example, if you want to download 10 images of “hot” messages from “pewdiepiesubmissions”, replace the items as follows:
SUBREDDIT = REDDIT.subreddit('pewdiepiesubmissions').hot(limit=10)
Save the script file and open the command prompt on your PC with Python installed. Then drag the script file to the command prompt window and press Enter to execute the script. This would trigger the download process. By default, the images are stored in the same folder as the script, but you can change that in the script if you wish. Also, keep the destination folder empty to prevent overwriting.
Use this script
praw the library that you can install by entering the following command at the command prompt:
pip3 install praw
pip is also not installed on your PC, you can find a simple manual for that here.