Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ni5arga/dailydigestbot
Reddit Daily Digest Bot is a Python-based bot that automates the compilation of top posts from specified subreddits into a daily digest. Users can customize sorting methods, time ranges, and the target subreddit for automated posting. The bot simplifies the process of staying updated on favorite subreddits by delivering a formatted summary.
https://github.com/ni5arga/dailydigestbot
hacktoberfest hacktoberfest-accepted praw praw-api praw-reddit reddit reddit-api reddit-bot reddit-bots subreddit subreddits
Last synced: about 24 hours ago
JSON representation
Reddit Daily Digest Bot is a Python-based bot that automates the compilation of top posts from specified subreddits into a daily digest. Users can customize sorting methods, time ranges, and the target subreddit for automated posting. The bot simplifies the process of staying updated on favorite subreddits by delivering a formatted summary.
- Host: GitHub
- URL: https://github.com/ni5arga/dailydigestbot
- Owner: ni5arga
- License: mit
- Created: 2023-10-04T10:44:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-22T16:15:16.000Z (8 days ago)
- Last Synced: 2025-01-22T17:25:34.917Z (8 days ago)
- Topics: hacktoberfest, hacktoberfest-accepted, praw, praw-api, praw-reddit, reddit, reddit-api, reddit-bot, reddit-bots, subreddit, subreddits
- Language: Python
- Homepage:
- Size: 39.1 KB
- Stars: 25
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Reddit Daily Digest Bot
**Reddit Daily Digest Bot** is a Python bot designed to simplify the process of aggregating and sharing top posts from your favorite subreddits. It fetches the most popular posts from specified subreddits, compiles them into a neatly formatted daily digest, and automatically posts the digest to a target subreddit of your choice. Also works for hot, controversial, rising & new posts. You can also specify your own time range for the posts the bot will fetch.
## Key Features
- Can create daily digest of most popular posts from multiple subreddits.
- Fetch top, hot, controversial, rising, new posts from multiple subreddits in the time frame you want.
- Compile the fetched posts into a digest with post titles, links and author.
- Post the digest to a designated subreddit with ease.## Getting Started
### Prerequisites
You'll need to have the following installed on your system:
- Python 3.x
### Installation
1. Clone this repository to your local machine:
```bash
git clone https://github.com/ni5arga/DailyDigestBot.git
```
2. Change the project directory```bash
cd reddit-dailydigest-bot
```3. Install Dependencies
```bash
pip install -r requirements.txt
```### Configuration
### Reddit API CredentialsOpen the `config.py` file and replace the placeholders with your Reddit API credentials:
```python
CLIENT_ID = 'your_client_id'
CLIENT_SECRET = 'your_client_secret'
USER_AGENT = 'your_user_agent'
REDDIT_USERNAME = 'your_reddit_username'
REDDIT_PASSWORD = 'your_reddit_password'
```### Subreddits
Modify the `SUBREDDITS` variable in `config.py` to specify the subreddits from which you want to fetch posts. Don't include r/ before the name of the subreddit.```python
SUBREDDITS = ['science', 'technology', 'maths', 'physics']
```### Target Subreddit
Replace the `TARGET_SUBREDDIT` variable with the subreddit name where you want the bot to post the content:```python
TARGET_SUBREDDIT = 'your_target_subreddit_name'
```
### Time Range
Update the `TIME_RANGE` to the time range you need for the `controversial.py` and `top.py` script
```python
TIME_RANGE = 'day'
```
- `'day'`: Fetch top posts from the last 24 hours.
- `'week'`: Fetch top posts from the last 7 days.
- `'month'`: Fetch top posts from the last 30 days.
- `'year'`: Fetch top posts from the last 365 days.
- `'all'`: Fetch top posts from all time.### Usage
After configuring it properly simply run the bot script :#### Daily Digest Script
```bash
py main.py
```
The bot will fetch that day's top posts from the specified subreddits, compile them into a daily digest, and post it to the target subreddit.#### Additional Sorting Scripts
- **Fetch Top Posts (top.py)**
```bash
python top.py
```
Fetches and compiles the top posts from the specified subreddits based in the user specified `TIME_RANGE`.- **Fetch Rising Posts (rising.py)**
```bash
python rising.py
```
Fetches and compiles the rising posts from the specified subreddits based on the daily sorting method.- **Fetch New Posts (new.py)**
```bash
python new.py
```
Fetches and compiles the new posts from the specified subreddits based on the daily sorting method.- **Fetch Controversial Posts (controversial.py)**
```bash
python controversial.py
```
Fetches and compiles the controversial posts from the specified subreddits based on the user specified `TIME_RANGE`.- **Fetch Hot Posts (hot.py)**
```bash
python hot.py
```
Fetches and compiles the top hot posts from the specified subreddits based on the daily sorting method.### Auto-running the script for the daily digest
To make your Reddit Daily Digest Bot run automatically every 24 hours, you can use a scheduler like `cron` (on Unix-like systems) or Task Scheduler (on Windows). Here's how you can set up the automatic scheduling :
**Automate Script Execution Every 24 Hours**
1. **Linux/macOS (Using `cron`)**:
- Open your terminal.
- Open your crontab file for editing by running:```bash
crontab -e
```- Add the following line to schedule your script to run every 24 hours:
```bash
0 0 * * * /usr/bin/python3 /path/to/your/reddit-dailydigest-bot/main.py
```- Save the file and exit.
2. **Windows (Using Task Scheduler)**:
- Open the "Task Scheduler" application.
- In the right-hand pane, click on "Create Basic Task...".
- Follow the wizard to create a basic task, specifying the task name and description.
- Choose "Daily" and set the recurrence to "1 days".
- Specify the start date and time.
- Choose "Start a program" and browse to the location of your Python executable (e.g., `C:\Python39\python.exe`).
- In the "Add arguments" field, provide the full path to your `main.py` script (e.g., `C:\path\to\your\reddit-dailydigest-bot\main.py`).
- Complete the wizard, review your settings, and click "Finish" to create the scheduled task.**Ensure Proper Environment Setup**
Make sure that your Python environment and working directory are properly set within your script to avoid any issues when it runs as a scheduled task.
**Testing and Troubleshooting**
Before scheduling the script to run automatically, test it manually to ensure it works as expected. Check the logs or output to identify and fix any issues.
### Contributing
Contributions are welcome! If you'd like to contribute to this project, please open an issue or submit a pull request.
### License
This project is licensed under the MIT License - see the [LICENSE](/License) file for details.