fernsehserien-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fernsehserien_mcp-0.1.0/.github/workflows/publish.yml +20 -0
- fernsehserien_mcp-0.1.0/.github/workflows/registry.yml +61 -0
- fernsehserien_mcp-0.1.0/.github/workflows/smoke.yml +21 -0
- fernsehserien_mcp-0.1.0/LICENSE +21 -0
- fernsehserien_mcp-0.1.0/PKG-INFO +62 -0
- fernsehserien_mcp-0.1.0/README-de.md +50 -0
- fernsehserien_mcp-0.1.0/README-fa.md +50 -0
- fernsehserien_mcp-0.1.0/README.md +50 -0
- fernsehserien_mcp-0.1.0/pyproject.toml +25 -0
- fernsehserien_mcp-0.1.0/server.json +1 -0
- fernsehserien_mcp-0.1.0/src/fernsehserien_mcp/__init__.py +7 -0
- fernsehserien_mcp-0.1.0/src/fernsehserien_mcp/domain.py +213 -0
- fernsehserien_mcp-0.1.0/src/fernsehserien_mcp/http.py +99 -0
- fernsehserien_mcp-0.1.0/src/fernsehserien_mcp/server.py +135 -0
- fernsehserien_mcp-0.1.0/tests/__init__.py +0 -0
- fernsehserien_mcp-0.1.0/tests/fixtures/episodenguide-s5.html +97 -0
- fernsehserien_mcp-0.1.0/tests/fixtures/search-babylon.html +90 -0
- fernsehserien_mcp-0.1.0/tests/fixtures/search-nomatch.html +91 -0
- fernsehserien_mcp-0.1.0/tests/fixtures/sendetermine.html +96 -0
- fernsehserien_mcp-0.1.0/tests/fixtures/series-babylon-berlin.html +111 -0
- fernsehserien_mcp-0.1.0/tests/smoke_live.py +17 -0
- fernsehserien_mcp-0.1.0/tests/test_domain.py +172 -0
- fernsehserien_mcp-0.1.0/tests/test_live.py +63 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write # required for PyPI trusted publishing (OIDC)
|
|
12
|
+
contents: read
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- run: pip install build
|
|
19
|
+
- run: python -m build
|
|
20
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: Publish to MCP Registry
|
|
2
|
+
|
|
3
|
+
# Official MCP Registry (registry.modelcontextprotocol.io) via GitHub OIDC.
|
|
4
|
+
# No secret, no interactive login: the runner's OIDC token proves ownership
|
|
5
|
+
# of the io.github.mohammad-abbasi-sh/* namespace.
|
|
6
|
+
# Refs: https://github.com/modelcontextprotocol/registry
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags: ["v*"]
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
publish:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
id-token: write # required for OIDC -> MCP Registry
|
|
18
|
+
contents: read
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Sync server.json version to tag
|
|
23
|
+
# Only sync when running on a version tag (v*). On workflow_dispatch
|
|
24
|
+
# (ref = refs/heads/main) keep the version committed in server.json.
|
|
25
|
+
run: |
|
|
26
|
+
VER=""
|
|
27
|
+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
|
28
|
+
TAG="${GITHUB_REF#refs/tags/}"
|
|
29
|
+
VER="${TAG#v}"
|
|
30
|
+
fi
|
|
31
|
+
if [ -n "$VER" ]; then
|
|
32
|
+
python3 - "$VER" << 'EOF'
|
|
33
|
+
import json, sys
|
|
34
|
+
ver = sys.argv[1]
|
|
35
|
+
d = json.load(open('server.json'))
|
|
36
|
+
d['version'] = ver
|
|
37
|
+
for pkg in d.get('packages', []):
|
|
38
|
+
pkg['version'] = ver
|
|
39
|
+
json.dump(d, open('server.json', 'w'), indent=2, ensure_ascii=False)
|
|
40
|
+
print('server.json version ->', ver)
|
|
41
|
+
EOF
|
|
42
|
+
else
|
|
43
|
+
echo "No version tag ($GITHUB_REF); keeping server.json version as-is"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
- name: Install mcp-publisher
|
|
47
|
+
run: |
|
|
48
|
+
curl -sL "https://github.com/modelcontextprotocol/registry/releases/download/v1.8.7/mcp-publisher_linux_amd64.tar.gz" -o /tmp/mcp-publisher.tar.gz
|
|
49
|
+
tar -xzf /tmp/mcp-publisher.tar.gz -C /tmp
|
|
50
|
+
sudo mv /tmp/mcp-publisher /usr/local/bin/mcp-publisher
|
|
51
|
+
mcp-publisher --version
|
|
52
|
+
|
|
53
|
+
- name: Validate server.json
|
|
54
|
+
run: mcp-publisher validate server.json
|
|
55
|
+
|
|
56
|
+
- name: Publish to MCP Registry (OIDC)
|
|
57
|
+
run: |
|
|
58
|
+
mcp-publisher login github-oidc
|
|
59
|
+
mcp-publisher publish server.json
|
|
60
|
+
# A registry outage must never break the release; re-run from Actions if needed.
|
|
61
|
+
continue-on-error: true
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Daily live smoke
|
|
2
|
+
|
|
3
|
+
# One fixed probe per day: catches fingerprint rot / bot-wall changes
|
|
4
|
+
# before users hit them. Fails visibly on 403/timeout.
|
|
5
|
+
on:
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: "0 6 * * *"
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
smoke:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- name: Install
|
|
19
|
+
run: pip install -e .
|
|
20
|
+
- name: Smoke probe
|
|
21
|
+
run: python tests/smoke_live.py
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mohammad Abbasi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: fernsehserien-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unofficial read-only MCP server for fernsehserien.de — German TV series
|
|
5
|
+
Author: Mohammad Abbasi
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Requires-Dist: httpx>=0.27
|
|
10
|
+
Requires-Dist: mcp<2
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# fernsehserien-mcp 📺
|
|
14
|
+
|
|
15
|
+
mcp-name: io.github.mohammad-abbasi-sh/fernsehserien-mcp
|
|
16
|
+
|
|
17
|
+
Unofficial **read-only** MCP server for **[fernsehserien.de](https://www.fernsehserien.de)** — German TV series from fernsehserien.de (free, no key, no login): search series, series details, episode guides and upcoming air dates. No key, no login.
|
|
18
|
+
|
|
19
|
+
> Built by Mohammad Abbasi as part of the "Germany MCP factory". Not affiliated with fernsehserien.de.
|
|
20
|
+
|
|
21
|
+
## For AI agents
|
|
22
|
+
|
|
23
|
+
Add to your MCP client config (stdio):
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"fernsehserien": {
|
|
29
|
+
"command": "uvx",
|
|
30
|
+
"args": ["fernsehserien-mcp==0.1.0"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or run locally: `python -m fernsehserien_mcp.server` (needs `mcp<2`, `httpx`).
|
|
37
|
+
|
|
38
|
+
## Tools
|
|
39
|
+
|
|
40
|
+
| Tool | Description |
|
|
41
|
+
|------|-------------|
|
|
42
|
+
| `fs_search_series` | Search TV series by name — `query`, `limit` 1..20 |
|
|
43
|
+
| `fs_series_detail` | Series detail page: description, seasons, links to episode guide / air dates / streams — `series` (slug or fernsehserien.de URL) |
|
|
44
|
+
| `fs_episodes` | Episode guide for one season: episode number, title, runtime, airings — `series` (slug or URL), `season` (number), `limit` 1..20 |
|
|
45
|
+
| `fs_air_dates` | Upcoming air dates (Sendetermine) for a series: date/time, channel, episode — `series` (slug or URL), `limit` 1..20 |
|
|
46
|
+
| `fs_health` | Reachability probe (ok / blocked / error) — one polite request |
|
|
47
|
+
|
|
48
|
+
## Development
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python3 -m venv .venv && .venv/bin/pip install "mcp<2" httpx pytest
|
|
52
|
+
.venv/bin/pip install -e .
|
|
53
|
+
.venv/bin/python -m pytest tests/ -q
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
Built by [Mohammad Abbasi](https://github.com/mohammad-abbasi-sh) — [Almanibama](https://almanibama.ir) · [mabbasi.ir](https://mabbasi.ir)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# fernsehserien-mcp 📺
|
|
2
|
+
|
|
3
|
+
mcp-name: io.github.mohammad-abbasi-sh/fernsehserien-mcp
|
|
4
|
+
|
|
5
|
+
Inoffizieller **nur lesender** MCP-Server für **[fernsehserien.de](https://www.fernsehserien.de)** — Deutsche TV-Serien von fernsehserien.de (kostenlos, kein Schlüssel, kein Login): Serien suchen, Seriendetails, Episodenguides und Sendetermine. Kein Schlüssel, keine Anmeldung.
|
|
6
|
+
|
|
7
|
+
> Gebaut von Mohammad Abbasi als Teil der "Germany MCP factory". Nicht mit fernsehserien.de verbunden.
|
|
8
|
+
|
|
9
|
+
## Für KI-Agenten
|
|
10
|
+
|
|
11
|
+
Zur MCP-Client-Konfiguration hinzufügen (stdio):
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"fernsehserien": {
|
|
17
|
+
"command": "uvx",
|
|
18
|
+
"args": ["fernsehserien-mcp==0.1.0"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Oder lokal starten: `python -m fernsehserien_mcp.server` (benötigt `mcp<2`, `httpx`).
|
|
25
|
+
|
|
26
|
+
## Tools
|
|
27
|
+
|
|
28
|
+
| Tool | Beschreibung |
|
|
29
|
+
|------|-------------|
|
|
30
|
+
| `fs_search_series` | TV-Serien nach Namen suchen |
|
|
31
|
+
| `fs_series_detail` | Seriendetails und Staffeln |
|
|
32
|
+
| `fs_episodes` | Episodenguide einer Staffel |
|
|
33
|
+
| `fs_air_dates` | Kommende Sendetermine einer Serie |
|
|
34
|
+
| `fs_health` | Erreichbarkeitsprüfung (ok / blocked / error) — eine höfliche Anfrage |
|
|
35
|
+
|
|
36
|
+
## Entwicklung
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python3 -m venv .venv && .venv/bin/pip install "mcp<2" httpx pytest
|
|
40
|
+
.venv/bin/pip install -e .
|
|
41
|
+
.venv/bin/python -m pytest tests/ -q
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Lizenz
|
|
45
|
+
|
|
46
|
+
MIT
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
Built by [Mohammad Abbasi](https://github.com/mohammad-abbasi-sh) — [Almanibama](https://almanibama.ir) · [mabbasi.ir](https://mabbasi.ir)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# fernsehserien-mcp 📺
|
|
2
|
+
|
|
3
|
+
mcp-name: io.github.mohammad-abbasi-sh/fernsehserien-mcp
|
|
4
|
+
|
|
5
|
+
سرور MCP غیررسمی و **فقطخواندنی** برای **[fernsehserien.de](https://www.fernsehserien.de)** — سریالهای تلویزیونی آلمان از fernsehserien.de (رایگان، بدون کلید): جستوجوی سریال، جزئیات سریال، راهنمای قسمتها و زمانهای پخش آینده. بدون کلید، بدون ورود.
|
|
6
|
+
|
|
7
|
+
> ساختهٔ محمد عباسی، بخشی از «کارخانهٔ MCP آلمان». وابسته به fernsehserien.de نیست.
|
|
8
|
+
|
|
9
|
+
## برای ایجنتهای هوش مصنوعی
|
|
10
|
+
|
|
11
|
+
به پیکربندی MCP کلاینت اضافه کنید (stdio):
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"fernsehserien": {
|
|
17
|
+
"command": "uvx",
|
|
18
|
+
"args": ["fernsehserien-mcp==0.1.0"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
یا بهصورت محلی اجرا کنید: `python -m fernsehserien_mcp.server` (نیازمند `mcp<2` و `httpx`).
|
|
25
|
+
|
|
26
|
+
## ابزارها
|
|
27
|
+
|
|
28
|
+
| ابزار | توضیح |
|
|
29
|
+
|------|-------|
|
|
30
|
+
| `fs_search_series` | جستوجوی سریالهای تلویزیونی بر اساس نام |
|
|
31
|
+
| `fs_series_detail` | جزئیات سریال و فصلها |
|
|
32
|
+
| `fs_episodes` | راهنمای قسمتهای یک فصل |
|
|
33
|
+
| `fs_air_dates` | زمانهای پخش آیندهٔ یک سریال |
|
|
34
|
+
| `fs_health` | بررسی دسترسپذیری (ok / blocked / error) — یک درخواست مؤدبانه |
|
|
35
|
+
|
|
36
|
+
## توسعه
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python3 -m venv .venv && .venv/bin/pip install "mcp<2" httpx pytest
|
|
40
|
+
.venv/bin/pip install -e .
|
|
41
|
+
.venv/bin/python -m pytest tests/ -q
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## لایسنس
|
|
45
|
+
|
|
46
|
+
MIT
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
Built by [Mohammad Abbasi](https://github.com/mohammad-abbasi-sh) — [Almanibama](https://almanibama.ir) · [mabbasi.ir](https://mabbasi.ir)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# fernsehserien-mcp 📺
|
|
2
|
+
|
|
3
|
+
mcp-name: io.github.mohammad-abbasi-sh/fernsehserien-mcp
|
|
4
|
+
|
|
5
|
+
Unofficial **read-only** MCP server for **[fernsehserien.de](https://www.fernsehserien.de)** — German TV series from fernsehserien.de (free, no key, no login): search series, series details, episode guides and upcoming air dates. No key, no login.
|
|
6
|
+
|
|
7
|
+
> Built by Mohammad Abbasi as part of the "Germany MCP factory". Not affiliated with fernsehserien.de.
|
|
8
|
+
|
|
9
|
+
## For AI agents
|
|
10
|
+
|
|
11
|
+
Add to your MCP client config (stdio):
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"fernsehserien": {
|
|
17
|
+
"command": "uvx",
|
|
18
|
+
"args": ["fernsehserien-mcp==0.1.0"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or run locally: `python -m fernsehserien_mcp.server` (needs `mcp<2`, `httpx`).
|
|
25
|
+
|
|
26
|
+
## Tools
|
|
27
|
+
|
|
28
|
+
| Tool | Description |
|
|
29
|
+
|------|-------------|
|
|
30
|
+
| `fs_search_series` | Search TV series by name — `query`, `limit` 1..20 |
|
|
31
|
+
| `fs_series_detail` | Series detail page: description, seasons, links to episode guide / air dates / streams — `series` (slug or fernsehserien.de URL) |
|
|
32
|
+
| `fs_episodes` | Episode guide for one season: episode number, title, runtime, airings — `series` (slug or URL), `season` (number), `limit` 1..20 |
|
|
33
|
+
| `fs_air_dates` | Upcoming air dates (Sendetermine) for a series: date/time, channel, episode — `series` (slug or URL), `limit` 1..20 |
|
|
34
|
+
| `fs_health` | Reachability probe (ok / blocked / error) — one polite request |
|
|
35
|
+
|
|
36
|
+
## Development
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python3 -m venv .venv && .venv/bin/pip install "mcp<2" httpx pytest
|
|
40
|
+
.venv/bin/pip install -e .
|
|
41
|
+
.venv/bin/python -m pytest tests/ -q
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
MIT
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
Built by [Mohammad Abbasi](https://github.com/mohammad-abbasi-sh) — [Almanibama](https://almanibama.ir) · [mabbasi.ir](https://mabbasi.ir)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "fernsehserien-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Unofficial read-only MCP server for fernsehserien.de — German TV series"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"mcp<2",
|
|
14
|
+
"httpx>=0.27",
|
|
15
|
+
]
|
|
16
|
+
authors = [{ name = "Mohammad Abbasi" }]
|
|
17
|
+
|
|
18
|
+
[project.scripts]
|
|
19
|
+
fernsehserien-mcp = "fernsehserien_mcp.server:main"
|
|
20
|
+
|
|
21
|
+
[tool.hatch.build.targets.wheel]
|
|
22
|
+
packages = ["src/fernsehserien_mcp"]
|
|
23
|
+
|
|
24
|
+
[tool.pytest.ini_options]
|
|
25
|
+
markers = ["live: tests that hit the real https://www.fernsehserien.de site"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", "description": "Unofficial read-only MCP server for fernsehserien.de — German TV series.", "name": "io.github.mohammad-abbasi-sh/fernsehserien-mcp", "packages": [{"identifier": "fernsehserien-mcp", "registryBaseUrl": "https://pypi.org", "registryType": "pypi", "transport": {"type": "stdio"}, "version": "0.1.0"}], "repository": {"source": "github", "url": "https://github.com/mohammad-abbasi-sh/fernsehserien-mcp"}, "title": "fernsehserien.de — German TV series: search, details, episodes & air dates", "version": "0.1.0", "websiteUrl": "https://github.com/mohammad-abbasi-sh/fernsehserien-mcp"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""fernsehserien_mcp — unofficial read-only MCP server for fernsehserien.de.
|
|
2
|
+
|
|
3
|
+
German TV series from fernsehserien.de (free, no key, no login): search series, series details, episode guides and upcoming air dates.
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"""Domain logic: shape fernsehserien.de's server-rendered HTML into
|
|
2
|
+
compact dicts (stdlib only, regex parsers).
|
|
3
|
+
|
|
4
|
+
Data source: https://www.fernsehserien.de — free, no key, no login,
|
|
5
|
+
no wall (plain GETs, 200).
|
|
6
|
+
|
|
7
|
+
Pages (verified 2026-11-10):
|
|
8
|
+
- GET /suche/<query> — search results: series rows are
|
|
9
|
+
<li class="ep-hover suchergebnisse-sendung"><a title="<name>"
|
|
10
|
+
href="/<slug>">…<dl><dt><name></dt><dd><abbr
|
|
11
|
+
title="<country>">X</abbr> <years></dd></dl>; films are
|
|
12
|
+
suchergebnisse-film (not returned — this server is series-only).
|
|
13
|
+
No match -> 0 suchergebnisse-sendung rows.
|
|
14
|
+
- GET /<slug> — series page: <title> "<name> – fernsehserien.de",
|
|
15
|
+
meta description = synopsis, season menu links
|
|
16
|
+
/<slug>/episodenguide/staffel-<N>/<series-id>, plus
|
|
17
|
+
/<slug>/sendetermine and /<slug>/streams.
|
|
18
|
+
- GET /<slug>/episodenguide/staffel-<N>/<series-id> — episode
|
|
19
|
+
blocks id="episode-<id>": <a href="/<slug>/folgen/<code>-<title>-<id>">
|
|
20
|
+
<span><abs-no></span>. <span itemprop="name"><title></span></a>,
|
|
21
|
+
"Staffel N (NN Min.)", airings as <ea-angabe> rows:
|
|
22
|
+
<ea-angabe-titel><type></ea-angabe-titel>
|
|
23
|
+
<ea-angabe-datum>Do. 10.09.2026</ea-angabe-datum>
|
|
24
|
+
<ea-angabe-sender><channel></ea-angabe-sender>.
|
|
25
|
+
- GET /<slug>/sendetermine — upcoming air dates, one row per
|
|
26
|
+
BroadcastEvent: <time itemprop="startDate"
|
|
27
|
+
datetime="2026-11-10T20:15:00+01:00">, endDate likewise,
|
|
28
|
+
channel <span itemprop="name" title="<ch>" content="<ch>">,
|
|
29
|
+
episode code <span class="…sendetermine-2019-staffel-und-episode">
|
|
30
|
+
2.05</span>, title <span class="…episodentitel">Episode 5</span>,
|
|
31
|
+
episode link on the row's <a href="/<slug>/folgen/…">.
|
|
32
|
+
|
|
33
|
+
No site-wide "tonight on TV" programme exists on fernsehserien.de
|
|
34
|
+
(no /tv-programm section — the programme lives on sister sites);
|
|
35
|
+
tonight_tv / channel_schedule from the research draft are therefore
|
|
36
|
+
NOT built — per-series Sendetermine is the real data.
|
|
37
|
+
"""
|
|
38
|
+
from __future__ import annotations
|
|
39
|
+
|
|
40
|
+
import html as _html
|
|
41
|
+
import re
|
|
42
|
+
from urllib.parse import quote
|
|
43
|
+
|
|
44
|
+
BASE = "https://www.fernsehserien.de"
|
|
45
|
+
|
|
46
|
+
_SEARCH_RE = re.compile(
|
|
47
|
+
r'<li class="ep-hover suchergebnisse-sendung">.*?</li>', re.S)
|
|
48
|
+
_SEARCH_LINK_RE = re.compile(
|
|
49
|
+
r'<a[^>]+title="([^"]+)" href="(/[^"]+)"')
|
|
50
|
+
_SEARCH_DT_RE = re.compile(r'<dt>(.*?)</dt>', re.S)
|
|
51
|
+
_SEARCH_DD_RE = re.compile(r'<dd>(.*?)</dd>', re.S)
|
|
52
|
+
|
|
53
|
+
_SEASON_RE = re.compile(
|
|
54
|
+
r'href="(/[^"/]+/episodenguide/staffel-(\d+)/(\d+))"')
|
|
55
|
+
|
|
56
|
+
_EPISODE_RE = re.compile(
|
|
57
|
+
r'id="episode-(\d+)"[^>]*>\s*<a[^>]+href="(/[^"/]+/folgen/([^"]+))"'
|
|
58
|
+
r'[^>]*>\s*<span>(\d+)</span>\.\s*<span itemprop="name">([^<]+)</span>',
|
|
59
|
+
re.S)
|
|
60
|
+
_EP_RUNTIME_RE = re.compile(r'Staffel \d+ \((\d+)(?: |\s)*Min\.\)')
|
|
61
|
+
_EP_AIRING_RE = re.compile(
|
|
62
|
+
r'<ea-angabe-titel>([^<]+)</ea-angabe-titel>\s*'
|
|
63
|
+
r'<ea-angabe-datum>([^<]+)</ea-angabe-datum>\s*'
|
|
64
|
+
r'<ea-angabe-sender>([^<]+)</ea-angabe-sender>')
|
|
65
|
+
|
|
66
|
+
_AIR_ROW_RE = re.compile(
|
|
67
|
+
r'<a[^>]+href="(/[^"/]+/folgen/[^"]+)"[^>]*>.*?'
|
|
68
|
+
r'<time itemprop="startDate" datetime="([^"]+)">.*?'
|
|
69
|
+
r'<time itemprop="endDate" datetime="([^"]+)">.*?'
|
|
70
|
+
r'itemprop="name" title="([^"]+)" content="([^"]+)".*?'
|
|
71
|
+
r'sendetermine-2019-staffel-und-episode">([^<]+)</span>.*?'
|
|
72
|
+
r'sendetermine-2019-episodentitel">([^<]+)</span>',
|
|
73
|
+
re.S)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def validate_query(query: str) -> str:
|
|
77
|
+
q = (query or "").strip()
|
|
78
|
+
if not q:
|
|
79
|
+
raise ValueError("query must not be empty")
|
|
80
|
+
if len(q) > 100:
|
|
81
|
+
raise ValueError("query too long (max 100 characters)")
|
|
82
|
+
return q
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def validate_limit(limit: int, maximum: int = 20) -> int:
|
|
86
|
+
if not 1 <= limit <= maximum:
|
|
87
|
+
raise ValueError(
|
|
88
|
+
f"limit out of range: {limit} (expected 1..{maximum})")
|
|
89
|
+
return limit
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def validate_season(season: int) -> int:
|
|
93
|
+
if not 1 <= season <= 99:
|
|
94
|
+
raise ValueError(
|
|
95
|
+
f"season out of range: {season} (expected 1..99)")
|
|
96
|
+
return season
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def search_url(query: str) -> str:
|
|
100
|
+
q = query.replace("/", " ").replace("?", " ")
|
|
101
|
+
return f"{BASE}/suche/{quote(q)}"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def resolve_series(series: str) -> str:
|
|
105
|
+
"""Slug or fernsehserien.de URL -> slug (first path segment)."""
|
|
106
|
+
s = (series or "").strip().strip("/")
|
|
107
|
+
if not s:
|
|
108
|
+
raise ValueError("series must not be empty")
|
|
109
|
+
if s.startswith("http"):
|
|
110
|
+
if "fernsehserien.de/" not in s:
|
|
111
|
+
raise ValueError(
|
|
112
|
+
"series URL must be a fernsehserien.de series URL")
|
|
113
|
+
s = s.split("fernsehserien.de/", 1)[1].strip("/")
|
|
114
|
+
slug = s.split("/")[0]
|
|
115
|
+
if not re.match(r"^[a-z0-9][a-z0-9-]*$", slug):
|
|
116
|
+
raise ValueError(f"invalid series slug: {slug!r}")
|
|
117
|
+
return slug
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _clean(text: str) -> str:
|
|
121
|
+
return _html.unescape(re.sub(r"<[^>]+>", "", text)).replace(
|
|
122
|
+
"\xa0", " ").strip()
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def parse_search_results(page_html: str) -> list[dict]:
|
|
126
|
+
out: list[dict] = []
|
|
127
|
+
for m in _SEARCH_RE.finditer(page_html):
|
|
128
|
+
chunk = m.group(0)
|
|
129
|
+
link = _SEARCH_LINK_RE.search(chunk)
|
|
130
|
+
dt = _SEARCH_DT_RE.search(chunk)
|
|
131
|
+
dd = _SEARCH_DD_RE.search(chunk)
|
|
132
|
+
if not link:
|
|
133
|
+
continue
|
|
134
|
+
out.append({
|
|
135
|
+
"name": _clean(dt.group(1)) if dt else link.group(1),
|
|
136
|
+
"url": BASE + link.group(2),
|
|
137
|
+
"info": _clean(dd.group(1)) if dd else None,
|
|
138
|
+
})
|
|
139
|
+
return out
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def parse_series_detail(page_html: str, slug: str) -> dict:
|
|
143
|
+
title_m = re.search(r"<title>(.*?)</title>", page_html, re.S)
|
|
144
|
+
desc_m = re.search(
|
|
145
|
+
r'<meta name="description" content="([^"]+)"', page_html)
|
|
146
|
+
title = _clean(title_m.group(1)) if title_m else slug
|
|
147
|
+
title = re.sub(r"\s*– fernsehserien\.de\s*$", "", title)
|
|
148
|
+
seasons: list[dict] = []
|
|
149
|
+
seen: set[int] = set()
|
|
150
|
+
for m in _SEASON_RE.finditer(page_html):
|
|
151
|
+
n = int(m.group(2))
|
|
152
|
+
if n in seen:
|
|
153
|
+
continue
|
|
154
|
+
seen.add(n)
|
|
155
|
+
seasons.append({"season": n, "url": BASE + m.group(1),
|
|
156
|
+
"series_id": m.group(3)})
|
|
157
|
+
seasons.sort(key=lambda s: s["season"])
|
|
158
|
+
return {
|
|
159
|
+
"slug": slug,
|
|
160
|
+
"name": title,
|
|
161
|
+
"url": f"{BASE}/{slug}",
|
|
162
|
+
"description": (_html.unescape(desc_m.group(1)).strip()
|
|
163
|
+
if desc_m else None),
|
|
164
|
+
"seasons": seasons,
|
|
165
|
+
"air_dates_url": f"{BASE}/{slug}/sendetermine",
|
|
166
|
+
"streams_url": f"{BASE}/{slug}/streams",
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def season_guide_url(detail: dict, season: int) -> str:
|
|
171
|
+
for s in detail["seasons"]:
|
|
172
|
+
if s["season"] == season:
|
|
173
|
+
return s["url"]
|
|
174
|
+
raise ValueError(
|
|
175
|
+
f"season {season} not found for {detail['slug']} "
|
|
176
|
+
f"(available: {[s['season'] for s in detail['seasons']]})")
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def parse_episodes(page_html: str) -> list[dict]:
|
|
180
|
+
out: list[dict] = []
|
|
181
|
+
for m in _EPISODE_RE.finditer(page_html):
|
|
182
|
+
chunk = page_html[m.start():m.start() + 9000]
|
|
183
|
+
runtime_m = _EP_RUNTIME_RE.search(chunk)
|
|
184
|
+
airings = [{
|
|
185
|
+
"type": _clean(a.group(1)),
|
|
186
|
+
"date": _clean(a.group(2)),
|
|
187
|
+
"channel": _clean(a.group(3)),
|
|
188
|
+
} for a in _EP_AIRING_RE.finditer(chunk)]
|
|
189
|
+
out.append({
|
|
190
|
+
"episode_id": m.group(1),
|
|
191
|
+
"url": BASE + m.group(2),
|
|
192
|
+
"code": m.group(3).split("-")[0],
|
|
193
|
+
"absolute_number": int(m.group(4)),
|
|
194
|
+
"title": _clean(m.group(5)),
|
|
195
|
+
"runtime_minutes": (int(runtime_m.group(1))
|
|
196
|
+
if runtime_m else None),
|
|
197
|
+
"airings": airings,
|
|
198
|
+
})
|
|
199
|
+
return out
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def parse_air_dates(page_html: str) -> list[dict]:
|
|
203
|
+
out: list[dict] = []
|
|
204
|
+
for m in _AIR_ROW_RE.finditer(page_html):
|
|
205
|
+
out.append({
|
|
206
|
+
"starts": m.group(2),
|
|
207
|
+
"ends": m.group(3),
|
|
208
|
+
"channel": m.group(4),
|
|
209
|
+
"episode_code": _clean(m.group(6)),
|
|
210
|
+
"episode_title": _clean(m.group(7)),
|
|
211
|
+
"episode_url": BASE + m.group(1),
|
|
212
|
+
})
|
|
213
|
+
return out
|