A powerful Python tool that consolidates bookmarks from Firefox, Edge, and Vivaldi browsers, validates URLs, and generates a clean, organized HTML bookmarks file ready for import into any browser.
- 🔍 Multi-Browser Support: Extracts bookmarks from Firefox, Edge, and Vivaldi
- 📊 Visit Count Tracking: Retrieves visit frequency data from browser history databases
- 🔗 URL Validation: Automatically checks and removes dead/broken links
- 📁 Smart Organization: Most frequently visited bookmarks appear in the "Bookmarks Toolbar" folder
- 🤖 AI-Powered Categorization: Optional Grok-4 integration for intelligent bookmark organization
- 🎨 Rich UI: Beautiful console interface with progress bars and statistics
- ⚡ Multithreaded: Fast parallel processing for URL validation and data extraction
- Python 3.12+
- Required packages (install via
pip install -r requirements.txt):rich- Enhanced console UIrequests- HTTP requests for URL validation and API calls
-
Clone this repository:
git clone https://github.com/YOUR_USERNAME/BookmarkRancher.git cd BookmarkRancher -
Create a virtual environment:
python -m venv .venv .venv\Scripts\Activate.ps1 # Windows PowerShell # or source .venv/bin/activate # Linux/Mac
-
Install dependencies:
pip install rich requests
If you want to use the AI categorization feature, set these environment variables:
# Windows PowerShell
$env:OPENAI_API_KEY="your_poe_api_key_here"
$env:OPENAI_BASE_URL="https://api.poe.com"
$env:OPENAI_MODEL="Grok-4-Fast-Reasoning"
# Linux/Mac
export OPENAI_API_KEY="your_poe_api_key_here"
export OPENAI_BASE_URL="https://api.poe.com"
export OPENAI_MODEL="Grok-4-Fast-Reasoning"Get your API key from: https://poe.com/api_key
-
Close all browsers (Firefox, Edge, Vivaldi) before running to avoid database lock errors
-
Run the script:
python bookmarks-fixer.py
-
The script will:
- Locate browser profiles automatically
- Extract bookmarks with visit counts
- De-duplicate by URL (keeps highest visit_count)
- Optionally send to Grok-4 for categorization
- Validate all URLs and remove dead links
- Generate
consolidated-bookmarks.html
-
Import the generated HTML file into any browser:
- Firefox: Bookmarks → Import Bookmarks and Settings → From File
- Edge/Chrome: Bookmarks → Import bookmarks → From HTML file
- Vivaldi: File → Import Bookmarks → From HTML file
The script generates consolidated-bookmarks.html with:
- Bookmarks Toolbar: Top 20 most frequently visited bookmarks
- Other Bookmarks: Remaining validated bookmarks
- Profile Detection: Automatically finds browser profiles by searching for
places.sqlite(Firefox) orBookmarksfiles (Chromium-based) - Data Extraction:
- Firefox: Queries
places.sqlitefor bookmarks and visit counts - Edge/Vivaldi: Parses
BookmarksJSON and queriesHistorydatabase
- Firefox: Queries
- De-duplication: Removes duplicate URLs, keeping the entry with the highest visit count
- URL Validation: Multi-threaded HTTP requests to verify each bookmark is still accessible
- HTML Generation: Creates standard NETSCAPE bookmark format compatible with all browsers
- Solution: Close all browser instances (Firefox, Edge, Vivaldi) before running
- Check that browser profiles exist in default locations
- Verify you have bookmarks in the browsers
- Verify your
OPENAI_API_KEYis set correctly - Check that you have API credits/quota available
- The script will continue without API categorization if the call fails
BookmarkRancher/
├── bookmarks-fixer.py # Main script
├── test-firefox-db.py # Diagnostic tool for Firefox database
├── BookmarkRancher.md # Original project specification
├── README.md # This file
├── .gitignore # Git ignore rules
└── requirements.txt # Python dependencies
MIT License - feel free to use and modify as needed!
Contributions welcome! Please feel free to submit a Pull Request.
Created with ❤️ for organizing and cleaning up bookmarks across multiple browsers.