jingw222 / redditdailybot

Get top n hot Reddit posts daily from chosen subreddits, and push them via emails.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A Reddit daily digest bot

This script fetches top n submissions per subreddit, and sends them via emails if a submission's score or number of comments exceeds a certain threshold.

demo

Usage

  1. Clone the repository

  2. Go to Reddit and create a developper application for script use.

  3. Create a praw.ini file in the repository folder following the doc

  4. Run reddit_bot.py with your config options, like below

    $ python3 reddit_bot.py --reddit_config bot1 --subreddits machinelearning datascience python --from_address fromemail@example.com --from_address_pass password --to_address toemail1@example.com toemail2@example.com
    

    Command line arguments

    optional arguments:
    -h, --help            show this help message and exit
    --reddit_config CONFIG
                            specify config section for Reddit config file, e.g. praw.ini
    --subreddits [STRING [STRING ...]]
                            A list of subreddits
    --limit INT           maximum num of posts per subreddit
    --score INT           minimun score on a particular submission
    --num_comments INT    minimun num of comments on a particular submission
    --from_address EMAIL  email addr from which to send contents
    --from_address_pass EMAIL_PASS
                            password for email addr from which to send contents
    --to_address [EMAIL [EMAIL ...]]
                            email addr to which to send contents
    
  5. Additionally, you can create a run.sh script based off the code in step 4, and setup a cron job for automation tasks. For example, to run it daily at 4 p.m., we can put this in our crontab file:

    0 16 * * * cd /home/jameswong/projects/redditbot/ && /bin/bash run.sh
    

License

MIT

About

Get top n hot Reddit posts daily from chosen subreddits, and push them via emails.

License:MIT License


Languages

Language:Python 100.0%