Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

lonk-dl

lonk-dl is a command line utility to download all new images from a subreddit or redditor.

Read below for installation instructions, and optional arguments for downloading from subreddits, specific redditor's submissions, your saved submissions, etc.

Installing

  1. Download the lonk_dl.py script.
  2. Install PRAW. One way to do this is python -m pip install praw. This should also automatically install the requests package which is required. For more details, see https://praw.readthedocs.io/en/latest/getting_started/installation.html
  3. Register the script on https://old.reddit.com/prefs/apps/. Set the app type to 'script'. 'Name' and 'description' can be anything you want. About url can be blank. Redirect url should be http://localhost:8080
  4. Fill out praw.ini after running python lonk_dl.py -i which creates an empty praw configuration file. The required values are supplied within https://old.reddit.com/prefs/apps. The client_id is the 14-character string listed just under “personal use script”. The client_secret is the 27-character string listed adjacent to secret.

An empty praw.ini configuration file generated by python lonk_dl.py -i

[DEFAULT]
client_id=
client_secret=
user_agent=

#complete below section if extraction fails due to authorization error
username=
password=

An example of completed praw.ini file:

[DEFAULT]
client_id=ab24aai210sj
client_secret=10aai2aai21sjab24b24a0sjd24
user_agent=image grab script by rolyli

#complete below section if extraction fails due to authorization error
username=
password=

Usage guide

Minimum argument needed for the extraction to work succesfully is only the subreddit name or Reddit username (--redditor flag needed).

lonk-dl is designed as a daily image grab script because the script terminates when it comes across a duplicate filename that already exists in the directory (this behavior can be overided with the --force option). The default download limit is 1000 new submissions.

python lonk_dl.py [OPTIONS] subreddit

Example usage cases:

  • Up to 1000 new submissions from /r/cozyplaces: python lonk_dl.py cozyplaces
  • New submissions from a redditor: python lonk_dl.py exampleredditusername --redditor
  • Up to 100 new submissions from /r/cozyplaces: python lonk_dl.py cozyplaces --limit 100
  • Top 2000 submissions from /r/cozyplaces: python lonk_dl.py cozyplaces --sort top --limit 2000
  • To download from your saved submissions where your username is 'myredditusername': python lonk_dl.py myredditusername --redditor --sort saved Warning: this requires you to specify your username and password in plaintext on praw.ini. Proceed at your own discretion.

Options

  -h, --help            show this help message and exit
  --force, -f           Overwrite existing files and continue extraction
                        (default: False)
  -i                    Create praw.ini (default: False)
  --limit LIMIT, -l LIMIT
                        Set the limit for maximum number of posts that will be
                        requested (default: 1000)
  --no-nsfw             Do not download images that are marked nsfw (default:
                        False)
  --path PATH, -p PATH  Specify the download directory path (default: None)
  --sort SORT, -s SORT  Set frontpage sort type. For example: 'hot',
                        'controversial' (default: new)
  --redditor, -r        Extract from redditor instead of subreddit. (default:
                        False)

Acknowledgements

Thank you youtube-dl for inspiration.

About

Reddit daily image downloader - auto download new images from a subreddit or redditor

Resources

License

Releases

No releases published

Packages

No packages published

Languages