v0.1.1: external modules, publish YAML, proxy reset, binary-first README
All checks were successful
release / build-and-upload (push) Successful in 6m8s
modules-release / build-and-upload (push) Successful in 4m47s

- Host discovers/builds modules under modules/ (bbc, rte, tg4)
- module-publish.yaml tracked; local module.yaml gitignored
- drm --modules-dir / DRM_MODULES_DIR
- drm proxy reset; Magisk reinject reliability
- modules-v* Forgejo release workflow + build scripts
- BBC full Explore channel map including S4C
- README quickstart based on release binaries
This commit is contained in:
404errordeveloper 2026-10-08 23:16:14 +02:00
parent 1d36961a7c
commit f9c28be3f1
52 changed files with 2915 additions and 636 deletions

View file

@ -90,34 +90,35 @@ func (a *App) Launch(c *adb.Client) error {
return nil
}
// AutoPlay: best-effort; iPlayer UI varies — operator can play by hand.
// AutoPlay opens Explore, taps the channel logo, then Watch live — same style
// as RTE/TG4 interactive navigation, driven by uiautomator dumps.
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 — open Live and start playback on the phone…\n", a.Label(id))
fmt.Printf("[*] Auto-play %s…\n", a.Label(id))
if ch.VPID != "" {
fmt.Printf(" expected mediaselector vpid ≈ %s\n", ch.VPID)
}
c.DismissShadeIfFocused()
if len(ch.PlayDesc) == 0 && len(ch.ChipDesc) == 0 {
return fmt.Errorf("no UI selectors for %s — play manually on the phone", id)
if err := a.openExplorePage(c); err != nil {
return err
}
if len(ch.ChipDesc) > 0 {
if err := uiflow.TapUI(c, a.CacheDir(), uiflow.Match{DescRE: ch.ChipDesc}, 20*time.Second); err != nil {
return fmt.Errorf("channel chip: %w", err)
}
time.Sleep(2 * time.Second)
if err := a.tapChannel(c, ch); err != nil {
return err
}
if len(ch.PlayDesc) > 0 {
if err := uiflow.TapUI(c, a.CacheDir(), uiflow.Match{DescRE: ch.PlayDesc}, 15*time.Second); err != nil {
return fmt.Errorf("play: %w", err)
}
time.Sleep(time.Duration(a.cfg.Timeouts.AfterChannel))
if err := a.tapWatchLive(c, ch); err != nil {
return err
}
// Soft-fail: clear streams often start without a dumpsys audio session.
return uiflow.WaitPlayback(c, a.CacheDir(), a.Package(), uiflow.PlaybackOpts{
Timeout: time.Duration(a.cfg.Timeouts.Playback),
Timeout: time.Duration(a.cfg.Timeouts.Playback),
SoftFail: true,
OrDescContains: a.cfg.UI.PlaybackDescContains,
})
}

View file

@ -1,6 +1,7 @@
package bbc
import (
"regexp"
"time"
"drmdecryption/modcfg"
@ -10,18 +11,19 @@ import (
// Name is the module id (--app bbc).
const Name = "bbc"
// Channel is one live (or catch-up) target. Phone UI selectors are optional —
// capture works with manual play; auto-play uses them when present.
// Channel is one live target. Label doubles as the Explore-rail content-desc
// (e.g. "BBC One") unless ChipDesc overrides it.
type Channel struct {
Label string `yaml:"label"`
// VPID is the mediaselector version/service id (e.g. bbc_one_london).
VPID string `yaml:"vpid"`
// ChipDesc / PlayDesc are optional UI matchers for --auto-play.
// ChipDesc matches the channel logo on Explore (content-desc). Default: Label.
ChipDesc []string `yaml:"chip_desc"`
// PlayDesc matches the Watch-live control on the channel page. Default: Watch live.
PlayDesc []string `yaml:"play_desc"`
}
// Config is apps/modules/bbc/module.yaml.
// Config is modules/bbc/module.yaml (preferred) or apps/modules/bbc/module.yaml.
type Config struct {
provider.Common `yaml:",inline"`
@ -31,30 +33,79 @@ type Config struct {
UI UI `yaml:"ui"`
}
// Timeouts for launch / optional autoplay.
// Timeouts for launch / autoplay. Written as "25s" in module.yaml.
type Timeouts struct {
LaunchWaitUI provider.Duration `yaml:"launch_wait_ui"`
LaunchSettle provider.Duration `yaml:"launch_settle"`
Playback provider.Duration `yaml:"playback"`
LaunchWaitUI provider.Duration `yaml:"launch_wait_ui"`
LaunchSettle provider.Duration `yaml:"launch_settle"`
ExploreNav provider.Duration `yaml:"explore_nav"`
ChannelFind provider.Duration `yaml:"channel_find"`
AfterChannel provider.Duration `yaml:"after_channel"`
WatchLive provider.Duration `yaml:"watch_live"`
AfterWatch provider.Duration `yaml:"after_watch"`
Playback provider.Duration `yaml:"playback"`
}
// UI markers for launch readiness (localized; keep loose).
// UI markers for launch readiness and interactive navigation.
type UI struct {
LaunchDescContains []string `yaml:"launch_desc_contains"`
LaunchResourceContains []string `yaml:"launch_resource_contains"`
// ExploreTab is bottom-nav text/desc for the Explore page.
ExploreTab []string `yaml:"explore_tab"`
// WatchLive is the channel-page play control.
WatchLive []string `yaml:"watch_live"`
// PlaybackDescContains are soft player-up signals.
PlaybackDescContains []string `yaml:"playback_desc_contains"`
// ChannelScrollMax limits horizontal swipes while hunting a channel logo.
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(4 * time.Second))
t.ExploreNav = provider.Duration(t.ExploreNav.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.AfterWatch = provider.Duration(t.AfterWatch.D(2 * time.Second))
t.Playback = provider.Duration(t.Playback.D(60 * time.Second))
if len(c.UI.LaunchDescContains) == 0 {
c.UI.LaunchDescContains = []string{"iPlayer", "Home", "Live"}
u := &c.UI
if len(u.LaunchDescContains) == 0 {
u.LaunchDescContains = []string{"Home", "Explore", "Watchlist", "Watch now", "iPlayer"}
}
if len(u.ExploreTab) == 0 {
u.ExploreTab = []string{"Explore"}
}
if len(u.WatchLive) == 0 {
u.WatchLive = []string{"Watch live", "Watch Live", "Watch now"}
}
if len(u.PlaybackDescContains) == 0 {
u.PlaybackDescContains = []string{"Pause", "pause", "Player", "Seek", "scrubber"}
}
if u.ChannelScrollMax <= 0 {
u.ChannelScrollMax = 10
}
return c
}
func (ch Channel) chipPatterns() []string {
if len(ch.ChipDesc) > 0 {
return ch.ChipDesc
}
if ch.Label != "" {
return []string{"^" + regexp.QuoteMeta(ch.Label) + "$", ch.Label}
}
return nil
}
func (ch Channel) playPatterns(ui UI) []string {
if len(ch.PlayDesc) > 0 {
return ch.PlayDesc
}
return ui.WatchLive
}
var flags struct {
packageName string
caHash string

View file

@ -0,0 +1,93 @@
# BBC iPlayer — published universal values (renamed to module.yaml in release zips).
# No secrets. Local overrides / ca_hash / proxy_bin go in gitignored module.yaml.
package: bbc.iplayer.android
proxy_bin: bin/proxy-android-arm64
# Manifest-URL scoring for the on-device MITM / waiter.
score:
hosts:
- open.live.bbc.co.uk
- vs-cmaf-push-uk
- vod-dash-uk
- akamaized.net
- bbci.co.uk
- bidi.net.uk
- bidi.bbc.co.uk
deny:
- telemetry.api.bbci
- bag.api.bbc
- ibl.api.bbci
- thumbnail
aliases:
one: bbcone
bbc1: bbcone
london: bbcone
two: bbctwo
bbc2: bbctwo
three: bbcthree
bbc3: bbcthree
four: bbcfour
bbc4: bbcfour
news: bbcnews
scotland: bbcscotland
alba: bbcalba
parliament: bbcparliament
radio1: bbcradio1
radio: bbcradio1
# Labels must match Explore-rail content-desc for interactive autoplay.
channels:
bbcone:
label: BBC One
vpid: bbc_one_london
bbctwo:
label: BBC Two
vpid: bbc_two_england
bbcthree:
label: BBC Three
vpid: bbc_three
bbcfour:
label: BBC Four
vpid: bbc_four
bbcnews:
label: BBC News
vpid: bbc_news_channel
bbcscotland:
label: BBC Scotland
vpid: bbc_scotland
bbcalba:
label: BBC ALBA
vpid: bbc_alba
bbcparliament:
label: BBC Parliament
vpid: bbc_parliament
cbbc:
label: CBBC
vpid: cbbc
cbeebies:
label: CBeebies
vpid: cbeebies
s4c:
label: S4C
vpid: s4c
bbcradio1:
label: BBC Radio 1
vpid: bbc_radio_one
# Interactive auto-play: Explore → channel logo → Watch live.
timeouts:
launch_wait_ui: 30s
launch_settle: 4s
explore_nav: 20s
channel_find: 45s
after_channel: 3s
watch_live: 20s
playback: 60s
ui:
launch_desc_contains: ["Home", "Explore", "Watchlist", "Watch now"]
explore_tab: ["Explore"]
watch_live: ["Watch live", "Watch Live"]
playback_desc_contains: ["Pause", "pause", "Seek"]
channel_scroll_max: 12

View file

@ -1,51 +0,0 @@
# BBC iPlayer — published values. Package id and channel map only;
# no Widevine license URL (mobile-phone-main streams are clear).
package: bbc.iplayer.android
proxy_bin: bin/proxy-android-arm64
ca_hash: "6c3578b4"
# Manifest-URL scoring for the on-device MITM / waiter.
score:
hosts:
- open.live.bbc.co.uk
- vs-cmaf-push-uk
- vod-dash-uk
- akamaized.net
- bbci.co.uk
- bidi.net.uk
- bidi.bbc.co.uk
deny:
- telemetry.api.bbci
- bag.api.bbc
- ibl.api.bbci
- thumbnail
aliases:
one: bbcone
bbc1: bbcone
london: bbcone
two: bbctwo
bbc2: bbctwo
news: bbcnews
four: bbcfour
channels:
bbcone:
label: BBC One
vpid: bbc_one_london
bbctwo:
label: BBC Two
vpid: bbc_two_england
bbcnews:
label: BBC News
vpid: bbc_news_channel
bbcfour:
label: BBC Four
vpid: bbc_four
# timeouts:
# launch_wait_ui: 30s
# playback: 60s
# ui:
# launch_desc_contains: ["iPlayer", "Home", "Live"]

237
apps/modules/bbc/steps.go Normal file
View file

@ -0,0 +1,237 @@
package bbc
import (
"fmt"
"regexp"
"strings"
"time"
"drmdecryption/adb"
"drmdecryption/uiflow"
)
// openExplorePage taps the Explore bottom-nav tab and waits for the channel rail.
func (a *App) openExplorePage(c *adb.Client) error {
c.DismissShadeIfFocused()
if nodes, err := c.DumpUI(a.CacheDir()); err == nil && a.onExplorePage(nodes) {
fmt.Println("[*] already on Explore")
return nil
}
fmt.Println("[*] open Explore…")
if err := uiflow.TapUI(c, a.CacheDir(), uiflow.Match{
TextContains: a.cfg.UI.ExploreTab,
DescContains: a.cfg.UI.ExploreTab,
Pick: uiflow.PickFirst,
}, time.Duration(a.cfg.Timeouts.ExploreNav)); err != nil {
return fmt.Errorf("Explore tab: %w", err)
}
time.Sleep(1500 * time.Millisecond)
deadline := time.Now().Add(time.Duration(a.cfg.Timeouts.ExploreNav))
for time.Now().Before(deadline) {
nodes, err := c.DumpUI(a.CacheDir())
if err == nil && a.onExplorePage(nodes) {
fmt.Println("[*] Explore page ready")
return nil
}
time.Sleep(700 * time.Millisecond)
}
return fmt.Errorf("Explore page did not open")
}
// onExplorePage is true when channel logos (BBC One / BBC Two / …) are visible.
// The Channels header alone is not enough — logos load a moment later.
func (a *App) onExplorePage(nodes []adb.Node) bool {
channelish := 0
for _, n := range nodes {
if looksLikeChannelLogo(strings.TrimSpace(n.Desc)) {
channelish++
}
}
return channelish >= 2
}
func looksLikeChannelLogo(desc string) bool {
d := strings.ToLower(strings.TrimSpace(desc))
if d == "" {
return false
}
if strings.HasPrefix(d, "bbc ") || d == "cbbc" || d == "cbeebies" || d == "s4c" {
return true
}
return false
}
// tapChannel finds the channel logo on the Explore rail (scrolling horizontally
// when needed) and taps it.
func (a *App) tapChannel(c *adb.Client, ch Channel) error {
pats := uiflow.CompileRes(ch.chipPatterns())
if len(pats) == 0 {
return fmt.Errorf("no chip selectors for channel %q", ch.Label)
}
deadline := time.Now().Add(time.Duration(a.cfg.Timeouts.ChannelFind))
scrolled := 0
for time.Now().Before(deadline) {
nodes, err := c.DumpUI(a.CacheDir())
if err != nil {
time.Sleep(800 * time.Millisecond)
continue
}
// Match content-desc on the logo node (often not itself clickable —
// the parent View shares bounds and receives the tap).
if n := findChannelLogo(nodes, pats); n != nil {
label := strings.TrimSpace(n.Desc)
if label == "" {
label = strings.TrimSpace(n.Text)
}
fmt.Printf("[*] tap channel %q @ %d,%d\n", label, n.CX(), n.CY())
return c.Tap(n.CX(), n.CY())
}
// Already on the channel page?
if a.onChannelPage(nodes, ch) {
fmt.Printf("[*] already on %s page\n", ch.Label)
return nil
}
logos := channelLogoNodes(nodes)
if len(logos) == 0 {
// Rail still loading — wait, do not swipe random mid-screen coords.
time.Sleep(800 * time.Millisecond)
continue
}
if scrolled >= a.cfg.UI.ChannelScrollMax {
break
}
x1, y, x2 := channelRailSwipe(logos)
fmt.Printf("[*] channel %q not on screen — swipe rail %d→%d @ y=%d (%d logos)\n", ch.Label, x1, x2, y, len(logos))
_ = c.Swipe(x1, y, x2, y, 350)
scrolled++
time.Sleep(900 * time.Millisecond)
}
return fmt.Errorf("channel logo %q not found on Explore", ch.Label)
}
func findChannelLogo(nodes []adb.Node, pats []*regexp.Regexp) *adb.Node {
var best *adb.Node
for i := range nodes {
n := &nodes[i]
desc := strings.TrimSpace(n.Desc)
text := strings.TrimSpace(n.Text)
matched := false
for _, p := range pats {
if desc != "" && p.MatchString(desc) {
matched = true
break
}
if text != "" && p.MatchString(text) {
matched = true
break
}
}
if !matched {
continue
}
// Prefer smaller logo tiles over large hero cards.
if best == nil || n.Area() < best.Area() {
best = n
}
}
return best
}
func channelLogoNodes(nodes []adb.Node) []adb.Node {
var out []adb.Node
for _, n := range nodes {
if looksLikeChannelLogo(strings.TrimSpace(n.Desc)) {
out = append(out, n)
}
}
return out
}
func (a *App) onChannelPage(nodes []adb.Node, ch Channel) bool {
label := strings.TrimSpace(ch.Label)
hasTitle := false
hasWatch := false
for _, n := range nodes {
text := strings.TrimSpace(n.Text)
desc := strings.TrimSpace(n.Desc)
if label != "" && (strings.EqualFold(text, label) || strings.EqualFold(desc, label)) {
hasTitle = true
}
for _, w := range a.cfg.UI.WatchLive {
if w != "" && (strings.EqualFold(text, w) || strings.EqualFold(desc, w) ||
strings.Contains(strings.ToLower(text), strings.ToLower(w)) ||
strings.Contains(strings.ToLower(desc), strings.ToLower(w))) {
hasWatch = true
}
}
}
return hasTitle && hasWatch
}
// channelRailSwipe picks a horizontal swipe across visible channel logos.
func channelRailSwipe(logos []adb.Node) (x1, y, x2 int) {
minX, maxX := logos[0].X1, logos[0].X2
sumY := 0
for _, n := range logos {
if n.X1 < minX {
minX = n.X1
}
if n.X2 > maxX {
maxX = n.X2
}
sumY += n.CY()
}
y = sumY / len(logos)
width := maxX - minX
if width < 400 {
// Single/partial logo visible — swipe across a wide band around it.
cx := (minX + maxX) / 2
return cx + 400, y, cx - 400
}
x1 = minX + width*85/100
x2 = minX + width*15/100
if x1-x2 < 200 {
cx := (minX + maxX) / 2
return cx + 350, y, cx - 350
}
return x1, y, x2
}
// tapWatchLive taps the Watch live control on the channel page.
func (a *App) tapWatchLive(c *adb.Client, ch Channel) error {
pats := ch.playPatterns(a.cfg.UI)
if nodes, err := c.DumpUI(a.CacheDir()); err == nil {
if playingUI(nodes, a.cfg.UI.PlaybackDescContains) {
fmt.Println("[*] player UI already up")
return nil
}
}
fmt.Println("[*] tap Watch live…")
if err := uiflow.TapUI(c, a.CacheDir(), uiflow.Match{
TextContains: pats,
DescContains: pats,
TextRE: pats,
DescRE: pats,
Pick: uiflow.PickLargest,
MinArea: 800,
}, time.Duration(a.cfg.Timeouts.WatchLive)); err != nil {
return fmt.Errorf("Watch live: %w", err)
}
time.Sleep(time.Duration(a.cfg.Timeouts.AfterWatch))
return nil
}
func playingUI(nodes []adb.Node, signals []string) bool {
for _, n := range nodes {
blob := strings.ToLower(n.Text + " " + n.Desc + " " + n.ResourceID)
for _, s := range signals {
if s != "" && strings.Contains(blob, strings.ToLower(s)) {
return true
}
}
}
return false
}