Skip to main content

PySubZone

Find the right subtitle. Download it. Get back to watching.

PyPI version Python versions MIT license

PySubZone is a Python library, command-line tool, and interactive terminal app for searching and downloading subtitles from SubZone, the Subf2m subtitle database.

Whether you need one subtitle or want to match subtitles for an entire video collection, PySubZone gives you a straightforward way to find the version that fits.

Inspired by PyAddic7, which works with addic7ed.com.

What can it do?

  • Search titles — find movies and TV shows.
  • Browse subtitle versions — see the uploads available for a title, with language filtering.
  • Download subtitles — download a specific upload by reference or URL, or grab the newest uploads from a title page.
  • Match video files automatically — search for suitable subtitles based on release names, including episode number, resolution, source, and release group.
  • Use it your way — choose the Python API, the command-line interface, or the interactive terminal UI.

The CLI is built with Typer and Rich, while the interactive TUI is powered by Textual.

A note on responsible use: PySubZone accesses a public website for personal use. Please keep request rates reasonable and respect the source website's terms. Do not redistribute downloaded subtitles.

Packages

Package Purpose PyPI
PySubZone (pysubzone) Main Python API, CLI, and TUI package pypi.org/project/pysubzone
PySubF2M (pysubf2m) Compatibility package coming soon

Installation

Python 3.9 or newer is required.

Install the main package with pip:

pip install pysubzone

Or use pipx to install the command-line application in an isolated environment:

pipx install pysubzone

A compatibility package, PySubF2M (pysubf2m), is planned as a separate release.

After installing PySubZone, the subz command is available. You can also run it with:

python -m pysubzone

Quick start

Search for a title, inspect its subtitle versions, and download one:

# Search for a movie or show
subz search "dexter resurrection"

# Show the available Farsi subtitle versions
subz versions dexter-resurrection-season-2 -l fa

# Download a specific version
subz download dexter-resurrection-season-2/farsi_persian/3770171

Command-line reference

subz search QUERY [-l LANG] [--json]          Search titles
subz versions TITLE [-l LANG] [--json]        List subtitle uploads
subz download REF [-o DIR] [--zip] [--json]   Download by reference, URL, or slug
subz url URL [-l LANG] [-n N] [--zip]         Download from a SubZone URL
subz filename FILE [-l LANG] [--no-download]  Find the best subtitle for one video
subz auto PATH [-l LANG] [--dry-run] [--zip]   Match videos in a folder
subz popular [--mode popular|latest]           Browse popular or latest uploads
            [-t all|film|series|music] [-p PAGE]
subz tui                                       Open the interactive interface

Global options:

  • --base-url — use a different base URL.
  • --user-agent — set the HTTP user agent.
  • --timeout — configure the request timeout.
  • --retries — configure retry attempts.
  • -v, --verbose — enable verbose output.

Every data command supports --json for scripting and automation.

Exit codes follow the PyAddic7 contract:

Code Meaning
0 Success
1 Nothing found
2 Error

Search and browse

# Search for a title
subz search "dexter resurrection"

# Search for titles with Farsi subtitles
subz search odyssey -l fa

# List Farsi subtitle versions for a title
subz versions dexter-resurrection-season-2 -l fa

# Browse popular movie uploads
subz popular -t film

# Browse the latest series uploads, page 2
subz popular --mode latest -t series -p 2

Download subtitles

A reference identifies one subtitle upload and follows this format:

<slug>/<lang>/<id>

You can copy a reference from a version listing.

# Download using a reference
subz download dexter-resurrection-season-2/farsi_persian/3770171

# Download using the full subtitle URL
subz download https://subzone.ir/subtitles/dexter-resurrection-season-2/farsi_persian/3770171

# Grab the two newest Farsi uploads from a title URL
subz url https://subzone.ir/subtitles/the-odyssey-2026 -l fa -n 2

# Grab all available uploads from that title URL
subz url https://subzone.ir/subtitles/the-odyssey-2026 -l fa -n 0

# Download by title slug
subz download the-odyssey-2026 -l en --zip --out ./downloads

By default, downloaded archives are extracted and subtitle files receive a language suffix, such as Movie.fa.srt (or retain the release name when the archive includes one).

Useful output options:

  • --zip — keep the original archive instead of extracting it.
  • --no-suffix — do not append a language suffix.
  • --lang-suffix XX — choose a custom language suffix.
  • -o DIR / --out DIR — choose the output directory.

Automatically match a video collection

PySubZone can inspect video release names, search the site, score available subtitle versions, and download the best match.

# Find a subtitle for one video
subz filename "Dexter.Resurrection.S02E01.1080p.AMZN.WEB-DL-NTb.mkv"

# Preview matches in a folder without downloading
subz auto /media/shows -l fa --dry-run

# Download and extract subtitles beside the videos
subz auto /media/shows -l fa

# Save all subtitles into a separate folder
subz auto /media/shows -l fa -o ./subs

For each video, the release name is parsed for details such as the title, season and episode, resolution, source, and release group. Subtitle versions with conflicting episode numbers are rejected, exact release matches are preferred, and season packs can be used as fallbacks.

A failed match does not stop the whole collection: unsuccessful files are included in the final summary.

Interactive terminal interface

Prefer an interactive experience? Run:

subz tui

The TUI guides you through the process:

  1. Enter a search query to see matching titles.
  2. Select a title to browse its uploaded subtitle versions.
  3. Filter versions by language.
  4. Select a version to open the download dialog.
  5. Choose a destination and whether to extract subtitles or keep the ZIP archive.

The download dialog includes a live progress bar.

Keyboard shortcuts

Key Action
Esc Go back or close the current view
r Refresh subtitle versions
Ctrl+Q Quit

TUI screenshots

Search Subtitle versions Download
Search screen Versions screen Download dialog

Python API

You can use PySubZone directly from your own Python projects:

from pysubzone import SubZoneClient

client = SubZoneClient(timeout=20)

# Search for titles
results = client.search("dexter resurrection")

# Find a title and list its Farsi subtitle versions
title = client.search_exact("Dexter Resurrection")
versions = client.title_versions(title.slug, "farsi_persian")

# Download the first version and extract it into ./subs
result = client.download(
    versions[0],
    dest_dir="subs",
    save_mode="extract",
)
print(result.srt_paths)

# Find the best subtitle for a video release name
best_title, version, score = client.best_for_file(
    "Breaking.Bad.S05E14.720p.BluRay.x264-DEMAND"
)

# Download the match and associate it with the video filename
client.download(
    version,
    dest_dir=".",
    save_mode="extract",
    target_video="Breaking.Bad.S05E14.mkv",
)

# Download from a SubZone title URL
client.download_url(
    "/subtitles/the-odyssey-2026",
    lang="fa",
    limit=1,
    dest_dir="subs",
)

All client exceptions derive from pysubzone.SubZoneError. Specific errors include NetworkError, TitleNotFoundError, NoSubtitleFoundError, and DownloadError.

How it works

The project is organized into a few focused modules:

src/pysubzone/
  client.py       HTTP client, retries, signed-CDN downloads, ZIP verification
  parsing.py      Search, title, version, and browse-page parsers
  models.py       Data models with as_dict() support for JSON output
  languages.py    Language slugs and aliases (fa, en, tr, ...)
  matcher.py      Release-name parsing and video-folder scanning
  scoring.py      Subtitle-version scoring for auto-match
  cli.py          Typer command-line interface
  tui.py          Textual terminal interface
tests/            Offline tests using saved HTML fixtures

Website endpoints and client methods

SubZone route PySubZone method
/subtitles/searchbytitle?query=... search(), search_exact()
/subtitles/<slug> (optionally /<lang>) title(), title_versions()
/subtitles/<slug>/<lang>/<id> get_version()
/subtitles/<slug>/<lang>/<id>/download download()
`/browse/popular latest/...`

Downloads follow a redirect to a signed CDN URL. Before saving a download, PySubZone verifies the ZIP file signature. This helps detect stale uploads that return an S3 NoSuchKey XML response with HTTP 200; these are reported as DownloadError with a hint to try another version.

Development

Clone the repository, install the project in editable mode with development dependencies, and run the test suite:

pip install -e ".[dev]"
pytest

The test suite is designed to run offline. It uses saved HTML fixtures and synthetic release names, so tests do not need to access SubZone.

Support the project

If PySubZone saves you time or makes subtitle management easier, consider supporting its continued development. Donations are entirely optional — using the project, reporting bugs, sharing feedback, and contributing code are all valuable ways to help.

See DONATE.md for cryptocurrency donation options.

License

PySubZone is released under the MIT License. See LICENSE for the full license text.

Metadata

Release files for pysubzone 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysubzone 0.1.0
File Size Uploaded Provenance Actions
pysubzone-0.1.0.tar.gz 37.4 kB Without provenance Details for pysubzone-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pysubzone 0.1.0
File Interpreter ABI Platform Actions
pysubzone-0.1.0-py3-none-any.whl Python 3 none any Details for pysubzone-0.1.0-py3-none-any.whl

Total release size: 72.8 kB

Release files / pysubzone-0.1.0.tar.gz

Download URL pysubzone-0.1.0.tar.gz
Size 37.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f66810a0e6860f836af17255d357c65560285e3e5afe634050f8764ba2836885
BLAKE2b-256 checksum
How to use checksums
2b8786ae37832d15e4c717777f9316b8e320b33351b48dc8b6a4b75dd44d8f9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / pysubzone-0.1.0-py3-none-any.whl

Download URL pysubzone-0.1.0-py3-none-any.whl
Size 35.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
493d8cc041261bdea4f4700e61ac18c4c7572a8d2ce5f01968ce0b3bb94dd0b3
BLAKE2b-256 checksum
How to use checksums
564f35a4b50367883f985f2fd43c8a985fa3faec757e6fd64fefd48b47625b19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for pysubzone 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page