2.5 KiB
2.5 KiB
Reddit CLI
A command-line interface for browsing Reddit posts with search capabilities, interactive post viewing, and AI-powered summarization.
Features
- Search Functionality: Search for Reddit posts by keyword/terms
- Results Display: Table view showing:
- Post number
- Subreddit name
- Post creation date
- Post title (main column)
- Post Navigation: Click on post number to view full post details
- Comments Viewer: Cycle through comments using 'c' key
- AI Integration: Get AI-generated summaries using Ollama API
- Pagination: Navigate between pages of results ('n' key)
Project Structure
reddit-cli/
├── src/
│ ├── __init__.py
│ ├── main.py # Main application entrypoint
│ ├── reddit_client.py # Reddit API client implementation
│ └── ai_client.py # Ollama AI integration
├── tests/
│ └── test_cli.py # Unit tests
├── setup.sh # Setup script for environment
├── run.sh # Run script to execute the application
├── requirements.txt # Project dependencies
└── README.md # This file
Installation
- Clone this repository:
git clone <repository-url>
cd reddit-cli
- Create and activate virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
Usage
Run the CLI interface with a search query:
python -m src.main "python programming"
Or run without arguments to enter interactive mode:
python -m src.main
Keyboard Controls
n- Go to next page of resultsc- Cycle through comments when viewing a posts- Get AI-generated summary for current postqor Ctrl+C - Quit the application- Number keys - Select specific post by number
Configuration
The application uses environment variables for configuration:
OLLAMA_BASE_URL- Ollama server address (default: http://192.168.8.223:11434)OLLAMA_MODEL- AI model to use (default: gpt-oss:20b)
Requirements
- Python 3.7+
- requests
- rich
- pyyaml
- pytest
- pytest-cov
Testing
Run tests with:
python -m pytest tests/
Or run basic functionality checks:
python test_cli.py
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
This project is licensed under the MIT License.