fix(baoyu-post-to-x): keep browser open for manual publishing
This commit is contained in:
parent
4435366898
commit
4300e6899c
|
|
@ -504,6 +504,8 @@ Smart article illustration skill with Type × Style two-dimension approach. Anal
|
||||||
|
|
||||||
Post content and articles to X (Twitter). Supports regular posts with images and X Articles (long-form Markdown). Uses real Chrome with CDP to bypass anti-automation.
|
Post content and articles to X (Twitter). Supports regular posts with images and X Articles (long-form Markdown). Uses real Chrome with CDP to bypass anti-automation.
|
||||||
|
|
||||||
|
Plain text input is treated as a regular post. Markdown files are treated as X Articles. Scripts fill content into the browser, and the user reviews and publishes manually.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Post with text
|
# Post with text
|
||||||
/baoyu-post-to-x "Hello from Claude Code!"
|
/baoyu-post-to-x "Hello from Claude Code!"
|
||||||
|
|
|
||||||
|
|
@ -504,6 +504,8 @@ npx skills add jimliu/baoyu-skills
|
||||||
|
|
||||||
发布内容和文章到 X (Twitter)。支持带图片的普通帖子和 X 文章(长篇 Markdown)。使用真实 Chrome + CDP 绕过反自动化检测。
|
发布内容和文章到 X (Twitter)。支持带图片的普通帖子和 X 文章(长篇 Markdown)。使用真实 Chrome + CDP 绕过反自动化检测。
|
||||||
|
|
||||||
|
纯文本输入默认按普通帖子处理,Markdown 文件默认按 X 文章处理。脚本会将内容填入浏览器,用户需手动检查并发布。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 发布文字
|
# 发布文字
|
||||||
/baoyu-post-to-x "Hello from Claude Code!"
|
/baoyu-post-to-x "Hello from Claude Code!"
|
||||||
|
|
|
||||||
|
|
@ -98,9 +98,13 @@ Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystrok
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Regular Posts
|
## Post Type Selection
|
||||||
|
|
||||||
Text + up to 4 images.
|
Unless the user explicitly specifies the post type:
|
||||||
|
- **Plain text** + within 10,000 characters → **Regular Post** (Premium members support up to 10,000 characters, non-Premium: 280)
|
||||||
|
- **Markdown file** (.md) → **X Article**
|
||||||
|
|
||||||
|
## Regular Posts
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
${BUN_X} ${SKILL_DIR}/scripts/x-browser.ts "Hello!" --image ./photo.png
|
${BUN_X} ${SKILL_DIR}/scripts/x-browser.ts "Hello!" --image ./photo.png
|
||||||
|
|
|
||||||
|
|
@ -187,20 +187,13 @@ export async function postToX(options: XBrowserOptions): Promise<void> {
|
||||||
await sleep(2000);
|
await sleep(2000);
|
||||||
console.log('[x-browser] Post submitted!');
|
console.log('[x-browser] Post submitted!');
|
||||||
} else {
|
} else {
|
||||||
console.log('[x-browser] Post composed (preview mode). Add --submit to post.');
|
console.log('[x-browser] Post composed. Please review and click the publish button in the browser.');
|
||||||
console.log('[x-browser] Browser will stay open for 30 seconds for preview...');
|
|
||||||
await sleep(30_000);
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (cdp) {
|
if (cdp) {
|
||||||
try { await cdp.send('Browser.close', {}, { timeoutMs: 5_000 }); } catch {}
|
|
||||||
cdp.close();
|
cdp.close();
|
||||||
}
|
}
|
||||||
|
chrome.unref();
|
||||||
setTimeout(() => {
|
|
||||||
if (!chrome.killed) try { chrome.kill('SIGKILL'); } catch {}
|
|
||||||
}, 2_000).unref?.();
|
|
||||||
try { chrome.kill('SIGTERM'); } catch {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue