feat: discover and qualify Googlevideo CDNs autonomously

Retain strict three-host native qualification, discover fresh representative inventory automatically, and recheck deployed media before promotion. Document offline-only verification and outstanding field gates.

Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
ZeusinaandGPT-6 Bot committed 2026-10-13 10:12:10 +03:00
1 parent 9984f21466
commit 3fc8563995
22 files changed
+798 -105

No files matched your search

+2 -1
View File
@@ -3,7 +3,8 @@ ZAPRET_AUTOTUNE_HOST_SOCKS_PORT=11080
ZAPRET_AUTOTUNE_YOUTUBE_SERVICE=0
ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE=cold
ZAPRET_AUTOTUNE_VIDEO_ID=dQw4w9WgXcQ
# Optional JSON array: 1..5 unique 11-character VideoIDs (not signed URLs).
# Missing/empty selects automatic YouTube inventory: primary + two public samples.
# Nonempty JSON overrides it: 1..5 unique 11-character VideoIDs (not signed URLs).
# ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS='["dQw4w9WgXcQ","aqz-KE-bpKQ","jNQXAC9IVRw"]'
# Optional target ss-server native DNS; empty retains the base resolver behavior.
SS_DNS_SERVER=
+28 -3
View File
@@ -5,6 +5,29 @@ reconfigure, or stop the existing `zapret2-ss-autotune` container. The target
starts from a disabled managed baseline; `managed monitor` bootstraps the
frontend/API strategy, then discovers and applies an exact-host GGC strategy.
## New autonomous three-CDN source candidate (2026-10-13): offline only
Service-mode source now discovers representative inventory automatically and can
promote an existing experiment only through the unchanged version-1 owned native
proof factory: **three actual media hosts**, at least two roots and two prefixes,
post-warmup 3/3 on both TLS protocols. Discovery is bounded to three rounds,
15 requests maximum and three minutes; signed MP4 URLs need twenty minutes left.
VideoIDs are not CDN evidence. No manual domain list or single-CDN relaxation is
introduced. Missing/empty inventory defaults and explicit overrides are below.
Apply requires qualified frontend and fresh deployed checks of all three media
resources, not avatar readiness. Whole-service health remains DEGRADED until avatar
checks pass. Insufficient inventory preserves the committed experiment and uses
configured cooldown; true strategy exhaustion retains its minimum two-hour pause.
Suffix authorization remains extrapolative, not proof of every Googlevideo host.
This source is offline unit/fixture-verified only; no new image deployment or
autonomous three-CDN field acceptance is claimed. The historical results below
do not close that gate. Maximum strategy collection and PID1 global-failure
stay-alive are unfinished future increments, as is arbitrary declarative service
configuration. See [MANAGED_TARGET.md](../../MANAGED_TARGET.md) and
[GOOGLEVIDEO_DISCOVERY.md](../../GOOGLEVIDEO_DISCOVERY.md).
## Recorded Googlevideo suffix experiment (2026-10-12)
### Final field follow-up: DEGRADED / NOT READY
@@ -133,9 +156,11 @@ Isolated, accelerated shell supervision fixtures (no network):
Compose forwards `ZAPRET_AUTOTUNE_YOUTUBE_SERVICE` (`0` or `1`, default `0`),
`ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE` (`cold` or `adaptive`, default `cold`),
`ZAPRET_AUTOTUNE_VIDEO_ID` (default `dQw4w9WgXcQ`) and
`ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS` (JSON array of 1..5 unique VideoIDs;
default only the primary ID). Explicit empty/invalid settings are rejected,
not silently replaced. Adaptive requires service `1`. See `.env.example`.
`ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS` (optional JSON array of 1..5 unique VideoIDs).
Missing/empty inventory selects automatic service-mode samples: primary plus
`aqz-KE-bpKQ` and `jNQXAC9IVRw`, deduplicated. A nonempty explicit inventory
overrides those defaults, including an intentional single video. Invalid nonempty
settings are rejected. Adaptive requires service `1`. See `.env.example`.
Service `0` preserves legacy Player API/exact-host behavior.
Adaptive qualification is **post-warmup**, distinct from cold qualification;
+21 -1
View File
@@ -45,9 +45,21 @@ with tempfile.TemporaryDirectory(prefix='target-config-') as tmp:
assert json.loads(path.read_text())['password'] == base['SS_PASSWORD']
# Render privately, never print the config/password; config does not deploy.
compose_env = {k: v for k, v in base.items() if not k.startswith('ZAPRET_AUTOTUNE_')}
factory_cases = []
for overrides, service, mode, ids in (
({}, '0', 'cold', ['dQw4w9WgXcQ']),
({'ZAPRET_AUTOTUNE_VIDEO_ID': 'aqz-KE-bpKQ'}, '0', 'cold', ['aqz-KE-bpKQ']),
({'ZAPRET_AUTOTUNE_YOUTUBE_SERVICE': '1', 'ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE': 'adaptive'},
'1', 'adaptive', ['dQw4w9WgXcQ', 'aqz-KE-bpKQ', 'jNQXAC9IVRw']),
({'ZAPRET_AUTOTUNE_YOUTUBE_SERVICE': '1', 'ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE': 'adaptive',
'ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS': ''},
'1', 'adaptive', ['dQw4w9WgXcQ', 'aqz-KE-bpKQ', 'jNQXAC9IVRw']),
({'ZAPRET_AUTOTUNE_YOUTUBE_SERVICE': '1', 'ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE': 'adaptive',
'ZAPRET_AUTOTUNE_VIDEO_ID': 'aqz-KE-bpKQ'},
'1', 'adaptive', ['aqz-KE-bpKQ', 'jNQXAC9IVRw']),
({'ZAPRET_AUTOTUNE_YOUTUBE_SERVICE': '1', 'ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE': 'adaptive',
'ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS': '["aaaaaaaaaaa"]'},
'1', 'adaptive', ['aaaaaaaaaaa']),
({'ZAPRET_AUTOTUNE_YOUTUBE_SERVICE': '1', 'ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE': 'adaptive',
'ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS': '["dQw4w9WgXcQ","aqz-KE-bpKQ","jNQXAC9IVRw"]',
'SS_DNS_SERVER': '8.8.8.8'}, '1', 'adaptive', ['dQw4w9WgXcQ', 'aqz-KE-bpKQ', 'jNQXAC9IVRw']),
@@ -60,7 +72,15 @@ with tempfile.TemporaryDirectory(prefix='target-config-') as tmp:
settings = json.loads(result.stdout)['services']['target']['environment']
assert settings['ZAPRET_AUTOTUNE_YOUTUBE_SERVICE'] == service
assert settings['ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE'] == mode
assert json.loads(settings['ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS']) == ids
assert settings['ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS'] == overrides.get('ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS', '')
assert settings['SS_DNS_SERVER'] == overrides.get('SS_DNS_SERVER', '')
assert settings['ZAPRET_AUTOTUNE_SOCKS_PROXY'] == 'socks5h://127.0.0.1:1080'
factory_cases.append({'environment': {k: v for k, v in settings.items()
if k.startswith('ZAPRET_AUTOTUNE_')}, 'ids': ids})
# Only sanitized fixture settings cross into Go; never persist the password.
fixture = root / 'compose-factory.json'
fixture.write_text(json.dumps(factory_cases))
subprocess.run(['go', 'test', './cmd/zapret-autotune', '-run', '^TestManagedGooglevideoComposeForwarding$',
'-count=1'], cwd=ROOT, env=dict(env, AUTOTUNE_COMPOSE_CONFIG_FIXTURE=str(fixture)),
check=True, timeout=60)
print('target config fixtures passed')
+1 -1
View File
@@ -26,7 +26,7 @@ for setting in (
'ZAPRET_AUTOTUNE_YOUTUBE_SERVICE: ${ZAPRET_AUTOTUNE_YOUTUBE_SERVICE-0}',
'ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE: ${ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE-cold}',
'ZAPRET_AUTOTUNE_VIDEO_ID: ${ZAPRET_AUTOTUNE_VIDEO_ID-dQw4w9WgXcQ}',
"ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS: '${ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS-[\"${ZAPRET_AUTOTUNE_VIDEO_ID-dQw4w9WgXcQ}\"]}'",
"ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS: '${ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS:-}'",
):
assert setting in compose, setting
assert entrypoint.index('target-config-check || exit 64') < entrypoint.index('cat > "$config_dir/server.json"')
+1 -1
View File
@@ -16,7 +16,7 @@ services:
ZAPRET_AUTOTUNE_YOUTUBE_SERVICE: ${ZAPRET_AUTOTUNE_YOUTUBE_SERVICE-0}
ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE: ${ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE-cold}
ZAPRET_AUTOTUNE_VIDEO_ID: ${ZAPRET_AUTOTUNE_VIDEO_ID-dQw4w9WgXcQ}
ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS: '${ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS-["${ZAPRET_AUTOTUNE_VIDEO_ID-dQw4w9WgXcQ}"]}'
ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS: '${ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS:-}'
SOCKS_PORT: "1080"
ZAPRET_AUTOTUNE_TARGET_ROLE: managed-test
ZAPRET_AUTOTUNE_TARGET_ID: zapret-autotune-managed-v1