Skip to main content

media-dlp

Automated media downloader that uses Playwright (browser automation) to load streaming sites, detect video streams via network interception, and download them with yt-dlp.

Why?

Streaming sites load video players that fetch HLS/DASH manifests from CDNs. media-dlp:

  1. Opens the site in a real Firefox window (cookies, referrer, fingerprint – the whole deal)
  2. Watches all network traffic to find the video stream URL
  3. Hands that URL to yt-dlp for the actual download (progress bars, resume support, quality selection)

No sneaky DOM scraping, no brittle CSS selectors against popups – just raw network-level video detection.

Features

  • Network-level detection – catches HLS, MP4, DASH, WebM streams
  • TMDB integration – provide a TMDB movie ID instead of a full URL
  • Source chaining – tries multiple providers (mapple → cineby → …)
  • yt-dlp download – progress output, quality selection, resume
  • Tab muting – no audio from the automated browser window
  • CLI + Python API – use from the terminal or import as a library
  • Browser cookies – passes session cookies to yt-dlp for authenticated streams

Installation

pip install media-dlp

You also need the Playwright Firefox browser:

playwright install firefox

TMDB API Key (for --tmdb-id)

Set the environment variable:

export TMDB_API_KEY="your_key_here"

Get a free key at themoviedb.org/settings/api.


CLI Usage

media-dlp --url https://mapple.club/watch/movie/1034716

media-dlp --tmdb-id 1034716 --quality 1080p --output ~/Movies

media-dlp --tmdb-id 1034716 --providers mapple,cineby --filename "Dune 2"

Options

Argument Short Default Description
--url -u – Direct movie page URL
--tmdb-id --tmdb – TMDB movie ID
--quality -q 1080p best, 2160p, 1080p, 720p, …
--output -o ./downloads Download directory
--filename -f auto Custom output filename
--providers – mapple,cineby Comma-separated source providers to try
--timeout -t 600 Max seconds for the operation
--mute / --no-mute – True Mute browser tab
--verbose -v – Detailed logs

Python API

from media_dlp import download_movie, list_providers

# List available source providers
print(list_providers())

# Download by URL
result = download_movie(
    url="https://mapple.club/watch/movie/1034716",
    quality="1080p",
    output_dir="./movies",
    mute=True,
    verbose=True,
)
print(result)  # e.g. ./movies/movie_12345.mp4

# Download by TMDB ID
result = download_movie(
    tmdb_id=1034716,
    quality="best",
    providers="mapple,cineby",
    filename="Dune Part Two",
)

How It Works

┌─────────────────────────────────────────────────────┐
│  1. Playwright launches Firefox (persistent profile)│
│  2. Navigate to movie URL / resolve via TMDB        │
│  3. Click play button if needed                     │
│  4. Intercept ALL network requests/responses        │
│  5. Filter for HLS manifests, MP4 URLs, DASH MPDs   │
│  6. Pick best matching quality                      │
│  7. Spawn yt-dlp with: detected URL, cookies,       │
│     referrer, user-agent, origin headers             │
│  8. Stream progress to console                      │
│  9. File appears in output directory                │
└─────────────────────────────────────────────────────┘

The detection works at the network level, not the DOM level. This means it doesn't matter how the video player constructs its URLs – if a HTTP response carries video content, media-dlp sees it.

Source Providers

Providers are configured in media_dlp/sources.py. Each maps a TMDB ID to a streaming-site URL:

Provider URL pattern Priority
mapple https://mapple.club/watch/movie/{tmdb_id} 1
cineby https://cineby.at/movie/{tmdb_id} 2

When you pass --providers mapple,cineby, it tries mapple first; if that fails to produce a video it moves to cineby (future enhancement – currently it takes the first working URL).


Development

git clone https://github.com/jeevan/media-dlp
cd media-dlp
pip install -e .
playwright install firefox

Testing

media-dlp --url https://mapple.club/watch/movie/1034716 --verbose

FAQ

Q: Does this work with DRM-protected content?
A: No. Widevine-level DRM cannot be bypassed. The tool relies on plain HLS/DASH/HTTP streams.

Q: The download is slow
A: Increase the --timeout value. Feature-length movies can take 10-30 minutes.

Q: Can I run this headless?
A: Not currently – most streaming sites require a visible browser to serve video.

Q: The browser opens but no video is detected
A: Run with --verbose to see network traffic. The video player may need manual interaction (e.g. a "Play" click) which the tool attempts automatically via several common CSS selectors.


Metadata

Release files for media-dlp 1.4.1

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

Source distribution (sdist)

Source distribution for media-dlp 1.4.1
File Size Uploaded Provenance Actions
media_dlp-1.4.1.tar.gz 18.2 kB Without provenance Details for media_dlp-1.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for media-dlp 1.4.1
File Interpreter ABI Platform Actions
media_dlp-1.4.1-py3-none-any.whl Python 3 none any Details for media_dlp-1.4.1-py3-none-any.whl

Total release size: 36.8 kB

Release files / media_dlp-1.4.1.tar.gz

Download URL media_dlp-1.4.1.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3e3cba887562bc8e5923484840937cbe1993a26e037feed2ff87a385b8642113
BLAKE2b-256 checksum
How to use checksums
ada07e351e33ac39bb51ed15b1402d7cc6c13a4fea41a79679959aca473f9a7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / media_dlp-1.4.1-py3-none-any.whl

Download URL media_dlp-1.4.1-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ee238677fa18495db35114d891d3ccb42c87c546452c2aae4dc544c4f536a28
BLAKE2b-256 checksum
How to use checksums
720b47f79156a4f0cd5040a9abce65f24a4733ded96cd144773a045be09f2fb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for media-dlp 1.4.1

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