🎬 Open-source, self-hosted AI agent that runs a YouTube channel end to end: researches topics, writes scripts, generates narration, visuals and video, optimizes SEO, and publishes after your approval, then learns from analytics. Works with Gemini, OpenAI, OpenRouter, DeepSeek and more.
JavaScript ai-agentsautomationcontent-automationcontent-creationcontent-strategygoogle-geminijavascriptnodejsopenaiself-hostedseo-optimizationsocial-media-automationthumbnail-generatorvideo-generationyoutube-apiyoutube-automationyoutube-botyoutube-channelyoutube-shortsyoutube-uploader
fix: fall back from broken DarkzSEO runtimes
darkzOGxd52b40d94a00
diff --git a/.env.example b/.env.exampleindex 44db0b6..df82836 100644--- a/.env.example+++ b/.env.example@@ -53,7 +53,7 @@# FFmpeg (optional override; resolution order: FFMPEG_PATH > bundled ffmpeg-static > system PATH)# FFMPEG_PATH=-# DarkzSEO discoverability preflight (bundled and advisory; external checkout optional)+# DarkzSEO discoverability preflight (bundled and advisory; external checkout is explicit and falls back safely)# DARKZSEO_PYTHON=python# DARKZSEO_PATH=../darkzseo/darkzseo.py# DARKZSEO_TIMEOUT_MS=30000diff --git a/README.md b/README.mdindex 4ff350b..71041f0 100644--- a/README.md+++ b/README.md@@ -25,7 +25,7 @@ Research topics → write scripts → generate narration and visuals → assembl- **Outcome & ROI Studio:** align the operator with a measurable KPI, target window, budget, and available revenue/cost evidence without converting missing economics into false zeroes.- **Platform-ready foundation:** audits already retain their target platform, providing the durable contract for planned TikTok and Instagram/Reels publishing and analytics adapters.-The content preflight works out of the box. Set `DARKZSEO_PATH` only when developing against a separate DarkzSEO 1.4+ checkout.+The content preflight works out of the box. Set `DARKZSEO_PATH` only when developing against a separate DarkzSEO 1.4+ checkout. If that optional external runtime is missing or broken, AgentTube automatically uses the bundled audit.See the complete release history in [CHANGELOG.md](CHANGELOG.md).diff --git a/test.js b/test.jsindex a735ca3..f21f3b7 100644--- a/test.js+++ b/test.js@@ -1779,6 +1779,28 @@ class SystemTest {) {throw new Error('The bundled discoverability audit did not provide the public content contract');}+ const configuredPath = process.env.DARKZSEO_PATH;+ delete process.env.DARKZSEO_PATH;+ try {+ if (new DarkzSEOAdapter().scriptPath !== null) {+ throw new Error('DarkzSEO selected an external Python checkout without explicit configuration');+ }+ } finally {+ if (configuredPath === undefined) delete process.env.DARKZSEO_PATH;+ else process.env.DARKZSEO_PATH = configuredPath;+ }+ const brokenExternal = new DarkzSEOAdapter({ scriptPath: 'broken-darkzseo.py' });+ brokenExternal.auditExternal = async () => {+ const error = new Error('No module named darkzseo');+ error.code = 'DARKZSEO_FAILED';+ throw error;+ };+ const fallbackReport = await brokenExternal.audit({+ id: 'external-fallback', platform: 'youtube', title: 'Fallback audit'+ });+ if (fallbackReport.engine.version !== '1.4.0-bundled' || fallbackReport.status === 'unavailable') {+ throw new Error('A broken external DarkzSEO runtime did not fall back to the bundled audit');+ }await db.saveProductionData({id: productionId, status: 'needs_review', assets: {}, timeline: {},scheduledPublishTime: null, priority: 50, estimatedDuration: '1:00'diff --git a/utils/discoverability-adapters/darkzseo.js b/utils/discoverability-adapters/darkzseo.jsindex 3b763dc..28ec3e9 100644--- a/utils/discoverability-adapters/darkzseo.js+++ b/utils/discoverability-adapters/darkzseo.js@@ -1,5 +1,4 @@const { spawn } = require('child_process');-const fs = require('fs');const path = require('path');const AUTHORITY_DOMAINS = [@@ -152,8 +151,7 @@ class DarkzSEOAdapter {resolveScriptPath() {if (process.env.DARKZSEO_PATH) return path.resolve(process.env.DARKZSEO_PATH);- const siblingCheckout = path.resolve(__dirname, '..', '..', '..', 'darkzseo', 'darkzseo.py');- return fs.existsSync(siblingCheckout) ? siblingCheckout : null;+ return null;}command() {@@ -179,7 +177,11 @@ class DarkzSEOAdapter {async audit(contentPackage) {const command = this.command();if (!command) return auditContent(contentPackage);- return this.auditExternal(command, contentPackage);+ try {+ return await this.auditExternal(command, contentPackage);+ } catch (_error) {+ return auditContent(contentPackage);+ }}async auditExternal(command, contentPackage) {