A powerful AI-driven tool to customize your YouTube feed based on your content preferences using browser automation
Project description
FeedForge 🎯
A powerful tool to customize your YouTube feed based on your content preferences. FeedForge uses AI to understand your interests, searches for relevant videos, and automatically interacts with them to train YouTube's recommendation algorithm.
🌟 Features
- AI-Powered Content Discovery: Uses OpenAI's GPT-4 to generate relevant search keywords from your content preferences
- YouTube API Integration: Searches for high-quality videos matching your interests
- Automated Browser Interaction: Uses browser automation to play videos and train YouTube's algorithm
- Customizable Playback: Control how long each video plays during the training process
- Cross-Platform Support: Works on Windows, macOS, and Linux
🔧 Prerequisites
Before running FeedForge, ensure you have:
- Python 3.9 or higher (3.11+ recommended)
- Google Chrome or Firefox browser installed
- OpenAI API Key - Get one from OpenAI Platform
- YouTube Data API Key - Get one from Google Cloud Console
📦 Installation
Important Note for macOS/Linux Users
Modern Python installations (Python 3.11+ on macOS with Homebrew, Ubuntu 23.04+, Fedora 38+, etc.) use PEP 668 which prevents installing packages directly into the system Python. You have several options:
Option 1: Using pipx (Recommended for End Users)
pipx automatically manages a virtual environment for command-line tools:
# Install pipx first (if not already installed)
# On macOS with Homebrew:
brew install pipx
pipx ensurepath
# On Ubuntu/Debian:
sudo apt install pipx
pipx ensurepath
# On other systems:
python3 -m pip install --user pipx
python3 -m pipx ensurepath
# Then install feedforge
pipx install feedforge
Option 2: Using a Virtual Environment
# Create a virtual environment
python3 -m venv feedforge-env
# Activate it
# On macOS/Linux:
source feedforge-env/bin/activate
# On Windows:
feedforge-env\Scripts\activate
# Install feedforge
pip install feedforge
# Use feedforge (make sure the virtual environment is activated)
feedforge "your interests here"
Option 3: User Installation (Not Recommended)
# Install to user directory only
pip install --user feedforge
# Make sure ~/.local/bin is in your PATH
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc # or ~/.zshrc
source ~/.bashrc # or source ~/.zshrc
Option 4: System-wide with Override (Use with Caution)
# Only use this if you understand the risks
pip install --break-system-packages feedforge
Development Installation
If you want to contribute or install from source:
1. Clone the Repository
git clone https://github.com/RishabhKodes/feedforge.git
cd feedforge
2. Create Virtual Environment
python3.9 -m venv venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
3. Install in Development Mode
pip install -e .
This will automatically install all required dependencies:
- langchain-openai (>=0.0.5)
- google-api-python-client (>=2.0.0)
- selenium (>=4.0.0)
- click (>=8.0.0)
- python-dotenv (>=1.0.0)
- geckodriver-autoinstaller (>=0.1.0)
- chromedriver-autoinstaller (>=0.6.0)
- openai (>=1.0.0)
⚙️ Configuration
Feedforge supports multiple ways to provide your API keys:
Method 1: Environment Variables (Recommended)
export OPENAI_API_KEY="your_openai_api_key_here"
export YOUTUBE_API_KEY="your_youtube_api_key_here"
Method 2: .env File
Create a .env file in your current directory:
OPENAI_API_KEY=your_openai_api_key_here
YOUTUBE_API_KEY=your_youtube_api_key_here
Method 3: Command Line Options
feedforge "your interests" --openai-key "your_key" --youtube-key "your_key"
Method 4: Home Directory Config
Create a .feedforge.env file in your home directory:
echo "OPENAI_API_KEY=your_key" > ~/.feedforge.env
echo "YOUTUBE_API_KEY=your_key" >> ~/.feedforge.env
Getting Your API Keys
OpenAI API Key:
- Visit OpenAI Platform
- Sign in or create an account
- Click "Create new secret key"
- Copy the key and add it to your
.envfile
YouTube Data API Key:
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable the "YouTube Data API v3"
- Go to "Credentials" → "Create Credentials" → "API Key"
- Copy the key and add it to your
.envfile
🧪 Testing Installation
To verify that FeedForge is installed correctly, run the test script:
python test_feedforge.py
This will test:
- All required imports
- Environment variable handling
- CLI command availability
🚀 Usage
Basic Usage
# If you've set up environment variables or .env file
feedforge "I want to see videos about people building successful side projects and sharing their journey"
# Or provide API keys directly
feedforge "your interests" --openai-key "sk-..." --youtube-key "AIza..."
With Custom Duration
Control how long each video plays (default is 2 seconds):
feedforge "machine learning tutorials for beginners" --duration 5
Example Commands
# Startup and entrepreneurship content
feedforge "startup founders sharing their journey and lessons learned"
# Programming tutorials
feedforge "python programming tutorials and coding best practices" --duration 3
# Creative content
feedforge "digital art tutorials and creative processes" --duration 4
# Productivity and self-improvement
feedforge "productivity tips and morning routines of successful people"
🔧 How It Works
- Input Processing: FeedForge takes your content description and uses OpenAI's GPT-4 to generate relevant search keywords
- Video Discovery: Uses YouTube's Data API to search for high-quality videos matching those keywords
- Smart Selection: Implements round-robin selection to ensure diverse content from different keywords
- Browser Automation: Opens Chrome and automatically plays each video for the specified duration
- Algorithm Training: Your interactions help train YouTube's recommendation algorithm to show similar content
🛠️ Troubleshooting
Common Issues
"externally-managed-environment" Error
This error occurs on modern Python installations (macOS with Homebrew, Ubuntu 23.04+, etc.). Solutions:
- Use pipx (recommended):
pipx install feedforge - Use a virtual environment: Create and activate a venv before installing
- Use --user flag:
pip install --user feedforge(add ~/.local/bin to PATH) - Override (not recommended):
pip install --break-system-packages feedforge
See the Installation section above for detailed instructions.
"No .env file found"
Make sure you've created a .env file in the project root directory with your API keys.
"Chrome not found"
FeedForge will automatically try to find Chrome in common locations:
- macOS:
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome - Windows:
C:\Program Files\Google\Chrome\Application\chrome.exe - Linux:
/usr/bin/google-chrome
If Chrome is installed elsewhere, you may need to update the path in src/feedforge/core.py.
"Invalid API Key"
- Verify your API keys are correct in the
.envfile - Ensure your OpenAI account has sufficient credits
- Check that YouTube Data API is enabled in Google Cloud Console
"No videos found"
Try using more general or different keywords in your description.
Debug Mode
For debugging, you can run the project with Python directly:
python -m feedforge.cli "your content description here"
📁 Project Structure
feedforge/
├── src/
│ └── feedforge/
│ ├── __init__.py # Automatic Playwright setup
│ ├── cli.py # Command-line interface
│ └── core.py # Main functionality
├── pyproject.toml # Project configuration
├── test_feedforge.py # Installation test script
├── .env.example # Environment variables template
├── .env # API keys (you create this)
└── README.md # This file
🤝 Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Test your changes:
python test_feedforge.py - Ensure all tests pass:
feedforge --help - Submit a pull request
Development Setup
# Clone your fork
git clone https://github.com/RishabhKodes/feedforge.git
cd feedforge
# Create virtual environment with Python 3.9+
python3.9 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
# Run tests
python test_feedforge.py
📄 License
This project is open source. Please check the license file for details.
⚠️ Disclaimer
This tool automates browser interactions with YouTube. Use responsibly and in accordance with YouTube's Terms of Service. The authors are not responsible for any violations of platform policies.
🆘 Support
If you encounter any issues:
- Check the troubleshooting section above
- Ensure all prerequisites are met
- Verify your API keys are valid
- Create an issue on GitHub with detailed error information
Happy feed customizing! 🎉
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file feedforge-0.2.8.tar.gz.
File metadata
- Download URL: feedforge-0.2.8.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6b5e5ace87e6c6401aeb9720eebd6ddb35d83068686be5ab9f4e36888983003
|
|
| MD5 |
340941fc2936492b5a271c622923b0a0
|
|
| BLAKE2b-256 |
ff535d1dc4a6405af93ed1920ae265cc53761a44aade98e122c5b5455c0b8382
|
File details
Details for the file feedforge-0.2.8-py3-none-any.whl.
File metadata
- Download URL: feedforge-0.2.8-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e95603310f125aac5694e9da8489dc5f17a4b0bdf6db0c6145a7c1234b648a1
|
|
| MD5 |
eef8603e39d51b84713e0ef76f2849e2
|
|
| BLAKE2b-256 |
72130959d46e2683829fd984389943745d6e74c7c6f64128f966a1774644819e
|