Robust MediaFire downloader with auto-resume, custom headers, retries, and bulk support.
Project description
mediafire-dl-cli
A robust MediaFire downloader with:
- ✅ Auto-resume — interrupted downloads pick up where they left off via HTTP Range requests +
.partfiles - ✅ Custom headers — pass any HTTP headers (cookies, auth, referer, …)
- ✅ Retries + back-off — configurable retry count with exponential back-off on transient errors
- ✅ Rich progress bar — speed (MB/s), ETA, percent, downloaded/total
- ✅ Bulk/parallel download — thread-pool with configurable worker count
- ✅ CLI — use straight from the terminal
- ✅ Callback hook —
on_progressfor GUI or logging integration
Install
pip install mediafire-dl-cli
# or for local development:
pip install -e .
Python API
Single file
from mediafire_dl_cli import Download
path = Download(
url="https://www.mediafire.com/file/abc123/myarchive.zip",
output="/home/user/downloads", # optional, defaults to script dir
filename="renamed.zip", # optional
headers={"Cookie": "session=xyz"}, # optional extra headers
chunk_size=64 * 1024, # 64 KB (default)
retries=5, # HTTP-level retries (default 5)
backoff=1.0, # exponential back-off factor
show_progress=True,
on_progress=lambda done, total: None, # optional callback
)
print(f"Saved to {path}")
Auto-resume behaviour
If the download is interrupted (Ctrl-C, crash, network drop), a .part file is kept on disk.
Calling Download() again with the same arguments will automatically resume from the byte offset where it stopped — as long as the server supports Accept-Ranges.
If the server does not support range requests, a RangeNotSupportedError is raised.
Delete the .part file manually and start over in that case.
Bulk download
from mediafire_dl_cli import BulkDownload
urls = [
"https://www.mediafire.com/file/abc/file1.zip",
"https://www.mediafire.com/file/def/file2.zip",
"https://www.mediafire.com/file/ghi/file3.zip",
]
results = BulkDownload(
urls,
output="/home/user/downloads",
headers={"Referer": "https://example.com"},
max_workers=3, # parallel downloads
retries=5,
show_progress=True,
)
# results: {url: "/path/to/file" | Exception}
for url, result in results.items():
if isinstance(result, Exception):
print(f"FAILED {url}: {result}")
else:
print(f"OK {result}")
CLI Examples
Single file download
# Simple download to current directory
mediafire-dl-cli https://www.mediafire.com/file/abc123/video.mp4
# Download to specific directory with custom filename (filename inferred from URL if not provided)
mediafire-dl-cli https://www.mediafire.com/file/abc123/video.mp4 -o ~/Downloads
Bulk download (Parallel)
# Download multiple URLs using 5 parallel workers
mediafire-dl-cli url1 url2 url3 url4 url5 -w 5 -o ./my_collection
Advanced Usage
# Custom headers (useful for auth/sessions)
mediafire-dl-cli <url> -H "Cookie: session=abc" -H "User-Agent: MyDownloader/1.0"
# More retries for unstable connections (default is 5)
mediafire-dl-cli <url> -r 20
# Suppress progress bar (useful for cron jobs or logging)
mediafire-dl-cli <url> --no-progress
Exceptions
| Exception | When |
|---|---|
ScraperError |
Download button not found / page unreachable |
DownloadError |
HTTP or I/O error during transfer |
RangeNotSupportedError |
Resume attempted but server rejects Range header |
All inherit from MediaFireError for easy broad catching:
from mediafire_dl_cli.exceptions import MediaFireError
try:
Download(url)
except MediaFireError as e:
print(f"mediafire_dl_cli error: {e}")
Package layout
mediafire-dl-cli/
├── mediafire_dl_cli/
│ ├── __init__.py exports: Download, BulkDownload, GetFileLink, …
│ ├── __main__.py CLI entry point
│ ├── downloader.py core download logic
│ ├── scraper.py HTML scraping → direct link
│ ├── utils.py helpers: AsMegabytes, GetFileSize, SupportsRanges
│ └── exceptions.py custom exception hierarchy
├── pyproject.toml modern packaging metadata
├── README.md documentation
└── LICENSE MIT license
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mediafire_dl_cli-1.1.0.tar.gz.
File metadata
- Download URL: mediafire_dl_cli-1.1.0.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5002f63249e3d0ad6f3fcf1cc2ffc9a7a0c3f87af772bc88ef5ef22d6c80b0e
|
|
| MD5 |
39debd4ea62cba1e3eb7954cd744bf66
|
|
| BLAKE2b-256 |
132cdef5e0af1ca8c01a1b6f524df5211172a1e3a40b2fb99cf0303f0a1919fd
|
File details
Details for the file mediafire_dl_cli-1.1.0-py3-none-any.whl.
File metadata
- Download URL: mediafire_dl_cli-1.1.0-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f4de7007908aec7f6a2562cc96e592b5410d978c72d501d6e06d1a9d1d322b4
|
|
| MD5 |
7203e4c910afe7d2e4ff4bf97826c832
|
|
| BLAKE2b-256 |
ecfc12d8ff0a24ade6ef215773378c286c43c467dbbfb9de71004e5989418d0a
|