https://github.com/schbrongx/reddit-image-loader
A Python 3 class and script to download images from subreddits.
https://github.com/schbrongx/reddit-image-loader
Last synced: 3 months ago
JSON representation
A Python 3 class and script to download images from subreddits.
- Host: GitHub
- URL: https://github.com/schbrongx/reddit-image-loader
- Owner: schbrongx
- Created: 2019-06-20T10:59:06.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T05:47:53.000Z (over 2 years ago)
- Last Synced: 2024-12-30T00:13:07.239Z (5 months ago)
- Language: Python
- Size: 10.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# reddit-image-loader
A Python 3 class and script to download images from subreddits.# Table of contents
1. [Usage as a script](#usage_script)
2. [Usage as a class](#usage_class)
3. [Installation](#installation)
1. [Prerequesites](#prerequesites)
2. [Setup](#setup)## Usage as a script
Usage: `ril.py [-h] [-l LIMIT] [-d] [-N | -T | -H | -R] SUBREDDIT TARGETFOLDER`Positional arguments:
* SUBREDDIT An existing subreddid name. I.e.: earthporn
* TARGETFOLDER Folder where the images and our trackingfile should be
stored.Optional arguments:
* -h, --help: show this help message and exit
* -l LIMIT, --limit LIMIT: limit the number of images to download and keep in TARGETFOLDER
* -d, --daemonize: run in background
* -N, --new: Load newest posts.
* -T, --top: Load top posts.
* -H, --hot: Load hot posts.
* -R, --random: Load random posts.Example:
`ril.py -l 5 -T earthporn ./images`
This will:
* Load a list of 5 images in landscape-orientation
* Remove all images, which are not in our list, from ./images/
* Download all images from our list, which are not already in ./images and
* Resize them to 1920xNNNN, preserving the ascpet-ration## Usage as a class
```python
import ril
my_ril = RedditImageLoader(subreddit="earthporn", targetfolder="./images" limit=25 flair=new orientation=landscape"
my_ril.load_image_urls()
my_ril.download_images()
```
This will:
* Load a list of 25 (limit) images in landscape-orientation
* Download images from the list which are not already downloaded and resize them to 1920xNNNN (preserving the
aspect-ratio)## Installation
### Prerequesites
Python 3 has to be installed.
### Setup
* Clone Repository: `git clone https://github.com/schbrongx/reddit-image-loader.git`
* Change into git repository: `cd reddit-image-loader`
* Create a virtual environment: `python3 -m venv env`
* Activate the virtual environment: `. ./env/bin/activate`
* Install requirements: `pip install -r requirements.txt`
* Test script: `src/ril.py --help`