Skip to content

atomicmilkshake/BookmarkRancher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BookmarkRancher

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.

Features

  • 🔍 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

Requirements

  • Python 3.12+
  • Required packages (install via pip install -r requirements.txt):
    • rich - Enhanced console UI
    • requests - HTTP requests for URL validation and API calls

Installation

  1. Clone this repository:

    git clone https://github.com/YOUR_USERNAME/BookmarkRancher.git
    cd BookmarkRancher
  2. Create a virtual environment:

    python -m venv .venv
    .venv\Scripts\Activate.ps1  # Windows PowerShell
    # or
    source .venv/bin/activate  # Linux/Mac
  3. Install dependencies:

    pip install rich requests

Configuration

API Setup (Optional - for Grok-4 categorization)

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

Usage

  1. Close all browsers (Firefox, Edge, Vivaldi) before running to avoid database lock errors

  2. Run the script:

    python bookmarks-fixer.py
  3. 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
  4. 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

Output

The script generates consolidated-bookmarks.html with:

  • Bookmarks Toolbar: Top 20 most frequently visited bookmarks
  • Other Bookmarks: Remaining validated bookmarks

How It Works

  1. Profile Detection: Automatically finds browser profiles by searching for places.sqlite (Firefox) or Bookmarks files (Chromium-based)
  2. Data Extraction:
    • Firefox: Queries places.sqlite for bookmarks and visit counts
    • Edge/Vivaldi: Parses Bookmarks JSON and queries History database
  3. De-duplication: Removes duplicate URLs, keeping the entry with the highest visit count
  4. URL Validation: Multi-threaded HTTP requests to verify each bookmark is still accessible
  5. HTML Generation: Creates standard NETSCAPE bookmark format compatible with all browsers

Troubleshooting

Database Locked Error

  • Solution: Close all browser instances (Firefox, Edge, Vivaldi) before running

No Bookmarks Found

  • Check that browser profiles exist in default locations
  • Verify you have bookmarks in the browsers

API Errors

  • Verify your OPENAI_API_KEY is set correctly
  • Check that you have API credits/quota available
  • The script will continue without API categorization if the call fails

Project Structure

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

License

MIT License - feel free to use and modify as needed!

Contributing

Contributions welcome! Please feel free to submit a Pull Request.

Author

Created with ❤️ for organizing and cleaning up bookmarks across multiple browsers.

About

Multi-browser bookmark consolidation tool with URL validation and HTML export

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages