Add ITVX module, transparent mitm_hosts, and DM Telegram announces.
All checks were successful
release / build-and-upload (push) Successful in 6m21s

Wire module mitm_hosts into StartTransparent for ITVX capture, ship the
itv provider stub with Live-list autoplay, refresh the README, and send
Forgejo release announces to private chat 7314901602.
This commit is contained in:
404errordeveloper 2026-10-09 17:35:53 +02:00
parent 3cb259c9b6
commit 2e43e6c3fa
23 changed files with 996 additions and 84 deletions

View file

@ -54,6 +54,7 @@ jobs:
| `bbc.zip` | BBC iPlayer CLI + `module.yaml` (universal) |
| `rte.zip` | RTÉ Player CLI + `module.yaml` template |
| `tg4.zip` | TG4 CLI + `module.yaml` template |
| `itv.zip` | ITVX CLI stub + `module.yaml` template |
| `SHA256SUMS-modules.txt` | Checksums |
Unpack each zip into `modules/<name>/` (e.g. `bbc.zip` → `modules/bbc/`).
@ -65,14 +66,18 @@ jobs:
- name: Announce on Telegram
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
# Private DM chat (@error404developer). Override via secret if needed.
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
RELEASE_TAG: ${{ github.ref_name }}
RELEASE_KIND: modules
RELEASE_URL: https://git.nulldrm.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}
run: |
if [ -z "$TELEGRAM_BOT_TOKEN" ] || [ -z "$TELEGRAM_CHAT_ID" ]; then
echo "[!] TELEGRAM_BOT_TOKEN / TELEGRAM_CHAT_ID secrets missing — skip announce"
if [ -z "$TELEGRAM_BOT_TOKEN" ]; then
echo "[!] TELEGRAM_BOT_TOKEN secret missing — skip announce"
exit 0
fi
# Release announces go to the maintainer DM (not the public group topic).
export TELEGRAM_CHAT_ID="7314901602"
unset TELEGRAM_MESSAGE_THREAD_ID || true
chmod +x scripts/notify-telegram.sh
./scripts/notify-telegram.sh "${{ github.ref_name }}"

View file

@ -71,14 +71,18 @@ jobs:
- name: Announce on Telegram
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
# Private DM chat (@error404developer). Override via secret if needed.
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
RELEASE_TAG: ${{ github.ref_name }}
RELEASE_KIND: host
RELEASE_URL: https://git.nulldrm.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}
run: |
if [ -z "$TELEGRAM_BOT_TOKEN" ] || [ -z "$TELEGRAM_CHAT_ID" ]; then
echo "[!] TELEGRAM_BOT_TOKEN / TELEGRAM_CHAT_ID secrets missing — skip announce"
if [ -z "$TELEGRAM_BOT_TOKEN" ]; then
echo "[!] TELEGRAM_BOT_TOKEN secret missing — skip announce"
exit 0
fi
# Release announces go to the maintainer DM (not the public group topic).
export TELEGRAM_CHAT_ID="7314901602"
unset TELEGRAM_MESSAGE_THREAD_ID || true
chmod +x scripts/notify-telegram.sh
./scripts/notify-telegram.sh "${{ github.ref_name }}"

112
README.md
View file

@ -1,70 +1,92 @@
# Null DRM
# 🔓 Null DRM
Capture live sessions from Android streaming apps (BBC iPlayer, RTÉ, TG4, …) and
restream them. The host is a single binary — **`drm`** — plus drop-in providers
under **`modules/`**.
**Next-generation open-source DRM decryption for Android streaming apps.**
Releases: [git.nulldrm.com](https://git.nulldrm.com/nulldrm/Null-DRM-Official/releases)
Docs: [docs/](docs/)
Capture live sessions from phones (BBC iPlayer, RTÉ, TG4, ITVX, …), pull manifests
and licenses through a transparent MITM, and restream. One host binary — **`drm`** —
plus drop-in providers under **`modules/`**.
📦 Releases: [git.nulldrm.com](https://git.nulldrm.com/nulldrm/Null-DRM-Official/releases)
📚 Docs: [docs/](docs/)
---
## Quick start (binaries)
## ✨ What it does
### 1. Download
Each provider is a **module** that can launch the app, auto-play a channel like a
user would, and capture the stream metadata over HTTPS MITM. When a module does
not exist yet, you can still run discover / transparent capture and inspect raw
traffic.
From the latest **`v*`** release, grab your host binary (e.g. `drm-windows-amd64.exe`)
and `proxy-android-arm64`. From a **`modules-v*`** release, grab the module zips you need
(`bbc.zip`, `rte.zip`, `tg4.zip`).
| Module | App | Notes |
|--------|-----|--------|
| 📺 `bbc` | BBC iPlayer | Transparent MITM; UK VPN on phone |
| 🇮🇪 `rte` | RTÉ Player | Irish egress; ModularDRM keys |
| 🟢 `tg4` | TG4 | Catalog + phone capture |
| 🟣 `itv` | ITVX | Transparent MITM; UK VPN; Live list autoplay |
---
## 🚀 Quick start
### 1️⃣ Download
From the latest **`v*`** release grab your host binary (e.g. `drm-windows-amd64.exe`)
and `proxy-android-arm64`. From a **`modules-v*`** release grab the zips you need
(`bbc.zip`, `rte.zip`, `tg4.zip`, `itv.zip`).
```text
Null-DRM/
drm.exe # or drm on Linux/macOS
drm.exe # or ./drm on Linux/macOS
bin/proxy-android-arm64 # optional; also embedded in release drm
modules/
bbc/ # unzip bbc.zip here
rte/
tg4/
itv/
data/ # your .wvd, optional
outputs/ # created on first run
```
On first run, `drm` creates the install scaffold next to the exe.
### 2. Prerequisites
### 2️⃣ Prerequisites
| Need | Why |
|---|---|
| **adb** on `PATH` | phone capture |
| Rooted Android (Magisk) | system CA for HTTPS MITM |
| **`.wvd`** in `data/` | Widevine keys (RTE/TG4; BBC mobile streams are clear) |
| Python 3.10+ + `.venv` | only if you fetch keys with `wvkey.py` |
|------|-----|
| 📱 **adb** on `PATH` | phone capture |
| 🔐 Rooted Android (Magisk) | system CA for HTTPS MITM |
| 🔑 **`.wvd`** in `data/` | Widevine keys (RTE/TG4/ITV; BBC mobile is often clear) |
| 🐍 Python 3.10+ + `.venv` | only if you fetch keys with `wvkey.py` |
### 3. Install a provider
### 3️⃣ Install a provider
Unzip into `modules/<name>/`. Edit **`module.yaml`** — fill sensitive fields only
(RTE license URL / KIDs; TG4 account + policy key + video ids). BBC needs almost
nothing extra.
(RTE license URL / KIDs; TG4 account + policy key + video ids). BBC / ITVX need
almost nothing extra.
```bash
drm modules
# or: drm --modules-dir D:\mods modules
```
### 4. Phone CA (once per device / CA)
### 4️⃣ Phone CA (once per device / CA)
```bash
drm proxy install-ca --reinject
adb shell am force-stop bbc.iplayer.android # or the app you will capture
```
### 5. Capture
### 5️⃣ Capture
```bash
# BBC + NordVPN UK on the phone (transparent MITM; --channel auto-plays)
drm capture --app bbc --channel bbcone --wait 120
drm capture --app bbc --channel s4c --wait 120
# ITVX (UK VPN; Live tab autoplay)
drm capture --app itv --channel itv1 --wait 90
# RTE / TG4 (keys via --wvd when needed)
drm capture --app rte --channel rteone --wvd data/device.wvd
drm capture --app tg4 --channel ioi --wvd data/device.wvd
@ -73,9 +95,9 @@ drm capture --app tg4 --channel ioi --wvd data/device.wvd
drm catalog --app tg4 --channel ioi --keys --wvd data/device.wvd --json
```
Results: `outputs/<app>/<stamp>/` (and `latest/`).
📁 Results land in `outputs/<app>/<stamp>/` (and `latest/`).
### 6. Clean the phone after a run
### 6️⃣ Clean the phone after a run
```bash
drm proxy reset
@ -85,7 +107,7 @@ Stops MITM/iptables and deletes pushed CA/binaries so the next capture starts fr
---
## Command cheat sheet
## 🧾 Command cheat sheet
```text
drm [--modules-dir DIR] <command> …
@ -94,30 +116,31 @@ drm modules
drm capture --app NAME [--channel ID] [--wait N] [--wvd PATH] [--serial S]
drm catalog --app NAME --channel ID [--keys] [--wvd PATH] [--json] [--list]
drm proxy install-ca [--reinject] | reset [--keep-captures]
| transparent --package PKG | start | stop | push | discover | pull
| transparent --package PKG [--mitm-host HOST]
| start | stop | push | discover | pull
drm serve [--bind …] [--data …] [--token …]
drm agent run|status|devices|enqueue|cancel [--config …]
```
Global: `--modules-dir DIR` or `$DRM_MODULES_DIR` (default: `./modules`).
🌍 Global: `--modules-dir DIR` or `$DRM_MODULES_DIR` (default: `./modules`).
`--channel` implies interactive auto-play (Explore → channel → Watch live for BBC).
🎯 `--channel` implies interactive auto-play (provider-specific Live UI flow).
---
## Config: publish vs local
## ⚙️ Config: publish vs local
| File | In git / zips? | Purpose |
|---|---|---|
|------|----------------|---------|
| `module-publish.yaml` | git only | Universal package, channels, UI |
| `module.yaml` | zips yes / git no | Secrets + overlays; release zips ship publish renamed |
Release module assets are `bbc.zip` / `rte.zip` / `tg4.zip` with `module.yaml` only
(no `module-publish.yaml` inside the zip).
Release module assets are `bbc.zip` / `rte.zip` / `tg4.zip` / `itv.zip` with
`module.yaml` only (no `module-publish.yaml` inside the zip).
---
## Building from source (optional)
## 🛠️ Building from source *(optional)*
```bash
git clone https://git.nulldrm.com/nulldrm/Null-DRM-Official.git
@ -127,10 +150,25 @@ go -C apps/cli build -o ../../bin/drm.exe . # Windows
# Modules: .\scripts\build-modules-release.ps1 -Version modules-v0.1.1
```
More detail: [docs/quickstart.md](docs/quickstart.md), [docs/architecture.md](docs/architecture.md),
[docs/providers/bbc.md](docs/providers/bbc.md).
More detail: [docs/quickstart.md](docs/quickstart.md) · [docs/architecture.md](docs/architecture.md) · [docs/providers/bbc.md](docs/providers/bbc.md)
## Scope
---
## 💚 Support the project
If Null DRM saves you time, donations keep development going:
| Coin | Address |
|------|---------|
| ⟠ **ETH** | `0xa6314ce4deaa8329abba301802e3f511b3fa80a6` |
| Ł **LTC** | `ltc1qpm26uccjgn4gx5pqxwzvs89mdp9hcshx9xj5a6` |
| ₿ **BTC** | `bc1qzr70ur76jhm5gjsuqelzqaskumpkhkk2ewjgha` |
Thank you 🙏
---
## ⚖️ Scope
Only for services you are authorised to access, with content you have the right
to decrypt.

116
apps/modules/itv/config.go Normal file
View file

@ -0,0 +1,116 @@
package itv
import (
"time"
"drmdecryption/modcfg"
"drmdecryption/modules/provider"
)
// Name is the module id (--app itv).
const Name = "itv"
// Channel is one live ITVX target.
type Channel struct {
Label string `yaml:"label"`
ChipDesc []string `yaml:"chip_desc"`
PlayDesc []string `yaml:"play_desc"`
}
// Config is modules/itv/module.yaml (preferred) or apps/modules/itv/module.yaml.
type Config struct {
provider.Common `yaml:",inline"`
Channels map[string]Channel `yaml:"channels"`
Timeouts Timeouts `yaml:"timeouts"`
UI UI `yaml:"ui"`
}
type Timeouts struct {
LaunchWaitUI provider.Duration `yaml:"launch_wait_ui"`
LaunchSettle provider.Duration `yaml:"launch_settle"`
LiveNav provider.Duration `yaml:"live_nav"`
ChannelFind provider.Duration `yaml:"channel_find"`
AfterChannel provider.Duration `yaml:"after_channel"`
WatchLive provider.Duration `yaml:"watch_live"`
Playback provider.Duration `yaml:"playback"`
}
type UI struct {
LaunchDescContains []string `yaml:"launch_desc_contains"`
LiveTab []string `yaml:"live_tab"`
LiveTabDescRE []string `yaml:"live_tab_desc_re"`
LiveTabTextRE []string `yaml:"live_tab_text_re"`
WatchLive []string `yaml:"watch_live"`
PlaybackDescContains []string `yaml:"playback_desc_contains"`
ChannelScrollMax int `yaml:"channel_scroll_max"`
}
func (c Config) withDefaults() Config {
t := &c.Timeouts
t.LaunchWaitUI = provider.Duration(t.LaunchWaitUI.D(30 * time.Second))
t.LaunchSettle = provider.Duration(t.LaunchSettle.D(5 * time.Second))
t.LiveNav = provider.Duration(t.LiveNav.D(20 * time.Second))
t.ChannelFind = provider.Duration(t.ChannelFind.D(45 * time.Second))
t.AfterChannel = provider.Duration(t.AfterChannel.D(3 * time.Second))
t.WatchLive = provider.Duration(t.WatchLive.D(20 * time.Second))
t.Playback = provider.Duration(t.Playback.D(60 * time.Second))
u := &c.UI
if len(u.LaunchDescContains) == 0 {
u.LaunchDescContains = []string{"Home", "Live", "Categories", "My List", "ITVX"}
}
if len(u.LiveTab) == 0 {
u.LiveTab = []string{"Lyve", "Live"}
}
if len(u.LiveTabDescRE) == 0 {
u.LiveTabDescRE = []string{"^Lyve$"}
}
if len(u.LiveTabTextRE) == 0 {
u.LiveTabTextRE = []string{"^Live$"}
}
if len(u.WatchLive) == 0 {
u.WatchLive = []string{"WATCH LIVE", "Watch live", "Watch Live"}
}
if len(u.PlaybackDescContains) == 0 {
u.PlaybackDescContains = []string{"Pause", "pause", "Seek", "Player"}
}
if u.ChannelScrollMax <= 0 {
u.ChannelScrollMax = 12
}
if c.Package == "" {
c.Package = "air.ITVMobilePlayer"
}
if c.Channels == nil {
c.Channels = map[string]Channel{}
}
return c
}
func loadConfig() (Config, modcfg.Result, error) {
var cfg Config
res, err := modcfg.Load(Name, &cfg)
if err != nil {
return cfg, res, err
}
cfg = cfg.withDefaults()
if v := modcfg.Env(Name, "package"); v != "" {
cfg.Package = v
}
if flags.packageName != "" {
cfg.Package = flags.packageName
}
if flags.caHash != "" {
cfg.CAHash = flags.caHash
}
if flags.proxyBin != "" {
cfg.ProxyBin = flags.proxyBin
}
return cfg, res, nil
}
var flags struct {
packageName string
caHash string
proxyBin string
}

124
apps/modules/itv/itv.go Normal file
View file

@ -0,0 +1,124 @@
// Package itv is a stub ITVX provider module.
// Launch works; AutoPlay opens the Live tab and taps a channel chip when
// content-desc matches. Capture scoring targets ITV CDN / license hosts.
// Full Live navigation and catalog may need tuning against a UK-geo session.
package itv
import (
"flag"
"fmt"
"os"
"time"
"drmdecryption/adb"
appreg "drmdecryption/app"
"drmdecryption/capture"
"drmdecryption/modules/provider"
"drmdecryption/mpd"
"drmdecryption/uiflow"
)
func init() {
appreg.Register(Name, New)
appreg.RegisterFlags(bindFlags)
}
func bindFlags(fs *flag.FlagSet) {
fs.StringVar(&flags.packageName, Name+".package", "", "override "+Name+" android package id")
fs.StringVar(&flags.caHash, Name+".ca-hash", "", "override "+Name+" MITM CA subject hash")
fs.StringVar(&flags.proxyBin, Name+".proxy-bin", "", "override "+Name+" on-device MITM binary")
}
// App is the ITVX plugin.
type App struct {
*provider.Base
cfg Config
}
// New constructs the plugin from module.yaml + flags + env.
func New() (appreg.App, error) {
cfg, res, err := loadConfig()
if err != nil {
return nil, err
}
labels := make(map[string]string, len(cfg.Channels))
for id, ch := range cfg.Channels {
labels[id] = ch.Label
}
return &App{Base: provider.New(Name, cfg.Common, labels, res), cfg: cfg}, nil
}
// KeyMode: ITVX live typically uses a raw Widevine license response.
func (a *App) KeyMode() string { return "raw" }
// CaptureHints: transparent MITM yields the DAR MPD URL (+ Irdeto license_url).
// PSSH is often absent from the outer YoSpace/CSM MPD; require mpd only for now.
func (a *App) CaptureHints() capture.Hints {
return a.Hints("mpd")
}
// UseTransparentMITM: UK VPN on-device conflicts with Wi‑Fi http_proxy.
func (a *App) UseTransparentMITM() bool { return true }
// MPDRewriter: passthrough until a DAI rewriter is needed.
func (a *App) MPDRewriter() mpd.Rewriter { return mpd.Passthrough{} }
func (a *App) Channels() []appreg.Channel {
out := make([]appreg.Channel, 0, len(a.cfg.Channels))
for _, id := range a.ChannelIDs() {
out = append(out, appreg.Channel{ID: id, Label: a.Label(id)})
}
return out
}
// Launch cold-starts ITVX.
func (a *App) Launch(c *adb.Client) error {
c.EnsureAwake()
fmt.Printf("[*] Launching %s (%s)…\n", Name, a.Package())
c.ForceStop(a.Package())
time.Sleep(400 * time.Millisecond)
if err := uiflow.MonkeyLaunch(c, a.Package()); err != nil {
return err
}
time.Sleep(time.Duration(a.cfg.Timeouts.LaunchSettle))
c.DismissShadeIfFocused()
if err := uiflow.WaitUI(c, a.CacheDir(), uiflow.Match{
DescContains: a.cfg.UI.LaunchDescContains,
}, time.Duration(a.cfg.Timeouts.LaunchWaitUI)); err != nil {
fmt.Fprintf(os.Stderr, "[!] launch UI wait: %v — continue and play manually\n", err)
}
return nil
}
// AutoPlay opens Live, scrolls to the channel row, and taps WATCH LIVE.
// Failures return an error so batch capture can report which channel broke.
func (a *App) AutoPlay(c *adb.Client, channel string) error {
id, err := a.Resolve(channel)
if err != nil {
return err
}
ch := a.cfg.Channels[id]
fmt.Printf("[*] Auto-play %s…\n", a.Label(id))
c.DismissShadeIfFocused()
if err := a.openLiveTab(c); err != nil {
return fmt.Errorf("Live tab: %w", err)
}
if err := a.tapChipThenPlay(c, ch); err != nil {
return fmt.Errorf("channel play %s: %w", a.Label(id), err)
}
return uiflow.WaitPlayback(c, a.CacheDir(), a.Package(), uiflow.PlaybackOpts{
Timeout: time.Duration(a.cfg.Timeouts.Playback),
SoftFail: true,
OrDescContains: []string{
"on full screen",
"Unmute",
},
})
}
func (a *App) VideoSelect() string { return "for=best" }
func (a *App) AudioSelect() string { return "for=best" }
func (a *App) RewriterName() string { return "none" }
func (a *App) LiveWaitSeconds() int { return 2 }
func (a *App) TSReadyBytes() int64 { return 256 << 10 }

View file

@ -0,0 +1,90 @@
# ITVX — published universal values (renamed to module.yaml in release zips).
# Fill secrets in local module.yaml: license_url, origins, kids (never commit that file).
# Stub: Live UI matchers are best-effort; tune after a UK-geo phone session.
package: air.ITVMobilePlayer
proxy_bin: bin/proxy-android-arm64
# SENSITIVE — set in local module.yaml:
# license_url: "https://…"
# Transparent mode only MITMs open.live by default. Force decrypt of ITVX
# playlist / license / simulcast hosts observed in phone traffic (suffix match).
# Segment CDNs (akamai.content) stay passthrough so playback is less likely to break.
mitm_hosts:
- play.dar.itv.com
- itvpnp.live.ott.irdeto.com
- simulcast.itv.com
- secure.pes.itv.com
- cpt.itv.com
- tom.itv.com
score:
hosts:
- play.dar.itv.com
- itvpnp.live.ott.irdeto.com
- simulcast.itv.com
- content.itv.com
- itv.com
- itvstatic.com
- irdeto.com
deny:
- google-analytics
- googletagmanager
- doubleclick
- scorecardresearch
- facebook.com
- crashlytics
- launchdarkly
- 2cnt.net
- appsflyer
aliases:
one: itv1
itv: itv1
two: itv2
three: itv3
four: itv4
be: itvbe
citv: itvxkids
channels:
itv1:
label: ITV1
# Live list rows: "Expand ITV1 info button" / "Collapse ITV1 info button"
chip_desc: ["(?i)(Expand|Collapse)\\s+ITV1\\s+info button"]
play_desc: ["(?i)^WATCH LIVE$", "(?i)Watch\\s+ITV1\\s+on full screen"]
itv2:
label: ITV2
chip_desc: ["(?i)(Expand|Collapse)\\s+ITV2\\s+info button"]
play_desc: ["(?i)^WATCH LIVE$", "(?i)Watch\\s+ITV2\\s+on full screen"]
itv3:
label: ITV3
chip_desc: ["(?i)(Expand|Collapse)\\s+ITV3\\s+info button"]
play_desc: ["(?i)^WATCH LIVE$", "(?i)Watch\\s+ITV3\\s+on full screen"]
itv4:
label: ITV4
chip_desc: ["(?i)(Expand|Collapse)\\s+ITV4\\s+info button"]
play_desc: ["(?i)^WATCH LIVE$", "(?i)Watch\\s+ITV4\\s+on full screen"]
itvbe:
label: ITVBe
chip_desc: ["(?i)(Expand|Collapse)\\s+ITVBe\\s+info button"]
play_desc: ["(?i)^WATCH LIVE$", "(?i)Watch\\s+ITVBe\\s+on full screen"]
ui:
launch_desc_contains: ["Home", "Lyve", "Live", "Categories", "ITVX"]
live_tab: ["Lyve", "Live"]
live_tab_desc_re: ["^Lyve$"]
live_tab_text_re: ["^Live$"]
watch_live: ["WATCH LIVE", "Watch live", "Watch Live"]
playback_desc_contains: ["Unmute", "on full screen", "Pause"]
channel_scroll_max: 14
timeouts:
launch_wait_ui: 30s
launch_settle: 5s
live_nav: 20s
channel_find: 45s
after_channel: 3s
watch_live: 20s
playback: 60s

153
apps/modules/itv/steps.go Normal file
View file

@ -0,0 +1,153 @@
package itv
import (
"fmt"
"regexp"
"strings"
"time"
"drmdecryption/adb"
"drmdecryption/uiflow"
)
// openLiveTab taps bottom-nav Live. Accessibility desc is obfuscated as "Lyve";
// the visible label is still "Live". Prefer the nav item over "Space Live" rows.
func (a *App) openLiveTab(c *adb.Client) error {
c.DismissShadeIfFocused()
if nodes, err := c.DumpUI(a.CacheDir()); err == nil && a.onLiveTab(nodes) {
fmt.Println("[*] already on Live tab")
return nil
}
fmt.Println("[*] open Live tab…")
descRE := a.cfg.UI.LiveTabDescRE
if len(descRE) == 0 {
descRE = []string{"^Lyve$"}
}
textRE := a.cfg.UI.LiveTabTextRE
if len(textRE) == 0 {
textRE = []string{"^Live$"}
}
if err := uiflow.TapUI(c, a.CacheDir(), uiflow.Match{
DescRE: descRE,
TextRE: textRE,
Pick: uiflow.PickFirst,
}, time.Duration(a.cfg.Timeouts.LiveNav)); err != nil {
// Fallback: substring match from publish YAML.
if err2 := uiflow.TapUI(c, a.CacheDir(), uiflow.Match{
DescContains: a.cfg.UI.LiveTab,
TextContains: a.cfg.UI.LiveTab,
Pick: uiflow.PickFirst,
}, 8*time.Second); err2 != nil {
return fmt.Errorf("live tab: %w", err)
}
}
time.Sleep(1500 * time.Millisecond)
deadline := time.Now().Add(time.Duration(a.cfg.Timeouts.LiveNav))
for time.Now().Before(deadline) {
nodes, err := c.DumpUI(a.CacheDir())
if err == nil && a.onLiveTab(nodes) {
fmt.Println("[*] Live tab ready")
return nil
}
time.Sleep(700 * time.Millisecond)
}
return fmt.Errorf("Live tab did not open")
}
func (a *App) onLiveTab(nodes []adb.Node) bool {
for _, n := range nodes {
d := strings.ToLower(n.Desc)
if strings.HasPrefix(d, "expand ") && strings.Contains(d, " info button") {
return true
}
if strings.HasPrefix(d, "collapse ") && strings.Contains(d, " info button") {
return true
}
if strings.HasPrefix(d, "watch ") && strings.Contains(d, " on full screen") {
return true
}
}
return false
}
// tapChipThenPlay scrolls the Live channel list for Expand/Collapse {label}
// info button, taps the row, then taps WATCH LIVE / Watch {label} on full screen.
func (a *App) tapChipThenPlay(c *adb.Client, ch Channel) error {
pats := ch.ChipDesc
if len(pats) == 0 {
pats = []string{`(?i)(Expand|Collapse)\s+` + regexp.QuoteMeta(ch.Label) + `\s+info button`}
}
chipRE := uiflow.CompileRes(pats)
fmt.Printf("[*] find Live row for %s…\n", ch.Label)
row, err := a.findChannelRow(c, chipRE)
if err != nil {
return err
}
// Chevron nodes are often not clickable; tap mid-row to the left of the button.
x := 540
if row.X1 > 0 && row.X1 < 400 {
x = row.CX()
}
y := row.CY()
fmt.Printf("[*] tap channel row %q @ %d,%d\n", row.Desc, x, y)
if err := c.Tap(x, y); err != nil {
return err
}
time.Sleep(time.Duration(a.cfg.Timeouts.AfterChannel))
playRE := ch.PlayDesc
if len(playRE) == 0 {
playRE = []string{
`(?i)^WATCH LIVE$`,
`(?i)^Watch\s+` + regexp.QuoteMeta(ch.Label) + `\s+on full screen$`,
}
}
fmt.Println("[*] tap Watch live…")
// Prefer the list "WATCH LIVE" text button for the selected row.
if err := uiflow.TapUI(c, a.CacheDir(), uiflow.Match{
TextRE: playRE,
DescRE: playRE,
Pick: uiflow.PickFirst,
}, time.Duration(a.cfg.Timeouts.WatchLive)); err != nil {
return fmt.Errorf("watch live: %w", err)
}
return nil
}
func (a *App) findChannelRow(c *adb.Client, chipRE []*regexp.Regexp) (*adb.Node, error) {
scrollMax := a.cfg.UI.ChannelScrollMax
if scrollMax <= 0 {
scrollMax = 12
}
// Prefer scrolling down from the top so ITV1/ITV2 are reachable.
_ = c.Swipe(540, 1200, 540, 1900, 250)
time.Sleep(400 * time.Millisecond)
for attempt := 0; attempt <= scrollMax; attempt++ {
nodes, err := c.DumpUI(a.CacheDir())
if err != nil {
return nil, err
}
for i := range nodes {
n := &nodes[i]
if n.Desc == "" {
continue
}
for _, p := range chipRE {
if p.MatchString(n.Desc) {
return n, nil
}
}
}
if attempt == scrollMax {
break
}
fmt.Printf("[*] scroll Live list (%d/%d)…\n", attempt+1, scrollMax)
_ = c.Swipe(540, 1950, 540, 1100, 320)
time.Sleep(700 * time.Millisecond)
}
return nil, fmt.Errorf("channel row not found")
}

View file

@ -25,6 +25,9 @@ type Common struct {
CAHash string `yaml:"ca_hash"`
Aliases map[string]string `yaml:"aliases"`
Score capture.ScoreCfg `yaml:"score"`
// MitmHosts are forced into transparent MITM via -mitm-host (suffix match).
// Transparent mode otherwise passthroughs everything except open.live.bbc.co.uk.
MitmHosts []string `yaml:"mitm_hosts"`
}
// Base implements the boilerplate half of app.App.
@ -94,6 +97,18 @@ func (b *Base) Score() capture.ScoreCfg {
return capture.DefaultScoreCfg().Merge(b.common.Score)
}
// MitmHosts returns hosts the transparent MITM must decrypt (empty = BBC open.live only).
func (b *Base) MitmHosts() []string {
out := make([]string, 0, len(b.common.MitmHosts))
for _, h := range b.common.MitmHosts {
h = strings.TrimSpace(strings.ToLower(h))
if h != "" {
out = append(out, h)
}
}
return out
}
// Hints returns device-layout hints with this module's scoring applied.
func (b *Base) Hints(require ...string) capture.Hints {
h := capture.DefaultHints()

View file

@ -83,6 +83,12 @@ type TransparentMITM interface {
UseTransparentMITM() bool
}
// MitmHostList is implemented by apps that need extra -mitm-host entries in
// transparent mode (default MITM is only open.live.bbc.co.uk).
type MitmHostList interface {
MitmHosts() []string
}
var (
mu sync.RWMutex
registry = map[string]func() (App, error){}

View file

@ -23,6 +23,7 @@ type Describe struct {
ProxyBin string `json:"proxy_bin,omitempty"`
CAHash string `json:"ca_hash,omitempty"`
TransparentMITM bool `json:"transparent_mitm"`
MitmHosts []string `json:"mitm_hosts,omitempty"`
Rewriter string `json:"rewriter,omitempty"`
Channels []Channel `json:"channels"`
Require []string `json:"require,omitempty"`

View file

@ -82,6 +82,17 @@ func (r *RemoteApp) MPDRewriter() mpd.Rewriter {
func (r *RemoteApp) UseTransparentMITM() bool { return r.Desc.TransparentMITM }
func (r *RemoteApp) MitmHosts() []string {
out := make([]string, 0, len(r.Desc.MitmHosts))
for _, h := range r.Desc.MitmHosts {
h = strings.TrimSpace(strings.ToLower(h))
if h != "" {
out = append(out, h)
}
}
return out
}
func (r *RemoteApp) RewriterName() string {
if r.Desc.Rewriter == "" {
return "none"
@ -117,6 +128,7 @@ func (r *RemoteApp) ValuesPath() string {
var (
_ app.App = (*RemoteApp)(nil)
_ app.TransparentMITM = (*RemoteApp)(nil)
_ app.MitmHostList = (*RemoteApp)(nil)
_ app.StreamDefaults = (*RemoteApp)(nil)
_ app.Catalog = (*RemoteApp)(nil)
)

View file

@ -209,7 +209,11 @@ func Run(opt Options) (res Result, err error) {
// StartTransparent creates a per-install CA under data/ if needed and pushes cert+key.
proxy.ClearHTTPProxy(c)
remoteDir := "/data/local/tmp/capture/" + a.Package()
if err := proxy.StartTransparent(c, proxyBin, a.Package(), "8080", remoteDir, false); err != nil {
var mitmHosts []string
if mh, ok := a.(app.MitmHostList); ok {
mitmHosts = mh.MitmHosts()
}
if err := proxy.StartTransparent(c, proxyBin, a.Package(), "8080", remoteDir, false, mitmHosts...); err != nil {
return res, fmt.Errorf("transparent MITM start: %w", err)
}
defer proxy.StopTransparent(c)

View file

@ -478,7 +478,9 @@ const (
// StartTransparent pushes appproxy in -transparent mode (no Wi‑Fi http_proxy),
// installs iptables UID REDIRECT for pkg, and writes captures under remoteDir.
func StartTransparent(c *adb.Client, localBin, pkg, port, remoteDir string, reinject bool) error {
// mitmHosts are passed as repeatable -mitm-host flags (suffix match); transparent
// mode otherwise only MITMs open.live.bbc.co.uk.
func StartTransparent(c *adb.Client, localBin, pkg, port, remoteDir string, reinject bool, mitmHosts ...string) error {
if port == "" {
port = "8080"
}
@ -518,6 +520,20 @@ func StartTransparent(c *adb.Client, localBin, pkg, port, remoteDir string, rein
_, _ = c.Shell("mkdir", "-p", remoteDir)
_, _ = c.Shell("rm", "-f", remoteDir+"/cap.json", remoteDir+"/traffic.jsonl", remoteDir+"/appproxy.log")
mitmFlags := ""
seen := map[string]bool{}
for _, h := range mitmHosts {
h = strings.TrimSpace(strings.ToLower(h))
if h == "" || seen[h] || !safeMitmHost(h) {
continue
}
seen[h] = true
mitmFlags += " -mitm-host " + h
}
if mitmFlags != "" {
fmt.Printf("[*] Force MITM hosts:%s\n", mitmFlags)
}
starter := "#!/system/bin/sh\n" +
"mkdir -p '" + remoteDir + "'\n" +
"exec " + RemoteBin +
@ -529,6 +545,7 @@ func StartTransparent(c *adb.Client, localBin, pkg, port, remoteDir string, rein
" -dns 1.1.1.1,1.0.0.1,8.8.8.8" +
" -log-all" +
" -v" +
mitmFlags +
"\n"
tmp := filepath.Join(os.TempDir(), "start_appproxy_tproxy.sh")
if err := os.WriteFile(tmp, []byte(starter), 0o755); err != nil {
@ -597,6 +614,20 @@ func StopTransparent(c *adb.Client) {
fmt.Println("[*] transparent capture stopped")
}
// safeMitmHost allows only hostname characters so flags stay shell-safe.
func safeMitmHost(h string) bool {
if h == "" || len(h) > 253 {
return false
}
for _, r := range h {
if (r >= 'a' && r <= 'z') || (r >= '0' && r <= '9') || r == '.' || r == '-' {
continue
}
return false
}
return true
}
// ResetOptions controls drm proxy reset.
type ResetOptions struct {
KeepCaptures bool // leave /data/local/tmp/capture/

View file

@ -258,6 +258,14 @@ func clearProxyCmd(args []string) {
proxy.ClearHTTPProxy(c)
}
type stringList []string
func (s *stringList) String() string { return strings.Join(*s, ",") }
func (s *stringList) Set(v string) error {
*s = append(*s, v)
return nil
}
func transparentCmd(args []string) {
fs := flag.NewFlagSet("transparent", flag.ExitOnError)
pkg := fs.String("package", "", "app package to redirect (e.g. bbc.iplayer.android)")
@ -266,6 +274,8 @@ func transparentCmd(args []string) {
reinject := fs.Bool("reinject", false, "Magisk-reinject CA before start (slow; CA usually already mounted)")
port := fs.String("port", "8080", "transparent listen port on device")
noTail := fs.Bool("no-tail", false, "start only; do not wait / pull on Ctrl+C")
var mitmHosts stringList
fs.Var(&mitmHosts, "mitm-host", "force MITM for this host (repeatable; e.g. play.dar.itv.com)")
c := clientFrom(fs, args)
if err := c.EnsureDevice(); err != nil {
fatal(err)
@ -286,7 +296,7 @@ func transparentCmd(args []string) {
remoteDir := "/data/local/tmp/capture/" + *pkg
fmt.Printf("[*] Transparent capture for %s → %s\n", *pkg, remoteDir)
if err := proxy.StartTransparent(c, local, *pkg, *port, remoteDir, *reinject); err != nil {
if err := proxy.StartTransparent(c, local, *pkg, *port, remoteDir, *reinject, mitmHosts...); err != nil {
fatal(err)
}
fmt.Println("[+] running. Leave UK VPN ON. Open the app and play.")

View file

@ -11,6 +11,7 @@ modules/
.bin/bbc.exe # built on demand
rte/
tg4/
itv/ # ITVX stub (phone capture; UK geo)
```
## Config files
@ -34,7 +35,7 @@ DRM_MODULES_DIR=D:\mods drm capture --app rte --channel rteone
## Releases
Push a `modules-v*` tag to publish per-module zips (`bbc.zip`, `rte.zip`, `tg4.zip`) via
Push a `modules-v*` tag to publish per-module zips (`bbc.zip`, `rte.zip`, `tg4.zip`, `itv.zip`) via
Forgejo Actions. Host `drm` stays on separate `v*` tags.
Requires Go on PATH to build from source. Release zips may ship `.bin/` prebuilt.

15
modules/itv/go.mod Normal file
View file

@ -0,0 +1,15 @@
module null-drm/modules/itv
go 1.25.0
require (
drmdecryption v0.0.0
drmdecryption/modules v0.0.0
)
require gopkg.in/yaml.v3 v3.0.1 // indirect
replace (
drmdecryption => ../../apps/pkg
drmdecryption/modules => ../../apps/modules
)

4
modules/itv/go.sum Normal file
View file

@ -0,0 +1,4 @@
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

165
modules/itv/main.go Normal file
View file

@ -0,0 +1,165 @@
// Command itv is the external ITVX provider module (stub).
// Built on demand by the drm host: modules/itv/.bin/itv[.exe]
package main
import (
"encoding/json"
"flag"
"fmt"
"os"
"drmdecryption/adb"
appreg "drmdecryption/app"
"drmdecryption/modcfg"
"drmdecryption/modhost"
"drmdecryption/modules/itv"
)
func main() {
if len(os.Args) < 2 {
usage()
os.Exit(2)
}
cmd, args := os.Args[1], os.Args[2:]
var err error
switch cmd {
case "describe":
err = cmdDescribe()
case "launch":
err = cmdLaunch(args)
case "autoplay":
err = cmdAutoplay(args)
case "catalog":
err = cmdCatalog(args)
case "help", "-h", "--help":
usage()
return
default:
usage()
err = fmt.Errorf("unknown command %q", cmd)
}
if err != nil {
fmt.Fprintln(os.Stderr, "[!]", err)
os.Exit(1)
}
}
func usage() {
fmt.Fprint(os.Stderr, `itv — Null DRM external module (ITVX, stub)
Usage:
itv describe
itv launch [--serial SERIAL]
itv autoplay --channel ID [--serial SERIAL]
itv catalog --channel ID [--json]
`)
}
func loadApp() (appreg.App, error) {
return itv.New()
}
func cmdDescribe() error {
a, err := loadApp()
if err != nil {
return err
}
d := modhost.Describe{
Protocol: modhost.ProtocolVersion,
Name: a.Name(),
Package: a.Package(),
LicenseURL: a.LicenseURL(),
KeyMode: a.KeyMode(),
ProxyBin: a.ProxyBin(),
CAHash: a.CAHash(),
TransparentMITM: true,
Rewriter: "none",
ValuesPath: modcfg.Path(a.Name()),
}
if mh, ok := a.(appreg.MitmHostList); ok {
d.MitmHosts = mh.MitmHosts()
}
if sd, ok := a.(appreg.StreamDefaults); ok {
d.Rewriter = sd.RewriterName()
}
type loaded interface {
ConfigLoaded() bool
ConfigPath() string
}
if L, ok := a.(loaded); ok {
d.ValuesLoaded = L.ConfigLoaded()
if L.ConfigPath() != "" {
d.ValuesPath = L.ConfigPath()
}
}
if _, ok := a.(appreg.Catalog); ok {
d.HasCatalog = true
}
h := a.CaptureHints()
d.Require = h.Require
d.Score = h.Score
for _, ch := range a.Channels() {
d.Channels = append(d.Channels, modhost.Channel{ID: ch.ID, Label: ch.Label})
}
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", " ")
return enc.Encode(d)
}
func cmdLaunch(args []string) error {
fs := flag.NewFlagSet("launch", flag.ContinueOnError)
serial := fs.String("serial", "", "adb device serial")
if err := fs.Parse(args); err != nil {
return err
}
a, err := loadApp()
if err != nil {
return err
}
c := adb.New()
if *serial != "" {
c = c.WithSerial(*serial)
}
return a.Launch(c)
}
func cmdAutoplay(args []string) error {
fs := flag.NewFlagSet("autoplay", flag.ContinueOnError)
serial := fs.String("serial", "", "adb device serial")
channel := fs.String("channel", "", "channel id")
if err := fs.Parse(args); err != nil {
return err
}
if *channel == "" {
return fmt.Errorf("--channel is required")
}
a, err := loadApp()
if err != nil {
return err
}
c := adb.New()
if *serial != "" {
c = c.WithSerial(*serial)
}
return a.AutoPlay(c, *channel)
}
func cmdCatalog(args []string) error {
fs := flag.NewFlagSet("catalog", flag.ContinueOnError)
channel := fs.String("channel", "", "channel id")
_ = fs.Bool("json", false, "print JSON")
if err := fs.Parse(args); err != nil {
return err
}
if *channel == "" {
return fmt.Errorf("--channel is required")
}
a, err := loadApp()
if err != nil {
return err
}
if _, ok := a.(appreg.Catalog); !ok {
return fmt.Errorf("itv module has no catalog — use phone capture (UK geo)")
}
return fmt.Errorf("itv module has no catalog — use phone capture (UK geo)")
}

View file

@ -0,0 +1,90 @@
# ITVX — published universal values (renamed to module.yaml in release zips).
# Fill secrets in local module.yaml: license_url, origins, kids (never commit that file).
# Stub: Live UI matchers are best-effort; tune after a UK-geo phone session.
package: air.ITVMobilePlayer
proxy_bin: bin/proxy-android-arm64
# SENSITIVE — set in local module.yaml:
# license_url: "https://…"
# Transparent mode only MITMs open.live by default. Force decrypt of ITVX
# playlist / license / simulcast hosts observed in phone traffic (suffix match).
# Segment CDNs (akamai.content) stay passthrough so playback is less likely to break.
mitm_hosts:
- play.dar.itv.com
- itvpnp.live.ott.irdeto.com
- simulcast.itv.com
- secure.pes.itv.com
- cpt.itv.com
- tom.itv.com
score:
hosts:
- play.dar.itv.com
- itvpnp.live.ott.irdeto.com
- simulcast.itv.com
- content.itv.com
- itv.com
- itvstatic.com
- irdeto.com
deny:
- google-analytics
- googletagmanager
- doubleclick
- scorecardresearch
- facebook.com
- crashlytics
- launchdarkly
- 2cnt.net
- appsflyer
aliases:
one: itv1
itv: itv1
two: itv2
three: itv3
four: itv4
be: itvbe
citv: itvxkids
channels:
itv1:
label: ITV1
# Live list rows: "Expand ITV1 info button" / "Collapse ITV1 info button"
chip_desc: ["(?i)(Expand|Collapse)\\s+ITV1\\s+info button"]
play_desc: ["(?i)^WATCH LIVE$", "(?i)Watch\\s+ITV1\\s+on full screen"]
itv2:
label: ITV2
chip_desc: ["(?i)(Expand|Collapse)\\s+ITV2\\s+info button"]
play_desc: ["(?i)^WATCH LIVE$", "(?i)Watch\\s+ITV2\\s+on full screen"]
itv3:
label: ITV3
chip_desc: ["(?i)(Expand|Collapse)\\s+ITV3\\s+info button"]
play_desc: ["(?i)^WATCH LIVE$", "(?i)Watch\\s+ITV3\\s+on full screen"]
itv4:
label: ITV4
chip_desc: ["(?i)(Expand|Collapse)\\s+ITV4\\s+info button"]
play_desc: ["(?i)^WATCH LIVE$", "(?i)Watch\\s+ITV4\\s+on full screen"]
itvbe:
label: ITVBe
chip_desc: ["(?i)(Expand|Collapse)\\s+ITVBe\\s+info button"]
play_desc: ["(?i)^WATCH LIVE$", "(?i)Watch\\s+ITVBe\\s+on full screen"]
ui:
launch_desc_contains: ["Home", "Lyve", "Live", "Categories", "ITVX"]
live_tab: ["Lyve", "Live"]
live_tab_desc_re: ["^Lyve$"]
live_tab_text_re: ["^Live$"]
watch_live: ["WATCH LIVE", "Watch live", "Watch Live"]
playback_desc_contains: ["Unmute", "on full screen", "Pause"]
channel_scroll_max: 14
timeouts:
launch_wait_ui: 30s
launch_settle: 5s
live_nav: 20s
channel_find: 45s
after_channel: 3s
watch_live: 20s
playback: 60s

View file

@ -31,7 +31,7 @@ function Resolve-Go {
$GoExe = Resolve-Go
New-Item -ItemType Directory -Force -Path $Out | Out-Null
$Modules = @("bbc", "rte", "tg4")
$Modules = @("bbc", "rte", "tg4", "itv")
$Targets = @(
@{ GOOS = "windows"; GOARCH = "amd64"; Ext = ".exe" },
@{ GOOS = "windows"; GOARCH = "arm64"; Ext = ".exe" },
@ -111,4 +111,4 @@ foreach ($z in $builtZips) {
}
[System.IO.File]::WriteAllLines($sumsPath, $lines)
Write-Host "DONE modules release $Version → $Out"
Get-ChildItem $Out -Filter "*.zip" | Where-Object { $_.Name -match '^(bbc|rte|tg4)\.zip$' } | Format-Table Name, Length
Get-ChildItem $Out -Filter "*.zip" | Where-Object { $_.Name -match '^(bbc|rte|tg4|itv)\.zip$' } | Format-Table Name, Length

View file

@ -9,7 +9,7 @@ if [[ -z "$VERSION" ]]; then
fi
mkdir -p "$OUT"
MODULES=(bbc rte tg4)
MODULES=(bbc rte tg4 itv)
TARGETS=(
"windows amd64 .exe"
"windows arm64 .exe"
@ -65,4 +65,4 @@ for z in "${built[@]}"; do
( cd "$(dirname "$z")" && sha256sum "$(basename "$z")" ) >> "$sums"
done
echo "DONE modules release $VERSION → $OUT"
ls -la "$OUT"/bbc.zip "$OUT"/rte.zip "$OUT"/tg4.zip 2>/dev/null || true
ls -la "$OUT"/bbc.zip "$OUT"/rte.zip "$OUT"/tg4.zip "$OUT"/itv.zip 2>/dev/null || true

View file

@ -2,11 +2,15 @@
#
# Required env:
# TELEGRAM_BOT_TOKEN BotFather token (never commit)
# TELEGRAM_CHAT_ID e.g. -1003721978702
# TELEGRAM_CHAT_ID e.g. 7314901602 (private DM) or -100… (group)
#
# Optional:
# TELEGRAM_MESSAGE_THREAD_ID forum topic / "tab" id (groups only)
#
# Usage:
# $env:TELEGRAM_BOT_TOKEN="…"; $env:TELEGRAM_CHAT_ID="-1003721978702"
# $env:TELEGRAM_BOT_TOKEN="..."; $env:TELEGRAM_CHAT_ID="7314901602"
# .\scripts\notify-telegram.ps1 -Tag v0.1.2
# .\scripts\notify-telegram.ps1 -Tag v0.1.2 -ThreadId 16
# .\scripts\notify-telegram.ps1 -Tag modules-v0.1.2 -DryRun
param(
[string]$Tag = "",
@ -15,6 +19,7 @@ param(
[string]$Body = "",
[string]$ReleaseUrl = "",
[string]$RepoUrl = "https://git.nulldrm.com/nulldrm/Null-DRM-Official",
[string]$ThreadId = "",
[switch]$DryRun
)
@ -32,9 +37,14 @@ if (-not $Tag) { throw "usage: notify-telegram.ps1 -Tag v0.1.2" }
$Token = $env:TELEGRAM_BOT_TOKEN
$Chat = $env:TELEGRAM_CHAT_ID
if (-not $Token -or -not $Chat) {
if (-not $ThreadId) { $ThreadId = $env:TELEGRAM_MESSAGE_THREAD_ID }
if (-not $DryRun -and (-not $Token -or -not $Chat)) {
throw "TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID are required"
}
if ($DryRun -and (-not $Token -or -not $Chat)) {
Write-Host "[!] DryRun: TELEGRAM_BOT_TOKEN / TELEGRAM_CHAT_ID not set - showing payload only"
if (-not $Chat) { $Chat = "(unset)" }
}
if ($Kind -eq "auto") {
if ($Tag -like "modules-v*") { $Kind = "modules" } else { $Kind = "host" }
@ -47,40 +57,45 @@ if (-not $ReleaseUrl) {
if (-not $Title) {
if ($env:RELEASE_TITLE) { $Title = $env:RELEASE_TITLE }
elseif ($Kind -eq "modules") { $Title = "Null DRM $Tag" }
else { $Title = "Null DRM $Tag" }
}
function New-TelegramBody {
param([string]$Kind, [string]$Title, [string]$Tag, [string]$ReleaseUrl)
$code = { param($t) "<code>$t</code>" }
$nl = "`n"
if ($Kind -eq "modules") {
return (
"<b>$Title</b>" + $nl +
"Provider module zips: $( & $code 'bbc.zip' ), $( & $code 'rte.zip' ), $( & $code 'tg4.zip' ), $( & $code 'itv.zip' )" + $nl + $nl +
"Unpack each into $( & $code 'modules/<name>/' ) and edit $( & $code 'module.yaml' ) for secrets." + $nl + $nl +
"<a href=`"$ReleaseUrl`">Download $Tag</a>"
)
}
return (
"<b>$Title</b>" + $nl +
"Host CLI ($( & $code 'drm' )) + on-device MITM ($( & $code 'proxy-android-arm64' ))." + $nl + $nl +
"<a href=`"$ReleaseUrl`">Download $Tag</a>"
)
}
if (-not $Body) {
if ($env:RELEASE_BODY) {
$Body = $env:RELEASE_BODY
} elseif ($Kind -eq "modules") {
$Body = @"
<b>$Title</b>
Provider module zips: <code>bbc.zip</code>, <code>rte.zip</code>, <code>tg4.zip</code>
Unpack each into <code>modules/&lt;name&gt;/</code> and edit <code>module.yaml</code> for secrets.
<a href="$ReleaseUrl">Download $Tag</a>
"@
} else {
$Body = @"
<b>$Title</b>
Host CLI (<code>drm</code>) + on-device MITM (<code>proxy-android-arm64</code>).
<a href="$ReleaseUrl">Download $Tag</a>
"@
$Body = New-TelegramBody -Kind $Kind -Title $Title -Tag $Tag -ReleaseUrl $ReleaseUrl
}
}
if ($DryRun) {
Write-Host "DRY_RUN chat=$Chat tag=$Tag kind=$Kind"
Write-Host "DRY_RUN chat=$Chat thread=$ThreadId tag=$Tag kind=$Kind"
Write-Host "----"
Write-Host $Body
return
}
Write-Host "[*] Telegram notify → chat $Chat ($Tag)"
$threadNote = if ($ThreadId) { " topic/thread $ThreadId" } else { "" }
Write-Host "[*] Telegram notify -> chat $Chat$threadNote ($Tag)"
$uri = "https://api.telegram.org/bot$Token/sendMessage"
$form = @{
chat_id = $Chat
@ -88,6 +103,9 @@ $form = @{
parse_mode = "HTML"
disable_web_page_preview = "false"
}
if ($ThreadId) {
$form.message_thread_id = $ThreadId
}
$resp = Invoke-RestMethod -Method Post -Uri $uri -Body $form
if (-not $resp.ok) {
throw "Telegram API error: $($resp | ConvertTo-Json -Compress)"

View file

@ -3,7 +3,7 @@
#
# Required env:
# TELEGRAM_BOT_TOKEN BotFather token (Forgejo secret / local env — never commit)
# TELEGRAM_CHAT_ID Channel chat id, e.g. -1003721978702
# TELEGRAM_CHAT_ID e.g. 7314901602 (private DM) or -100… (group)
#
# Optional:
# RELEASE_TAG / first arg tag name
@ -12,11 +12,12 @@
# RELEASE_BODY full HTML body override
# RELEASE_KIND host | modules | auto
# RELEASE_REPO_URL default https://git.nulldrm.com/nulldrm/Null-DRM-Official
# TELEGRAM_MESSAGE_THREAD_ID forum topic / "tab" id (groups only)
# DRY_RUN=1 print, do not send
#
# Usage:
# TELEGRAM_BOT_TOKEN=… TELEGRAM_CHAT_ID=… ./scripts/notify-telegram.sh v0.1.2
# TELEGRAM_BOT_TOKEN=… TELEGRAM_CHAT_ID=… ./scripts/notify-telegram.sh modules-v0.1.2
# TELEGRAM_BOT_TOKEN=… TELEGRAM_CHAT_ID=7314901602 ./scripts/notify-telegram.sh v0.1.2
# TELEGRAM_BOT_TOKEN=… TELEGRAM_CHAT_ID=… TELEGRAM_MESSAGE_THREAD_ID=16 ./scripts/notify-telegram.sh v0.1.2
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
@ -31,6 +32,7 @@ fi
TOKEN="${TELEGRAM_BOT_TOKEN:-}"
CHAT="${TELEGRAM_CHAT_ID:-}"
THREAD="${TELEGRAM_MESSAGE_THREAD_ID:-}"
if [[ -z "$TOKEN" || -z "$CHAT" ]]; then
echo "TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID are required" >&2
exit 1
@ -57,7 +59,7 @@ if [[ -n "${RELEASE_BODY:-}" ]]; then
BODY="$RELEASE_BODY"
elif [[ "$KIND" == "modules" ]]; then
BODY="<b>${TITLE}</b>
Provider module zips: <code>bbc.zip</code>, <code>rte.zip</code>, <code>tg4.zip</code>
Provider module zips: <code>bbc.zip</code>, <code>rte.zip</code>, <code>tg4.zip</code>, <code>itv.zip</code>
Unpack each into <code>modules/&lt;name&gt;/</code> and edit <code>module.yaml</code> for secrets.
@ -70,18 +72,26 @@ Host CLI (<code>drm</code>) + on-device MITM (<code>proxy-android-arm64</code>).
fi
if [[ "${DRY_RUN:-}" == "1" ]]; then
echo "DRY_RUN chat=$CHAT tag=$TAG kind=$KIND"
echo "DRY_RUN chat=$CHAT thread=${THREAD:-} tag=$TAG kind=$KIND"
echo "----"
echo "$BODY"
exit 0
fi
echo "[*] Telegram notify → chat $CHAT ($TAG)"
THREAD_NOTE=""
CURL_THREAD=()
if [[ -n "$THREAD" ]]; then
THREAD_NOTE=" topic/thread ${THREAD}"
CURL_THREAD=(--data-urlencode "message_thread_id=${THREAD}")
fi
echo "[*] Telegram notify → chat $CHAT${THREAD_NOTE} ($TAG)"
RESP=$(curl -sS -X POST "https://api.telegram.org/bot${TOKEN}/sendMessage" \
--data-urlencode "chat_id=${CHAT}" \
--data-urlencode "text=${BODY}" \
--data-urlencode "parse_mode=HTML" \
--data-urlencode "disable_web_page_preview=false")
--data-urlencode "disable_web_page_preview=false" \
"${CURL_THREAD[@]}")
case "$RESP" in
*"\"ok\":true"*|*"\"ok\": true"*)