← The lab

AI automation systems

A Shorts factory for an Arabic and an English channel that runs every day, and eight systems I built around it: learning from the numbers, sourced topics, four-platform publishing, chat control and a night watch.

  • 9systems working together
  • 6videos every day
  • 4publishing platforms
  • 90+automated tests

The Shorts factory.

An Arabic Shorts channel and an English one, run by a production line I built end to end. These are its stations, in order.

  1. PLAN

    Plan

    n8n schedules the work and runs every step on time.

    n8n
  2. WRITE

    Write

    A language model writes the script, with a second model ready if the first one fails.

    LLM
  3. CHECK

    Check

    A validator rejects a script that breaks the length, predicted duration or hook rules, and asks for a rewrite.

    validator
  4. VOICE

    Voice

    Narration by ElevenLabs, edge-tts or Gemini, depending on the setting.

    ElevenLabsedge-ttsGemini
  5. RENDER

    Render

    MoneyPrinterTurbo assembles the video on a VPS.

    MoneyPrinterTurboVPS
  6. PUBLISH

    Publish

    The finished video goes out to YouTube, and to TikTok on the Arabic line.

    YouTubeTikTok

Eight systems that keep it running alone.

The factory on its own produces. What surrounds it makes it learn, repair itself, and tell me when it stumbles. Every system here runs on the same server.

02 · LOOPDaily, with a weekly report

The learning loop

Six videos a day with nothing measured is six guesses a day. This system collects every video's numbers and hands them back to the writer the next morning.

  1. Collect stats
  2. Retention
  3. Hook bank
  4. Weekly report
How it works
  • Pulls views and retention for every video from YouTube Analytics into one file.
  • The hook bank ranks the opening lines that kept people watching longest, for the writer to read first.
  • Competitor watch: what is spreading on other channels in the last 48 hours, in numbers only.
  • Audience voice: a question asked three times in the comments is a video with its hook already written.
YouTube AnalyticsPythonLLM
03 · TOPICSEvery morning; replies hourly

The topic engine

Topics that never run out and never arrive without a source. It harvests what people search for, and brings in facts with a citable reference.

  1. What people type
  2. Sourced facts
  3. Channel voice
  4. Topic sheet
How it works
  • Harvests search autocomplete: what people actually type, the right shape for a curiosity channel.
  • A second path starts from a fact with a source, then a language model rewrites it in the channel's voice.
  • Every video promises its source on request, and a bot reads the comments hourly and answers the word 'source' with the link.
  • The English topic stock refills itself every morning before it can run dry.
Google SheetsLLMYouTube API
04 · PUBLISHAfter every approved video

The publisher

One video goes out to four platforms, exactly once per platform, even when the step is run again.

  1. Approved video
  2. YouTube
  3. TikTok
  4. Instagram · Facebook
How it works
  • Publishing is idempotent: running the step again never posts the same video twice.
  • TikTok's OAuth server runs as a systemd service that comes back on its own after a reboot, with a Playwright uploader as a fallback.
  • The Instagram token refreshes itself before it expires.
  • Published videos move to Google Drive so the disk never fills, with a scope that can only see what it created.
YouTubeTikTokInstagramFacebookrclone
05 · CHATOPSOn demand

Control from the chat

I run the factory from Telegram: read the scripts, approve the video, rerun a single row, without opening the server.

  1. Signed message
  2. Owner check
  3. Command on the box
  4. Reply with result
How it works
  • /quota shows what is left of the voice credit, the language model credit and the disk.
  • /retry puts one row back in the queue and runs it; /render adds a topic and renders it immediately.
  • The script lab posts one card per script: the hook, the numbers the validator checks, and the reasons when it refuses.
  • Only the owner's key can command. Not an agent, not a member, not a reaction.
Telegramn8nDocker
06 · STORYOn its own schedule

The cinematic story line

A second line for illustrated stories: generated scenes, real footage and narration, cut together with ffmpeg.

  1. Story script
  2. Generated scenes
  3. Footage & voice
  4. Assembly
How it works
  • Scenes are generated with FLUX and Veo, and real footage is searched on Pexels automatically.
  • Narration by ElevenLabs, and the whole assembly in ffmpeg inside the render container.
  • One fixed rule: a frame is never frozen. A segment that comes out short stops the job instead of being stretched.
  • The scene pack reaches Telegram for review before the final cut.
FLUXVeoPexelsElevenLabsffmpeg
07 · QCOn every video

The quality and cost gate

No video reaches me for approval before it is measured: loudness, black frames, silence, and what it cost.

  1. Finished video
  2. Loudness
  3. Frames & silence
  4. Cost per video
How it works
  • Measures loudness in LUFS and detects black frames and long silences.
  • Its first run found a published video at -23.4 LUFS while platforms normalise near -14, so it played noticeably quieter.
  • The cost tracker works out what each video cost, and says plainly what could not be measured.
  • Voice speeds are measured by real synthesis and timing, not estimated.
ffmpegebur128Python
08 · OPSEvery few minutes; nightly

The night watch

A system that runs alone needs something to notice when it stops. This one notices within minutes, and backs everything up every night.

  1. Watchdog
  2. Daily heartbeat
  3. Encrypted backup
  4. Restore test
How it works
  • The watchdog notices a stalled render or a fallen service within minutes, and only reports: a hung render and a slow one look alike, and killing a healthy one costs a video.
  • An encrypted backup leaves the server every night, and the restore is actually tested in a temporary container.
  • A daily check compares the code in the repository with what is really running on the server.
  • Alerts reach me on Telegram, and Buzz, where AI agents read them and dig into the cause.
systemdrcloneDockerBuzz
09 · PANELAlways on

The control panel

A password-protected web panel where I pick the voice, speed, delivery style and music for each line, and see the balances.

  1. Voice
  2. Speed & style
  3. Music
  4. Balance cards
How it works
  • Each line, Arabic and English, has its own voice, speed and music, saved and read by the next render.
  • Balance cards refresh on page load; a missing reading shows 'unavailable', never an old number stated with confidence.
  • Each script's expected length is worked out from the chosen voice's speed, so the validator knows when it runs long.
PythonCaddyHTML