Skip to content

A Python script to download Chrome and Firefox browser extensions by ID, saving them as ZIP files.

Notifications You must be signed in to change notification settings

neuro220/AddonGrab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Extension Downloader

A Python script to download Chrome and Firefox browser extensions by ID, saving them as ZIP files for analysis, backup, or development purposes.

Features

  • Multi-Platform Support: Download extensions from Chrome (CRX3 format) or Firefox (XPI format).
  • Version Control: Fetch the latest version or specify a particular version.
  • Batch Downloads: Process multiple extensions from a file or comma-separated list with custom naming.
  • Progress Indicators: Visual progress bars for all downloads (requires tqdm).
  • Robust Handling: Retries on failures, error recovery, and validation for IDs and files.
  • Flexible Output: Custom output paths, output directories, force overwrites, and verbose logging.
  • Smart Naming: Default output uses extension name instead of ID (with fallback to ID).

Requirements

  • Python 3.6 or higher.
  • Optional: tqdm for progress bars (pip install tqdm).

Installation

Download extension.py to your local machine.

Usage

Run the script from the command line. Basic syntax:

python extension.py [extension_id] [options]

Basic Download

Download the latest version of a Chrome extension:

python extension.py cjpalhdlnbpafiamejdnhcphjbkeiagm --platform chrome

Download the latest Firefox addon:

python extension.py ublock-origin --platform firefox

Advanced Options

  • Specify Version: Download a specific version (Firefox only supports available versions).

    python extension.py ublock-origin --platform firefox --version 1.68.0
    
  • Batch Download: Download multiple extensions from a file (one ID per line) or comma-separated list.

    python extension.py --batch ids.txt --platform firefox --continue-on-error
    

    Or:

    python extension.py --batch id1,id2,id3 --platform chrome --force
    
  • List Versions: Show available versions for a Firefox addon (Chrome not supported).

    python extension.py ublock-origin --platform firefox --list-versions
    
  • Verbose Logging: Enable detailed output.

    python extension.py ublock-origin --platform firefox --verbose
    
  • Custom Output: Specify output file path or directory.

    python extension.py ublock-origin --platform firefox -o custom.zip
    
    python extension.py ublock-origin --platform firefox -d /path/to/downloads
    
  • Batch Custom Naming: Use placeholders for custom filenames in batch mode.

    python extension.py --batch ids.txt --batch-name "{name}-backup.zip" --platform chrome
    

    Available placeholders: {id} (extension ID), {name} (extension name).

Options Reference

Option Description
extension_id Extension ID (Chrome: 32 alphanumeric chars; Firefox: GUID or slug). Optional with --batch or --list-versions.
-o, --output Output ZIP file path (default: {extension_name}.zip).
-d, --output-dir Output directory for downloaded files.
-v, --version Version to download (default: latest).
--platform Platform: chrome or firefox (default: chrome).
--verbose Enable detailed logging.
-f, --force Overwrite existing output files.
--batch Batch download: file path or comma-separated IDs.
--batch-name Custom output name for batch downloads (supports {id}, {name} placeholders).
--continue-on-error Skip errors in batch mode and continue.
--list-versions List available versions for the addon.
-h, --help Show help message.

Examples

  1. Download uBlock Origin for Firefox:

    python extension.py ublock-origin --platform firefox --verbose
    

    Output: Downloads and saves as uBlock Origin.zip (extension name).

  2. Download specific version:

    python extension.py ublock-origin --platform firefox --version 1.67.0
    
  3. Batch download with error handling:

    python extension.py --batch ublock-origin,invalid-id --platform firefox --continue-on-error --force
    

    Processes valid IDs, skips invalid ones.

  4. List Firefox versions:

    python extension.py ublock-origin --platform firefox --list-versions
    

    Output: Available versions for ublock-origin: 1.68.0, 1.67.0, ...

  5. Chrome extension with custom output directory:

    python extension.py cjpalhdlnbpafiamejdnhcphjbkeiagm --platform chrome -d /path/to/downloads
    

    Output: Downloads and saves as /path/to/downloads/uBlock Origin.zip.

  6. Batch with custom naming:

    python extension.py --batch ids.txt --batch-name "{name}-backup.zip" --platform chrome
    

    Output: Creates files like uBlock Origin-backup.zip, AdBlock-backup.zip, etc.

  7. Chrome extension with custom filename:

    python extension.py cjpalhdlnbpafiamejdnhcphjbkeiagm --platform chrome -o my-extension.zip --force
    

Troubleshooting

  • Invalid ID Format: Ensure Chrome IDs are 32 alphanumeric characters, Firefox IDs are GUIDs (e.g., {uuid}) or slugs (e.g., ublock-origin).
  • File Not Found (Batch): Check the batch file path and ensure it exists with one ID per line.
  • API Errors (Firefox): Mozilla API may have rate limits (60 requests/hour). Wait and retry. 404 means invalid ID.
  • Download Failures: Check network connection. Retries are automatic.
  • No Progress Bar: Install tqdm (pip install tqdm) for visual progress.
  • Overwrite Prompts: Use --force to overwrite existing files.
  • Platform Mismatch: Use correct --platform for the ID type.
  • Extension Name Not Found: If the script can't fetch the extension name, it will fall back to using the extension ID as the filename.

Notes

  • Limitations: Listing versions is only supported for Firefox. Chrome versions must be specified manually.
  • Rate Limits: Firefox API has request limits; avoid excessive batch downloads.
  • Security: This script downloads from official sources. Use for legitimate purposes only.
  • File Formats: Chrome CRX files are stripped to ZIP; Firefox XPI files are saved as-is (already ZIP-compatible).
  • Dependencies: All core features work with stdlib; tqdm enhances UX.
  • Smart Naming: The script fetches extension names for default filenames. If unavailable, uses the extension ID as fallback.
  • Progress Tracking: Progress bars are shown for both Chrome and Firefox downloads when tqdm is installed.

About

A Python script to download Chrome and Firefox browser extensions by ID, saving them as ZIP files.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages