Step-by-step. Do every step in order. Total setup time: ~10–15 min.
Install these on the new machine before cloning.
Open PowerShell as Administrator and paste:
winget install --id OpenJS.NodeJS.LTS --silent --accept-source-agreements --accept-package-agreements
winget install --id Python.Python.3.12 --silent --accept-source-agreements --accept-package-agreements
winget install --id Google.Chrome --silent --accept-source-agreements --accept-package-agreements
winget install --id Git.Git --silent --accept-source-agreements --accept-package-agreementsThis installs Node.js LTS, Python 3.12, Chrome, and Git. (winget ships with Windows 11.) Close and reopen the terminal after installation so the new PATH takes effect.
| Tool | Where to get it |
|---|---|
| Node.js 20+ | https://nodejs.org/ |
| Python 3.10+ | https://www.python.org/downloads/ — check "Add Python to PATH" during install |
| Google Chrome | https://www.google.com/chrome/ |
| Git | https://git-scm.com/ |
In a fresh terminal:
node --version
python --version
git --version
All three should print versions. If python doesn't work, try python3.
git clone https://github.com/molotovgit/Creative_Automation.git
cd Creative_Automation
Or download the zip from GitHub and extract it.
Double-click setup.bat (or run setup.bat from a terminal in the repo folder).
It will:
- Create
.envfrom.env.exampleif it doesn't exist (so you only need to edit the values) - Run
npm install— installspuppeteerand other deps frompackage.json - Run
pip install -r requirements.txt— installs Python deps (notion-client,python-dotenv, etc.) - Launch two Chrome windows:
- Window 1 (port 9222) → opens chatgpt.com
- Window 2 (port 9223) → opens gemini.google.com and labs.google/fx/tools/flow
If Chrome is in a non-standard location, the script may not find it. Edit the CHROME_PATHS array in scripts/setup_chrome.cjs to point at your chrome.exe.
setup.bat already created .env for you (copied from .env.example). Open it in any text editor and fill in your real values:
NOTION_API_KEY=secret_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CHATGPT_EMAIL=your-chatgpt-email@example.com
CHATGPT_PASSWORD=your-chatgpt-password
GEMINI_EMAIL=your-gemini-email@example.com
GEMINI_PASSWORD=your-gemini-password
CDP_PORT=9222
GEMINI_CDP_PORT=9223
Leave CDP_PORT and GEMINI_CDP_PORT as-is — they must match what the scripts expect.
Where to get the NOTION_API_KEY:
- Go to https://www.notion.so/profile/integrations
- Click "+ New integration"
- Give it a name, pick the workspace that has your textbooks
- Copy the "Internal Integration Secret" (starts with
secret_orntn_) - Open your textbook root page in Notion → click "..." (top right) → "+ Add connections" → select your integration
The integration must have access to every page the pipeline will read.
The fetch_chapter.py script expects this exact hierarchy in your Notion workspace:
<Grade root page> (search-discoverable: "Grade 7", "7-sinf", etc.)
└── <Subject page> ("Tarix", "Jahon Tarixi", "Algebra", ...)
└── <Chapter page> (titled "1-mavzu: ...", "Chapter 1: ...", etc.)
└── chapter content
If your Notion doesn't follow this layout, the fetch will fail. You'll either need to:
- Restructure your Notion to match, OR
- Edit
tools/notion/navigator.pyto match your structure
Window 1 (ChatGPT):
- Log in to chatgpt.com with your account
Window 2 (Gemini + Flow):
- Tab 1: log in to gemini.google.com
- Tab 2: log in to labs.google/fx/tools/flow with an account that has Flow credits
- Leave both tabs open
Sign-in is one-time — sessions persist in dedicated profile directories (~/chrome-chatgpt-cdp/ and ~/chrome-gemini-cdp/). Future runs of setup.bat reuse them.
Open scripts/run_pipeline.cjs in any text editor. Find the CONFIG block at the top (around line 27):
const CONFIG = {
NOTION_URL: 'paste your notion link here',
GRADE: 7, // 5–11
LANG: 'uz', // 'uz' or 'ru'
SUBJECT: 'jahon tarixi', // subject name (fuzzy-matched in Notion)
CHAPTER: 1, // chapter number
};- Paste the Notion page URL of the chapter you want (for reference / printing in logs)
- Set
GRADE,LANG,SUBJECT,CHAPTERto match how the chapter is indexed in your Notion - Save the file
Double-click start.bat (or node scripts/run_pipeline.cjs).
The pipeline will:
- Verify both Chrome windows +
.envkeys (pre-flight) - Run all 5 stages — fetch → refine → prompts → images → animate
- Print a summary when done (
✓ PIPELINE DONE)
Walk away. Total time: ~50–60 min for a fresh chapter (most of it is image + video generation).
If anything fails partway, fix the issue and re-run start.bat — completed stages skip automatically (file-existence-driven).
All outputs land under the repo root:
chapters/g{GRADE}-{LANG}/{subject-slug}/ch{NN}-{title}.md ← Notion fetch
refined/g{GRADE}-{LANG}/{subject-slug}/ch{NN}-{title}.md ← ChatGPT-refined
prompts/g{GRADE}-{LANG}/{subject-slug}/ch{NN}-{title}.json ← 80 prompts
images/g{GRADE}-{LANG}/{subject-slug}/ch{NN}-{title}/*.png ← 80 PNGs
videos/g{GRADE}-{LANG}/{subject-slug}/ch{NN}-{title}/*.mp4 ← 80 MP4s
"Chrome not reachable on port 9222 / 9223"
The Chrome window is closed. Re-run setup.bat (skips windows that are already up).
"ModuleNotFoundError: No module named 'notion_client'"
Python deps not installed. Run setup.bat (it installs them) or manually: pip install -r requirements.txt.
"Cannot connect to keep-alive on :9222" (during REFINE)
ChatGPT Chrome window is closed, or the keepalive Python script isn't running. The simplest fix is re-running setup.bat.
"Auto-login failed"
You need to log in once manually inside the Chrome window opened by setup.bat. Sessions persist after that.
"No fetched chapter found"
The Notion structure doesn't match (see step 5), or the integration doesn't have access to the textbook pages (see step 4: edit .env and verify connections in Notion).
Stage failed mid-run
Re-run start.bat. Completed stages skip; the pipeline picks up where it left off.
Want to redo a specific stage
Delete that stage's output folder/file (e.g., delete images/... to redo image generation), then re-run start.bat.
| File | Purpose |
|---|---|
setup.bat |
One-time setup — bootstraps .env, installs Node + Python deps, launches Chrome windows |
start.bat |
Run-anytime — executes the full pipeline |
scripts/run_pipeline.cjs |
The orchestrator. Edit CONFIG here. |
scripts/setup_chrome.cjs |
Launches the two debug-port Chrome windows |
scripts/run_autonomous.cjs |
IMAGES stage wrapper (autonomous orchestrator) |
scripts/run_animator.cjs |
ANIMATE stage wrapper (auto-restart on crash) |
.env.example |
Template — committed; copied to .env by setup.bat |
.env |
Your real API keys & passwords (gitignored — auto-created from .env.example) |
requirements.txt |
Python deps |
package.json |
Node deps |
refine_prompt.txt |
The formula ChatGPT uses to refine chapters |
80_prompt_formula.txt |
The formula ChatGPT uses to generate image prompts |
GUIDE.md |
Quick-reference guide for day-to-day use |