Skip to main content

Monitor ARD Mediathek series for new episodes and download them via yt-dlp

Project description

MediathekWatch

A Python CLI tool to monitor ARD Mediathek, ARTE.tv, and ZDF Mediathek series for new episodes and automatically download them using yt-dlp. State is tracked in a local DuckDB database.

Requirements

  • Python 3.10+
  • uv
  • yt-dlp installed and available in $PATH

Installation

# Clone or navigate to the project
cd /path/to/mediathekwatch

# Install with uv
uv sync

# Or install as editable
uv pip install -e .

Usage

The tool is installed as mediathekwatch command:

Add a series to monitor

mediathekwatch add "https://www.ardmediathek.de/serie/feuer-und-flamme/staffel-11/Y3JpZDovL3dkci5kZS9mZXVlcnVuZGZsYW1tZQ/11" --name "Feuer und Flamme"

ZDF Mediathek URLs are also supported:

mediathekwatch add "https://www.zdf.de/serien/die-anstalt" --name "Die Anstalt"

Assign to a group (see Groups):

mediathekwatch add "https://www.ardmediathek.de/serie/..." --name "My Show" --group "TVShows"

List monitored series

mediathekwatch list

Check for new episodes (intended for cron)

mediathekwatch check --target /mnt/media/TVShows

# Silent mode (suppress all output)
mediathekwatch check --target /mnt/media/TVShows --silent

When groups are configured, each group downloads to its own target folder and --target is not allowed:

mediathekwatch check --silent

Force redownload of a specific episode

# By series ID
mediathekwatch redownload 1 11 5 --target /mnt/media/TVShows

# By series name
mediathekwatch redownload "Feuer und Flamme" 11 5 --target /mnt/media/TVShows

If --target is omitted, the episode downloads to the series' group folder.

Download all episodes from a series URL

mediathekwatch download "https://www.ardmediathek.de/serie/feuer-und-flamme/staffel-11/Y3JpZDovL3dkci5kZS9mZXVlcnVuZGZsYW1tZQ/11" --target /mnt/media/TVShows

Works with ZDF Mediathek too:

mediathekwatch download "https://www.zdf.de/serien/die-anstalt" --target /mnt/media/TVShows

Remove a series

# By ID
mediathekwatch remove 1

# By name
mediathekwatch remove "Feuer und Flamme"

Groups

Groups let you organize series into separate download destinations. Each group has its own target folder. When any non-default group exists, check uses group folders instead of --target.

Create a group

mediathekwatch group create "TVShows" --target /mnt/media/TVShows

List groups

mediathekwatch group list

Update a group

mediathekwatch group update "TVShows" --name "TV Shows" --target /mnt/media/TV

Delete a group

mediathekwatch group delete "TVShows"

Move a series to a group

mediathekwatch set-group "Feuer und Flamme" "TVShows"

Global Options

  • --db PATH — Path to DuckDB database (default: ~/.config/mediathekwatch/mediathekwatch.db)
  • --target PATH — Target folder for downloads (default: current directory)

Cron Setup

Add to your crontab (e.g., every 6 hours):

0 */6 * * * /path/to/uv run mediathekwatch check --target /mnt/media/TVShows

Or if installed globally:

0 */6 * * * /home/user/.local/bin/mediathekwatch check --target /mnt/media/TVShows

Filename Format

Downloaded episodes are organized as:

<Target Folder>/<Series Name>/S<Season>/<Series> - S<season>E<episode> - <episode name>.mkv

Example:

/mnt/media/TVShows/Feuer und Flamme/S11/Feuer und Flamme - S11E05 - Der neue Fall.mkv

Database Schema

Three tables are maintained in DuckDB:

  • groups — download groups with target folders
  • monitored_series — series being tracked
  • downloaded_episodes — episodes already downloaded

Project Structure

src/mediathekwatch/
├── __init__.py    # Package init
├── main.py        # CLI entry point
├── cli.py         # Command handlers
├── models.py      # Episode/Series dataclasses
├── database.py    # DuckDB interface
├── api/           # API clients (ARD, ARTE, ZDF)
└── download.py    # yt-dlp wrapper & filename utils

Notes

  • The tool queries ARD Mediathek, ARTE.tv EMAC, and ZDF GraphQL APIs to discover episodes.
  • yt-dlp is invoked with flags for embedding thumbnails, subtitles, metadata, chapters, and info-json.
  • Episodes are skipped if they already exist in the downloaded_episodes table; use redownload to override.

Acknowledgments

  • Thanks to the MediathekView project for providing valuable insights into the structure of German public media APIs.

Development

# Run tests
uv run pytest

# Type check
uv run pyright

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

mediathekwatch-0.1.0.tar.gz (71.8 kB view details)

Uploaded Source

Built Distribution

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

mediathekwatch-0.1.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file mediathekwatch-0.1.0.tar.gz.

File metadata

  • Download URL: mediathekwatch-0.1.0.tar.gz
  • Upload date:
  • Size: 71.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mediathekwatch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 72cc6dea2e031077dcbe31f5ff3f9ad70d9d7bbed66ef4456ab7f7be51a01a66
MD5 543944017b07dfb0e9ab96543ed15ccf
BLAKE2b-256 3fe3fc5c2b225397d45d8ec3d4cc5068d277c7c49bb02328fa9bf818b105bdba

See more details on using hashes here.

File details

Details for the file mediathekwatch-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mediathekwatch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mediathekwatch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 125884844c24bc64ebcbb158a2eecb8508dd82ca1ace93b344f894b521a86286
MD5 862a5b850b21b11aba7ca245113743a1
BLAKE2b-256 1c860f87daef831767e905c4438ad8ccfca2b90d45057eb599d197845eb73c9d

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