Skip to main content

A Python library to extract and organize Firefox browser tabs

Project description

Firefox Tab Extractor ๐Ÿ”ฅ

Python 3.7+ License: MIT PyPI version

A powerful Python library to extract and organize Firefox browser tabs for productivity, study organization, and workflow management.

๐ŸŽฏ Why Firefox Tab Extractor?

Tired of losing track of important tabs? This library helps you:

  • ๐Ÿ“š Organize study materials - Extract all your research tabs into structured formats
  • ๐Ÿ“Š Productivity tracking - See which sites you visit most and optimize your workflow
  • ๐Ÿ”„ Session backup - Save your browsing sessions before major cleanup
  • ๐Ÿ“‹ Notion integration - Export tabs directly to Notion for task management
  • ๐ŸŽ“ Learning management - Create structured study schedules from your open tabs

โœจ Features

  • ๐Ÿ” Smart profile detection - Automatically finds Firefox profiles across different OS
  • ๐Ÿ“ Multiple output formats - JSON for developers, CSV for Notion/Excel
  • ๐Ÿท๏ธ Rich metadata - Tab titles, URLs, access times, pinned status, domains
  • ๐Ÿ“Š Statistics & analytics - Get insights about your browsing patterns
  • ๐Ÿ› ๏ธ Developer-friendly - Clean API, type hints, comprehensive error handling
  • ๐Ÿš€ CLI & Library - Use as command-line tool or import in your Python code

๐Ÿš€ Quick Start

Installation

pip install firefox-tab-extractor

Command Line Usage

# Extract all tabs to default files
firefox-tab-extractor

# Save to specific files
firefox-tab-extractor --json my_tabs.json --csv my_tabs.csv

# Show statistics only
firefox-tab-extractor --stats-only

# Verbose output with preview
firefox-tab-extractor --verbose --preview 10

Python Library Usage

from firefox_tab_extractor import FirefoxTabExtractor

# Initialize extractor
extractor = FirefoxTabExtractor()

# Extract tabs
tabs = extractor.extract_tabs()

# Get statistics
stats = extractor.get_statistics(tabs)
print(f"Found {stats['total_tabs']} tabs across {stats['total_windows']} windows")

# Save to files
extractor.save_to_json(tabs, "my_tabs.json")
extractor.save_to_csv(tabs, "my_tabs.csv")

# Group by windows
windows = extractor.get_windows(tabs)
for window in windows:
    print(f"Window {window.window_index}: {window.tab_count} tabs")

๐Ÿ“Š Output Formats

JSON Output

{
  "extraction_time": "2024-01-15T10:30:00",
  "total_tabs": 25,
  "windows": 3,
  "pinned_tabs": 5,
  "hidden_tabs": 2,
  "tabs": [
    {
      "window_index": 1,
      "tab_index": 1,
      "title": "GitHub - Your Repository",
      "url": "https://github.com/username/repo",
      "last_accessed": 1705312200000,
      "last_accessed_readable": "2024-01-15 10:30:00",
      "pinned": true,
      "hidden": false,
      "domain": "github.com"
    }
  ]
}

CSV Output (Notion-ready)

window_index,tab_index,title,url,last_accessed_readable,pinned,hidden,domain
1,1,GitHub - Your Repository,https://github.com/username/repo,2024-01-15 10:30:00,true,false,github.com

๐ŸŽ“ Study Organization Workflow

1. Extract Your Tabs

firefox-tab-extractor --csv study_materials.csv

2. Import to Notion

  1. Create a new Notion database
  2. Import the CSV file
  3. Add custom properties:
    • Category (JavaScript, Python, System Design, etc.)
    • Priority (High, Medium, Low)
    • Estimated Reading Time (15min, 30min, 1hr)
    • Status (Not Started, In Progress, Completed)
    • Study Day (Monday, Wednesday, Friday, Weekend)

3. Create Study Schedule

Monday (1 hour):
- 1 book chapter (30 min)
- 2-3 short articles (30 min)

Wednesday (1 hour):
- 1 book chapter (30 min)
- 1 long technical article (30 min)

Friday (1 hour):
- 1 book chapter (30 min)
- Practice problems/coding (30 min)

Weekend (2 hours):
- 1 book chapter (30 min)
- 2-3 comprehensive tutorials (90 min)

๐Ÿ› ๏ธ Advanced Usage

Custom Firefox Profile

extractor = FirefoxTabExtractor(profile_path="~/.mozilla/firefox/custom.profile")

Filtering and Analysis

# Get only pinned tabs
pinned_tabs = [tab for tab in tabs if tab.pinned]

# Get tabs by domain
github_tabs = [tab for tab in tabs if tab.domain == "github.com"]

# Get recently accessed tabs
from datetime import datetime, timedelta
recent_tabs = [
    tab for tab in tabs 
    if tab.last_accessed_datetime > datetime.now() - timedelta(days=7)
]

Error Handling

from firefox_tab_extractor import FirefoxTabExtractor
from firefox_tab_extractor.exceptions import FirefoxProfileNotFoundError

try:
    extractor = FirefoxTabExtractor()
    tabs = extractor.extract_tabs()
except FirefoxProfileNotFoundError:
    print("Firefox profile not found. Make sure Firefox is installed.")

๐Ÿ”ง Troubleshooting

Firefox Profile Not Found

  • Make sure Firefox has been run at least once
  • Check if Firefox is installed via snap: snap list firefox
  • Use --profile to specify custom profile path

Permission Issues

  • Ensure you have read access to Firefox profile directory
  • On some systems, you might need to close Firefox first

No Tabs Found

  • Ensure Firefox has active tabs open
  • Try closing and reopening Firefox to refresh session data
  • Check if Firefox is in private browsing mode (private tabs aren't saved)

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

๐Ÿ› Reporting Bugs

  • Use the GitHub issue tracker
  • Include your OS, Firefox version, and Python version
  • Provide error messages and steps to reproduce

๐Ÿ’ก Feature Requests

  • Open an issue with the "enhancement" label
  • Describe the feature and its use case
  • Consider contributing the implementation

๐Ÿ”ง Development Setup

# Clone the repository
git clone https://github.com/ViniciusPuerto/firefox-tab-extractor.git
cd firefox-tab-extractor

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black firefox_tab_extractor/

# Type checking
mypy firefox_tab_extractor/

๐Ÿ“ Code Style

  • Follow PEP 8 style guidelines
  • Use type hints for all functions
  • Add docstrings for all public methods
  • Write tests for new features

๐Ÿš€ Roadmap

Planned Features

  • Chrome/Edge support - Extract tabs from other browsers
  • Tab categorization - AI-powered content classification
  • Reading time estimation - Based on content analysis
  • Duplicate detection - Find and merge similar tabs
  • Scheduled extraction - Automatically extract tabs at intervals
  • Web interface - Browser-based tab management
  • Cloud sync - Backup and sync across devices
  • Tab analytics - Detailed browsing pattern analysis

Integration Ideas

  • Notion API - Direct integration with Notion
  • Obsidian - Export to Obsidian vault
  • Roam Research - Integration with Roam
  • Todoist - Create tasks from tabs
  • Slack - Share tab collections with teams

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Firefox - For providing an accessible session storage format
  • LZ4 - For the compression library used by Firefox
  • Python community - For the excellent ecosystem of tools and libraries

๐Ÿ“ž Support


Made with โค๏ธ for the productivity community

If this project helps you organize your digital life, consider giving it a โญ on GitHub!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

firefox_tab_extractor-1.0.0.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

firefox_tab_extractor-1.0.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file firefox_tab_extractor-1.0.0.tar.gz.

File metadata

  • Download URL: firefox_tab_extractor-1.0.0.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for firefox_tab_extractor-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3618c8d70dd7ea968362e0c7fc5edc2192cc8e5d9ae56e7d75f5907dba903eae
MD5 a77d31889a9c3d850cd26f7859a2a426
BLAKE2b-256 7a07c9ed3fb846ab6b2d0df0ece0b0b17b1439efe827a315015f44b8a0b67e4d

See more details on using hashes here.

File details

Details for the file firefox_tab_extractor-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for firefox_tab_extractor-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd613fdb1c7cf03c645b79d4b0b73e601ad802c4dcf8db2f02ab828a8690a6a7
MD5 455681714fa506d5eb4186330238d41f
BLAKE2b-256 ac4a297729723ea5224c1b56dfaeebc6f1708cddb49b946fca5ea209ab35702c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page