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

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")
}