Communitygithub.com

Dudu-Director-Video-kit

由Dudu(AI推广视频导演)使用,驱动Playwright浏览器中已登录的Gemini(Nano Banana图像、Veo视频)、ChatGPT(GPT图像)和Kling(图像转视频)。包含有效的点击路径、上传下载方案以及遇到的所有故障修复。

Dudu-Director-Video-kit 是什么?

这个技能包(skill kit)专为AI视频导演Dudu设计,用于通过Playwright浏览器自动化操作Gemini、ChatGPT和Kling这三个AI平台,从而生成图像和视频。它提供了经过验证的点击路径、文件上传下载方案以及常见问题的修复方法,特别针对希伯来语和英语界面进行了优化。技能包详细说明了处理顺序的重要性(例如必须先选择图像工具再发送提示词)、文件管理规则(所有文件必须在工作区内)以及关键平台限制(如ChatGPT的分辨率限制为3:2)。对于Gemini平台,它支持Nano Banana图像生成和Veo视频生成;对于ChatGPT,提供了GPT Image的未验证方案;对于Kling,则实现了图像转视频的自动化。技能包还包含视频片段审查工具(contact_sheet和motion_report),以及针对常见问题的处理策略,如避免使用相同的聊天记录导致重复输出、处理文件选择器冲突等。用户需要确保已在浏览器中手动登录各个平台。

兼容平台~Claude Code✓Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/EyalZameret/Dudu-Director-Video-kit/tree/HEAD/.claude/skills/dudu-browser

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Dudu: 使用Playwright驱动Gemini、ChatGPT和Kling

使用来自.mcp.json的Playwright MCP服务器。以下选择器已于2026年10月在希伯来语Gemini界面和英语Kling界面上验证。ChatGPT方案(第1b节)尚未验证。Gemini标签以接受希伯来语和英语的正则表达式形式编写;英语措辞未经验证,因此首次在另一种UI语言上运行时,请使用browser_snapshot检查实际按钮名称并在此处修复正则表达式。Web UI会变化:当选择器失败时,请截取快照(browser_snapshot或browser_find),找到新的选择器并更新此文件。

0. 基本规则

  • 所有者为登录者。打开网站,告诉所有者“请在Playwright窗口中登录,登录完成后告诉我”,然后等待。切勿输入凭据。
  • 自动化消费者Web UI可能与网站的服务条款冲突。请告知所有者一次,将使用量保持在人工规模,并提供官方API作为替代方案。
  • 文件必须位于工作区内(Playwright MCP拒绝其他根路径)。将所有者粘贴的任何引用复制到project/frames/中。
  • 在继续之前检查每个结果(读取图像;查看视频片段联系单)。

1. Gemini:图像(Nano Banana)

顺序至关重要。 如果未先选择图像工具就发送提示词,Gemini会以文本回复(“我无法在此处生成图像”),并且下一次尝试会挂起5分钟以上。始终:新聊天 → 选择工具 → 上传引用 → 发送提示词。

下面使用的标签(希伯来语界面已验证,英语未验证):

正则表达式希伯来语界面英语界面(请检查)
TOOLSהעלאה וכליםUpload and tools
CREATE_IMAGEיצירת תמונהCreate image
DOWNLOAD_IMAGEהורדת תמונה בגודל מלאDownload full size image

步骤A,一次browser_run_code_unsafe调用(打开操作系统文件选择器):

async (page) => {
  const TOOLS = /העלאה וכלים|Upload and tools/i,   // 子字符串匹配,如纯字符串名称
  const CREATE_IMAGE = /^(יצירת תמונה|Create images?)$/i;
  await page.goto('https://gemini.google.com/app'); await page.waitForTimeout(3000);
  await page.getByRole('button', { name: TOOLS }).first().click(); await page.waitForTimeout(1000);
  await page.getByText(CREATE_IMAGE).first().click(); await page.waitForTimeout(1500);
  await page.getByRole('button', { name: TOOLS }).first().click(); await page.waitForTimeout(1000);
  await page.locator('[data-test-id="local-images-files-uploader-button"]').click();
  return 'chooser';
}

步骤B:使用引用文件的绝对路径(1-4个文件)执行browser_file_upload。 步骤C,提示词和下载:

async (page) => {
  await page.waitForTimeout(4000);
  const box = page.getByRole('textbox').first();
  await box.fill(PROMPT); await page.waitForTimeout(800); await box.press('Enter');
  const btn = page.getByRole('button', { name: /הורדת תמונה בגודל מלא|Download full[- ]size image/i });
  await btn.first().waitFor({ state: 'attached', timeout: 180000 }); await page.waitForTimeout(3000);
  const [d] = await Promise.all([page.waitForEvent('download', { timeout: 60000 }), btn.last().click({ force: true })]);
  await d.saveAs(OUT_PATH); return 'ok';
}

同一聊天中的编辑(移除Logo、修复眼睛、替换额外元素):导航到聊天URL,统计下载按钮的数量,发送编辑指令,等待按钮数量增加:

await page.waitForFunction(n => document.querySelectorAll('button[aria-label="הורדת תמונה בגודל מלא"], button[aria-label="Download full size image"]').length > n, before, { timeout: 180000 });

典型时间:每张图像20-40秒。

陷阱:

  • browser_run_code_unsafe不能在文件选择器打开时运行。请按上述A/B/C步骤分开执行。
  • 之前的聊天会保留上下文:使用新聊天可避免“返回相同图像”的问题。

1b. ChatGPT:图像(GPT Image),适用于没有Gemini的所有者

状态:未验证。 此方案是根据chatgpt.com的通用结构编写的,并非来自实际记录运行。首次运行时:在每个步骤使用browser_snapshot截取快照,使用实际选择器,并用有效的选择器(和日期)替换下面的猜测。在此之前,请使用单独的、小型的browser_*调用逐步执行,而不是一个长脚本。

开始前,请告知所有者一次:OpenAI的服务条款限制通过自动化方式提取输出;请保持使用量在人工规模,否则请使用所有者自己的密钥调用OpenAI Images API。

流程(与Gemini相同的顺序:新聊天、引用、提示词、等待、下载):

  1. browser_navigate到https://chatgpt.com/(每次都打开新聊天,避免“返回相同图像”)。所有者登录。
  2. 引用: 查找隐藏的input[type=file],并使用setInputFiles设置绝对路径(1-4个文件)。如果没有,则点击附件按钮(“+”或回形针;检查快照),并使用browser_file_upload打开文件选择器。等待每个缩略图上传完成。
  3. 提示词: 编辑器通常是一个contenteditable框(通常是#prompt-textarea)。以Create an image:开头,这样它就不会返回文本回复;或者如果快照显示有图像工具,则从“+”菜单中选择它。然后输入常规提示词(引用、镜头描述、风格、负面提示)。
  4. 比例: ChatGPT提供方形、竖屏和横屏3:2(1536x1024),不支持16:9。请要求landscape 3:2,并添加keep all important content inside the central 16:9 band。tools/build_cut.py会在编辑过程中将其裁剪为16:9。
  5. 等待: 通常30-120秒。等待直到最后一个回答中出现新的img(其alt文本通常是“Generated image”),并且进度指示器消失。
  6. 下载: 优先使用图像自己的下载按钮(将鼠标悬停在图像上;检查快照)。否则,读取新img的src并通过浏览器的cookies保存:
    async (page) => {
      const src = await page.locator('img[alt*="Generated"]').last().getAttribute('src');
      const res = await page.request.get(src);
      require('fs').writeFileSync(OUT_PATH, await res.body()); return res.status();
    }
    
    如果require在browser_run_code_unsafe中不可用,则使用下载按钮或browser_take_screenshot截取图像元素作为最后手段(质量较低;请告知所有者)。
  7. 编辑(移除Logo、修复眼睛):留在同一聊天中,写入Edit only ...: ... Change nothing else.。ChatGPT也可能提供“选择区域”编辑器;两者皆可。

我们在GPT Image上看到的情况(2026年10月,角色表):

  • 它在角色和表情捕捉方面表现最佳(年龄、紧张、狂野头发),面板非常一致。
  • 分辨率较低且更平滑,光线“过于干净”,不如Nano Banana;在一张特写中,眼睛看向不同的方向。请添加natural skin texture, visible pores, unretouched, sharp focus, both eyes looking at the camera,并检查每个脸部中的眼睛。
  • 计划配额:聊天计划中的图像生成有变化的限制。如果提示等待,请停止并告知所有者,而不是重试。

2. Gemini:视频(Veo)

与图像类似,但选择יצירת סרטון(英语界面:“Create video”)并上传关键帧。使用הורדת הסרטון按钮(英语界面:“Download video”)下载。每个片段几分钟,720p,约8-10秒。

3. Kling:图像转视频

Kling有一个真正的input[type=file],因此无需文件选择器。每个镜头调用一次(每个约70-80秒):

async (page) => {
  const seen = () => page.evaluate(() => performance.getEntriesByType('resource')
                       .map(e => e.name).filter(n => /-output\.mp4\?/.test(n)));
  const gen = () => page.locator('button').filter({ hasText: /Generate/ }).filter({ hasNotText: /Generated/ }).last();
  await page.goto('https://kling.ai/app/video/new?ac=7'); await page.waitForTimeout(5000);
  const before = new Set(await seen());
  await page.locator('input[type=file]').first().setInputFiles(KEYFRAME); await page.waitForTimeout(5000);
  await page.locator('[contenteditable="true"], textarea').first().click();
  await page.keyboard.type(PROMPT, { delay: 1 });
  let label = await gen().innerText();
  if (/60/.test(label)) { await page.getByText('Native Audio', { exact: true }).click(); label = await gen().innerText(); }
  if (!/40/.test(label)) return 'unexpected cost: ' + label;          // 停止并询问所有者
  await gen().click();
  const t0 = Date.now(); let url = null;
  while (Date.now() - t0 < 300000) { await page.waitForTimeout(8000); url = (await seen()).find(u => !before.has(u)); if (url) break; }
  return url;
}
```\n然后在浏览器外部下载:`python tools/download.py "<url>" project/clips/shotNN.mp4`。

陷阱:
- `getByText('Generate')`也会匹配“1/1 Generated”标签。请使用上述按钮过滤器。
- `<video>`使用blob URL,`fetch`会失败;请改为从性能条目中获取CDN URL。
- 每次检查“Generate”按钮上的价格;Native Audio会增加成本。

## 4. 审查视频片段
不要在浏览器中审查:`<video>`的搜索会返回过时的帧。请使用`python tools/contact_sheet.py`和`python tools/motion_report.py`。

Individual skills in this repo

This repo contains 8 individual skills — each has its own dedicated page.

EyalZameret/Dudu-Director-Video-kit

Used by Dudu (AI promo video director) for stage 7. Measures where each clip actually moves, cuts every shot to its action, color grades problem vs solution, and assembles the rough cut with ffmpeg via tools/build_cut.py.

EyalZameret/Dudu-Director-Video-kit

Used by Dudu (AI promo video director) for stage 6. Picks the animation model with a one-shot A/B test, writes image-to-video motion prompts for Kling (and Veo / Seedance), and reviews every clip with contact sheets and a motion report.

EyalZameret/Dudu-Director-Video-kit

Used by Dudu (AI promo video director) at every gate. Checks script claims against project/product.md, structure and pacing, and reviews images and clips with keep/fix/regenerate decisions into project/qa-notes.md.

EyalZameret/Dudu-Director-Video-kit

Used by Dudu (AI promo video director) for stages 1-2. Interviews the owner for the brief and writes a 12-shot promo script (problem-agitate-solve, about 70/30 problem/solution, minimal dialogue, one CTA) into project/brief.md and project/script.md.

EyalZameret/Dudu-Director-Video-kit

Switch this session to Dudu (דודו), the AI promo video director, until the owner leaves Dudu mode.

EyalZameret/Dudu-Director-Video-kit

Used by Dudu (AI promo video director) after the picture cut. Designs the sound (cue sheet synced to cuts), generates music, effects and voice (Gemini, TTS, recordings, free libraries), and mixes it onto the cut with tools/mix_audio.py into a finished film.

EyalZameret/Dudu-Director-Video-kit

Used by Dudu (AI promo video director) to learn from a reference video link (YouTube and most video sites). Downloads it for private analysis, detects every cut, reviews one frame per shot, writes a structured analysis into library/study/<id>/analysis.md and updates library/INDEX.md, then deletes the video. Use when the owner shares a link and says "learn from this", "study this", "do it like this", or asks for a style taken from an ad.

EyalZameret/Dudu-Director-Video-kit

Used by Dudu (AI promo video director) for stages 3-5. Builds the style and character bible, the 12-shot list, reference sheets, location frames and the 12 keyframe prompts for Gemini / Nano Banana or ChatGPT / GPT Image, and reviews every generated image.

相关技能