Install
openclaw skills install jeffli-content-factoryCreate complete WeChat Official Account viral articles from a user-provided title by researching high-view YouTube videos, confirming topic/outline with user...
openclaw skills install jeffli-content-factory标题 + 开头 = 80%的阅读量
文章必须给用户带来真正价值:
Hook 是必须的:开头必须有一个 Hook,不能直接进入正文。
Hook 的结构:承认一个普遍痛点 + 今天这期的独特发现
Jeff 给的示范: 「大家使用 OpenClaw,其实并没有特别好的找到商业应用场景。今天通过地图 API 的结合,让我们看到了更多商业落地应用的可能性。」
其他 Hook 示例:
一句话总结:开头先承认用户的困惑或局限,再抛出今天的发现,让读者觉得『这正是我需要的』。
2-3个具体案例,层层递进:
每个案例包含:
| 维度 | Qwen3.5篇 | MiniMax M2.5篇 | Seedance 2.0篇 |
|---|---|---|---|
| 标题 | 争议词+结论 | 疑问句+颠覆 | 对比+数字 |
| 开头 | 问题切入 | 观察洞察 | 回应期待 |
| 结构 | 2.0→3.0升级 | 基础→附加→终极 | 行业分类 |
| 干货 | 代码配置 | 提示词实测 | 完整工作流 |
| 真诚 | 报错经历 | 槽点承认 | 不足之处 |
| 结尾 | 心里话升华 | 测试入口 | Agent未来 |
1. 选题精准
2. 结构清晰
3. 语言生动
4. 利他思维
5. 平台友好
Generate complete WeChat Official Account "viral-style" articles using YouTube research, user confirmation, and professional writing with self-iteration. Use this skill when given a topic/title and asked to research, create, and write a complete WeChat article with both MD and HTML outputs.
Before starting any research, MANDATORY tool check:
yt-dlp --version
If not installed or command fails:
pip install yt-dlpls scripts/yt_dlp_search.py
ls scripts/yt_dlp_captions.py
If scripts missing:
~/.claude/skills\content-factory\scripts\# Test Tavily (primary) - check credentials first
python3 -c "import json; print(json.load(open('/root/.openclaw/credentials/tavily.json'))['api_key'])" && echo "Tavily: OK"
# Test Brave (fallback) - check credentials
python3 -c "import json; print(json.load(open('/root/.openclaw/credentials/brave.json'))['api_key'])" && echo "Brave: OK"
# Test smart_search script
python3 /root/.openclaw/workspace/scripts/smart_search.py "test" --max-results 1 2>&1 | head -5
If Tavily/Brave credentials exist:
If credentials missing:
Always inform user of tool status:
IMPORTANT PRINCIPLE:
python3 /root/.openclaw/workspace/scripts/smart_search.py "test" --max-results 1web_search tool as primary (it has separate Brave key config)IMPORTANT: Research from diverse web sources - YouTube is a KEY source but not the ONLY source.
Primary Research Sources (in priority order):
YouTube Videos (Key source for case studies and expert insights)
CRITICAL: YouTube Content Extraction Priority Order
PRIMARY METHOD (Try First):
scripts/yt_dlp_search.py to search and collect video metadata
python scripts/yt_dlp_search.py "your search query" --max-results 10
scripts/yt_dlp_captions.py to download subtitles/transcripts
python scripts/yt_dlp_captions.py VIDEO_URL --whisper-if-missing
FALLBACK METHOD (If scripts fail):
LAST RESORT (If all YouTube access fails):
Content Extraction Guidelines:
references/youtube_research_checklist.md for detailed extraction stepsOfficial Documentation & Announcements
Industry Analysis & Reports
Expert Blogs & Technical Content
Community Discussions & Reviews
Research Strategy:
Build 5-10 diverse search queries covering:
Use WebSearch and WebFetch tools to gather content from multiple sources
Diversify source types: Mix videos, articles, reports, and discussions
Prioritize recent content: Focus on material from the last 3-6 months unless topic requires historical context
Content Extraction Guidelines:
When web access is unavailable:
references/wechat_viral_frameworks.md to diversify angles and hooks.CRITICAL: Before presenting options to user, write full research context to shared memory.
This is required because: the cron job runs in an isolated session. After presenting options via Feishu, the session ends. When the user responds with "选X" in the main session, Chief Agent must be able to retrieve the research context.
Write to this file:
/root/.openclaw/workspace/memory/daily/research-YYYY-MM-DD.md
File must include:
Format:
# Research - YYYY-MM-DD
## Candidate 1 (Recommended)
**Title:** ...
**Target:** ...
**Source URLs:** https://youtube.com/... (CRITICAL - include all)
**Outline:** ...
## Candidate 2
...
🚨 CRITICAL: Topic Direction - Application-Focused (2026-03-17 更新)
⚠️ 禁止生成纯技术类选题!以下方向禁止出现:
✅ 必须生成应用导向选题!方向优先级:
Skills - Agent Skills 使用技巧
应用场景 - AI Agent 实际案例
商业模式分析 - AI 创业与盈利
工具评测 - 真实体验对比
案例分享 - AI 落地实录
OpenClaw 专题 - Agent 编排实战
选题评估标准:
🚨 CRITICAL: Topic Freshness Requirement (2026-03-09)
after:2026-03-08 or similar8d2abf78b8490403831aae82052e8e107054b856
CRITICAL: Before proceeding to write the full article, MUST confirm with user:
Once the topic and outline are confirmed:
Phase 1: Initial Draft
references/reference.html:
Phase 2: Self-Iteration
Phase 3: Quality Review & Scoring (MANDATORY)
After completing the MD draft, perform a structured quality review and scoring:
Scoring Criteria (100 points total):
| Category | Points | Criteria |
|---|---|---|
| 精炼度 | 20 | 无重复表达、无废话("我认为/我觉得")、每句有新信息 |
| 数据真实性 | 20 | 所有案例和数据可追溯到研究来源、无杜撰 |
| 结构清晰度 | 15 | 逻辑流畅、层次分明、移动端友好 |
| 标题吸引力 | 15 | 开头3秒抓住注意力、价值主张明确 |
| 可执行性 | 15 | 行动建议具体可操作、读者能立即应用 |
| 语言质量 | 15 | 专业自信、第一人称一致、无语法错误 |
Scoring Process:
📊 文章质量评分报告
━━━━━━━━━━━━━━━━━━━━━
精炼度: XX/20 [具体问题说明]
数据真实性: XX/20 [具体问题说明]
结构清晰度: XX/15 [具体问题说明]
标题吸引力: XX/15 [具体问题说明]
可执行性: XX/15 [具体问题说明]
语言质量: XX/15 [具体问题说明]
━━━━━━━━━━━━━━━━━━━━━
总分: XX/100
Decision Logic:
Auto-fix priorities for score < 85:
在生成4种格式之前,必须先写入飞书云文档等待确认!
Step 1: 创建飞书云文档
[待确认] {文章标题}Step 2: 通知用户确认
Step 3: 用户确认后
⚠️ 重要:禁止跳过此步骤直接生成4种格式!
Phase 4: Final Polish
<hr/> tags between paragraphs in HTML output (markdown --- is acceptable)Phase 5: Generate Infographics for Key Data (HTML Only)
CRITICAL: If article contains core data visualizations, generate infographics using NotebookLM
When to generate infographics:
Infographic generation workflow:
Identify data visualization opportunities in the article:
Use notebooklm-api skill to generate infographics:
# For each key data point, generate an infographic
notebooklm generate infographic "Create a professional infographic showing [data description].
Use blue color scheme (#1a5490, #2980b9, #3498db) to match article theme.
Modern, clean design with clear data visualization. Include: [specific metrics]"
Color scheme requirements (MUST match HTML theme):
Wait for generation and download:
# Wait for infographic completion
notebooklm artifact wait <artifact_id> --timeout 900
# Download to output directory
notebooklm download infographic "YYYY-MM-DD-[slug]-[data-name].png"
CRITICAL: Compress image for WeChat upload:
# NotebookLM generates large PNG files (5-10MB) that timeout during WeChat upload
# ALWAYS compress to JPEG before publishing
python scripts/compress_image.py "YYYY-MM-DD-[slug]-[data-name].png"
# This creates: YYYY-MM-DD-[slug]-[data-name]-compressed.jpg (typically < 1MB)
# Compression: PNG 5.93MB → JPEG 0.68MB (88% reduction, quality=85)
Insert into HTML output:
<figure> structure with caption and source<figure style="margin: 40px 0;">
<img src="2026-01-18-article-slug-market-growth-compressed.jpg"
alt="Market Growth Visualization"
class="article-image">
<figcaption class="image-caption">
SaaS市场增长趋势 (2025-2032)
</figcaption>
<p class="image-source">
数据来源:<a href="[source_url]" target="_blank">[Source Name]</a>
</p>
</figure>
Typical infographics to generate (2-4 per article):
Example prompts for common data types:
Market Growth:
"Create a professional infographic showing SaaS market growth from $315B (2025) to $1.13T (2032).
Use ascending bar chart or line graph. Blue color scheme (#1a5490, #2980b9, #3498db).
Highlight 20%+ CAGR. Modern business style."
Percentage Trend:
"Create a professional infographic showing 36.3% of new companies are solo-founded in 2026,
compared to <10% in 2025. Show dramatic 3x+ growth. Blue color scheme matching corporate theme.
Use pie chart or comparison bars."
Cost Comparison:
"Create a professional side-by-side comparison infographic: Traditional (5-person team, $25k/month,
$50k+ MRR to break even) vs Solo+AI ($500/month, $5k MRR profitable). Blue color scheme.
Clear visual contrast."
Important notes:
YYYY-MM-DD-[article-slug]-[data-description].png⚠️ 仅在用户确认飞书文档后生成!
MANDATORY: Always generate ALL FOUR formats
Format 1: Markdown (.md) - 完整专业版
/root/.openclaw/workspace/output/YYYY-MM-DD-[article-title-slug].md# Article TitleFormat 2: HTML (.html) - 完整专业版
/root/.openclaw/workspace/output/YYYY-MM-DD-[article-title-slug].html.highlight - Blue highlight background (linear-gradient).highlight-green - Blue text with blue highlight background.highlight-green - DEPRECATED: Use .highlight-green instead (unified blue theme).highlight-orange - DEPRECATED: Use .highlight-green instead (unified blue theme).underline-dotted - Dotted underline for emphasis (2px dotted #3498db).data-box - Data highlight box with shadow.key-number - Key numbers in blue, bold, larger font.article-image - Responsive images with shadow and border-radius.image-caption - Centered, italic caption text.image-source - Source attribution with clickable links<hr/> tags between paragraphs - Use spacing and headings for visual separation instead⚠️ 权威规范文件:references/wechat-format-rules.md(以此为准,不得与该文件冲突)
🚨 2026-04-09 重大更新(经验教训):
核心问题:微信安全过滤会强制覆盖 <h1>/<h2>/<h3>/<p>/<strong> 等HTML默认标签的样式(变蓝色),所有CSS class和 <style> 块都会被剥离。
唯一安全方案:所有样式必须用 <div> 和 <span> 标签的 style="" 内联属性,禁止使用任何被微信强制覆盖的标签。
排版规范核心要点(完整内容见 references/wechat-format-rules.md):
<!-- 供 wechat_publish.py 提取标题,必须保留且 display:none -->
<h1 style="display:none;">从张雪峰.skill到金谷园饺子馆.skill,给我们带来的思考</h1>
<!-- 禁止用 <h2>,微信会强制覆盖为蓝色!必须用 div 内联 -->
<div style="font-size:17px;color:#556b2f;font-weight:bold;margin:28px 15px 14px;padding-left:12px;border-left:4px solid #556b2f;">一、章节标题</div>
<!-- 禁止用 <p>,微信会覆盖样式!必须用 div 内联 -->
<div style="margin:0 0 12px;padding:0 15px;line-height:1.8;">正文内容</div>
<!-- 砖红字体 + 奶黄背景,不是红色! -->
<span style="background:#fff8e7;padding:2px 6px;border-radius:3px;color:#b74134;font-weight:600;">重点字词</span>
<!-- 墨绿色点状下划线,不是红色! -->
<span style="border-bottom:2px dotted #556b2f;padding-bottom:2px;color:#556b2f;">重点句子</span>
<span style="color:#556b2f;font-weight:bold;">12天</span>
<div style="background:#f6fff6;border-left:5px solid #556b2f;box-shadow:3px 3px 10px rgba(85,107,47,0.12);padding:18px 20px;border-radius:0 10px 10px 0;margin:0 0 24px 0;font-size:15px;line-height:1.9;">
<span style="color:#556b2f;font-weight:bold;">2026年4月</span>,短短两天内...
</div>
<div style="background:#556b2f;padding:16px;border-radius:10px;text-align:center;color:#fff;margin:24px 0 0;">
<div style="margin:0;color:#fff;font-size:15px;line-height:1.8;">如果你觉得文章对你有所帮助,请关注就行</div>
</div>
| 元素 | ❌ 禁止 | ✅ 正确 |
|---|---|---|
| 文章标题 | <h1>(会变蓝) | <h1 style="display:none;"> + 视觉标题用div |
| 二级标题 | <h2>/<p>(会变蓝) | <div style="border-left:4px solid #556b2f;color:#556b2f;"> |
| 正文段落 | <p>(会变蓝) | <div style="margin:0 0 12px;padding:0 15px;"> |
| 加粗强调 | <strong>(会变蓝) | <span style="color:#556b2f;font-weight:bold;"> |
| 重点字词 | class样式(被剥离) | <span style="background:#fff8e7;padding:2px 6px;border-radius:3px;color:#b74134;"> |
| 重点句下划线 | class样式(被剥离) | <span style="border-bottom:2px dotted #556b2f;padding-bottom:2px;color:#556b2f;"> |
| CTA区域 | <p>(会变蓝) | <div style="background:#556b2f;...;"> |
| 列表 | <ul>/<ol>/<li>(圆点不可控) | <div style="margin:0 0 6px 20px;">• 内容</div> |
| 用途 | 颜色值 | 示例 |
|---|---|---|
| 二级标题 | #556b2f(墨绿) | color:#556b2f;font-weight:bold; |
| 左侧竖线 | #556b2f(墨绿) | border-left:4px solid #556b2f; |
| 重点句点下划线 | #556b2f(墨绿) | border-bottom:2px dotted #556b2f; |
| 重点字词背景 | #fff8e7(奶黄) | background:#fff8e7; |
| 重点字词字体 | #b74134(砖红) | color:#b74134; |
| CTA背景 | #556b2f(墨绿) | background:#556b2f; |
cd /root/.openclaw/workspace/skills/content-factory && python3 -X utf8 scripts/wechat_publish.py --html "/root/.openclaw/workspace/output/YYYY-MM-DD-article-slug.html" --cover "/root/.openclaw/workspace/output/YYYY-MM-DD-article-slug-cover.png"
必须加 -X utf8:否则中文会变成 \uXXXX 转义序列
必须加 --cover:否则封面图使用默认图片
禁止元信息:禁止日期、版本号、版权声明
Content structure optimization:
WeChat list formatting (CRITICAL for publishing):
<li> elements to prevent WeChat from adding extra bullets<ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul> (no newlines between items)<ul> and <ol> listsVisual data presentation:
Information source images:
<figure> with <figcaption> and source links<p class="image-source"> with clickable attribution linksFormat 3: Markdown (.md) - 小红书版 (Xiaohongshu Style)
/root/.openclaw/workspace/output/YYYY-MM-DD-[article-title-slug]-小红书.mdpython3 -c "import re; c=re.sub(r'#+\s*|---+|^-\s+|#+\s*$|\n\n+','',open('file.md').read()); print(len(re.findall(r'[\u4e00-\u9fa5]',c))+len(re.findall(r'[a-zA-Z]+',c)))"
wc -c - it counts bytes not displayable characters800 <= len(content_without_hashtags) <= 1000#ClaudeCowork #AI工具 #企业效率 #人工智能 #职场提升 #AI代理 #效率翻倍 #科技趋势
# After writing, verify character count
content = """[your xiaohongshu content]"""
lines = content.split('\n')
hashtag_line = [l for l in lines if l.startswith('#')]
if hashtag_line:
content_without_hashtags = content.replace(hashtag_line[0], '').strip()
else:
content_without_hashtags = content.strip()
char_count = len(content_without_hashtags)
assert 800 <= char_count <= 1000, f"Character count {char_count} must be between 800-1000!"
Format 4: Text (.txt) - X/Twitter 英文长推文版 (X Pro)
/root/.openclaw/workspace/output/YYYY-MM-DD-[article-title-slug]-tweet.txt#AI #ClaudeCowork #EnterpriseAI #Automation #AIAgents #DigitalTransformation #Productivity #FutureOfWork
File Naming Convention:
YYYY-MM-DD (e.g., 2026-01-14)-小红书 suffix before extension-tweet suffix before extension2026-01-14-claude-cowork-enterprise-guide.md (Professional MD)2026-01-14-claude-cowork-enterprise-guide.html (Professional HTML)2026-01-14-claude-cowork-enterprise-guide-小红书.md (Xiaohongshu MD)2026-01-14-claude-cowork-enterprise-guide-tweet.txt (Twitter/X English)Output Directory Structure:
├── 2026-01-14-[article-title-slug].md
├── 2026-01-14-[article-title-slug].html
├── 2026-01-14-[article-title-slug]-小红书.md
└── 2026-01-14-[article-title-slug]-tweet.txt
Create the output directory if it doesn't exist.
IMPORTANT: Before publishing, generate a professional WeChat cover photo using GLM-Image API.
WeChat Cover Specifications:
900x386 pixels (WeChat Official Account standard)Cover Photo Generation Workflow:
Extract article title from the finalized content
Generate cover photo using GLM-Image API:
# Generate cover photo using GLM-Image API
python scripts/generate_cover_photo.py \
--title "[article title]" \
--theme "[article theme]" \
--output "/root/.openclaw/workspace/output/YYYY-MM-DD-[article-slug]-cover.png"
Image will be automatically generated at 21:9 ratio (900x386 pixels)
Compress if needed:
# Check file size
ls -lh "YYYY-MM-DD-[article-slug]-cover.png"
# If > 1MB, compress to JPEG
python scripts/compress_image.py "YYYY-MM-DD-[article-slug]-cover.png"
# Creates: YYYY-MM-DD-[article-slug]-cover-compressed.jpg
Include cover photo reference in publishing workflow
Prompt Engineering Guidelines for Cover Photos:
Core Principles:
Example Prompts by Article Type:
Tech/AI Articles:
Create a professional WeChat cover image (900x386 pixels, 21:9 ultra-wide landscape).
Title: [AI/Tech article title]
Style: Professional magazine cover with minimalist flat vector graphics.
- Pure white background (#ffffff)
- Title centered in dark blue (藏青色 #1a3a52)
- Subtle geometric shapes: circuits, nodes, or abstract tech patterns in dark blue
- Optional accent: light blue (#3498db) for highlights
- Clean, modern typography
- High contrast for mobile readability
- 21:9 ultra-wide composition
Business/Enterprise Articles:
Create a professional WeChat cover image (900x386 pixels, 21:9 ultra-wide landscape).
Title: [Business article title]
Style: Professional magazine cover with minimalist design.
- Pure white background (#ffffff)
- Title centered in navy blue (藏青色 #1a5490)
- Subtle business graphics: charts, graphs, or geometric patterns in dark blue
- Optional accent: gray (#7f8c8d) for subtle elements
- Professional, trustworthy aesthetic
- Balanced composition
Tutorial/Guide Articles:
Create a professional WeChat cover image (900x386 pixels, 21:9 ultra-wide landscape).
Title: [Tutorial/Guide title]
Style: Professional magazine cover with clear hierarchy.
- Pure white background (#ffffff)
- Title centered in dark blue (藏青色 #1a3a52)
- Minimalist icons or step indicators in dark blue
- Optional accent: light blue (#3498db) for visual interest
- Clean, educational aesthetic
- Easy to scan on mobile
General Template (Recommended):
Create a professional WeChat Official Account cover image (900x386 pixels, 21:9 ultra-wide landscape).
Title: [article title - use actual title text]
Design requirements:
- Professional magazine style
- Minimalist flat vector graphics based ONLY on the title keywords
- Pure white background (#ffffff) - MANDATORY
- Title text centered, large, and prominent in dark blue (藏青色 #1a3a52 or #1a5490)
- Graphics and shapes in dark blue/navy (藏青色)
- Optional accent colors: light blue (#3498db), gray (#7f8c8d) for subtle elements only
- Clean geometric shapes that relate to title content
- High contrast for mobile readability
- Professional typography (sans-serif, bold for title)
- **21:9 ultra-wide composition** - use horizontal space effectively
- Suitable for business/professional audience
Layout:
- Title occupies center 60% of image
- Background graphics subtle and non-distracting
- Adequate white space around title
- Professional, magazine-quality finish
Color Palette (Consistent with Article Theme):
Quality Checklist:
Integration with Publishing Workflow:
scripts/compress_image.py)Error Handling:
IMPORTANT: After generating Format 2 (HTML) and cover photo, automatically publish to WeChat Official Account for preview.
WeChat Official Account Credentials:
.env file (see Configuration section below)WECHAT_APP_ID in .envWECHAT_APP_SECRET in .envPublishing Workflow:
Publishing Script Usage (CRITICAL - Windows UTF-8 Mode):
# ALWAYS use -X utf8 flag on Windows to prevent encoding errors
python -X utf8 scripts/wechat_publish.py --html "/root/.openclaw/workspace/output/YYYY-MM-DD-[article-title-slug].html"
# WITHOUT -X utf8, Chinese characters will show as \uXXXX escape sequences
# This is a Windows-specific issue due to GBK default encoding
Expected Output:
✓ Access token obtained
✓ Content image uploaded: [filename] -> http://mmbiz.qpic.cn/...
✓ Draft article created
✓ Media ID: WOr7ZIAYNpv...
Verification Checklist:
\uXXXX sequences)API Endpoints Used:
https://api.weixin.qq.com/cgi-bin/tokenhttps://api.weixin.qq.com/cgi-bin/draft/addhttps://api.weixin.qq.com/cgi-bin/freepublish/submitError Handling:
publish_errors.logSecurity Notes:
Article Ending - Business Conversion (MANDATORY for Format 1 & 2):
Instead of listing "参考来源" or "References", ALWAYS end Format 1 (MD) and Format 2 (HTML) professional articles with a business conversion section that guides readers to follow and engage for AI consulting services.
NOTE: Do NOT include this section in Format 3 (Xiaohongshu) - that format should end with hashtags only.
Markdown Format (for Format 1):
---
如果觉得这篇文章对您帮助,欢迎关注公众号。
HTML Format (for Format 2, add before </body>):
<p>如果觉得这篇文章对您帮助,欢迎关注公众号。</p>
Important Notes:
<hr/> before the business conversion section - The h2 heading provides sufficient visual separationWhat happened:
Why it's wrong:
Correct approach:
# ALWAYS check first
yt-dlp --version
ls scripts/yt_dlp_search.py
ls scripts/yt_dlp_captions.py
# Then decide execution path based on results
What happened:
Why it's wrong:
Correct interpretation:
What happened:
references/youtube_research_checklist.mdWhy it's wrong:
Correct approach:
# ALWAYS load reference docs when mentioned
Read("references/youtube_research_checklist.md")
What happened:
Why it's wrong:
Correct decision tree:
YouTube needed?
↓
Check yt-dlp installed?
↓ YES ↓ NO
Try scripts → Inform user + install
↓ SUCCESS ↓ FAIL ↓
Continue → Try WebFetch → Retry scripts
↓ FAIL ↓ FAIL
Request user URLs → Use fallback sources
↓ FAIL (document limitation)
Use fallback sources
(document limitation)
What happened:
\u6211\u752872\u5c0f\u65f6 instead of "我用72小时"Why it's wrong:
ensure_ascii=False alone is insufficientRoot cause:
Correct approach:
# ALWAYS use Python UTF-8 mode on Windows for WeChat publishing
python -X utf8 scripts/wechat_publish.py --html "/root/.openclaw/workspace/output/article.html"
# NOT just PYTHONIOENCODING (insufficient):
# PYTHONIOENCODING=utf-8 python scripts/wechat_publish.py # ❌ Only fixes I/O
# The -X utf8 flag forces UTF-8 for:
# - File I/O operations
# - String encoding/decoding
# - HTML parsing (BeautifulSoup)
# - JSON serialization
# - HTTP request bodies
Verification:
\uXXXX sequences, encoding failed-X utf8 flagPrevention checklist:
python -X utf8 for WeChat publishing on WindowsWhat happened:
TimeoutError('The write operation timed out')Why it's wrong:
Root cause:
Correct approach:
# Step 1: Generate infographic with NotebookLM (as usual)
notebooklm generate infographic "prompt..." --json
notebooklm artifact wait <artifact_id> --timeout 600
notebooklm download infographic ./output.png
# Step 2: ALWAYS compress before WeChat upload
python -c "
from PIL import Image
import os
# Convert PNG to JPEG with quality optimization
img = Image.open('output.png').convert('RGB')
img.save('output-compressed.jpg', 'JPEG', quality=85, optimize=True)
# Verify size reduction
original_mb = os.path.getsize('output.png') / 1024 / 1024
compressed_mb = os.path.getsize('output-compressed.jpg') / 1024 / 1024
print(f'Original: {original_mb:.2f}MB → Compressed: {compressed_mb:.2f}MB')
"
# Step 3: Update HTML to reference compressed image
# Replace: <img src="output.png" ...>
# With: <img src="output-compressed.jpg" ...>
# Step 4: Publish with compressed image
python -X utf8 scripts/wechat_publish.py --html "/root/.openclaw/workspace/output/article.html"
Compression results:
Prevention checklist:
Image compression script (reusable):
# Save as scripts/compress_image.py
from PIL import Image
import sys
import os
def compress_for_wechat(input_path, output_path=None, quality=85):
"""Compress image for WeChat upload (target < 1MB)"""
if output_path is None:
base, ext = os.path.splitext(input_path)
output_path = f"{base}-compressed.jpg"
img = Image.open(input_path)
if img.mode in ('RGBA', 'LA', 'P'):
img = img.convert('RGB')
img.save(output_path, 'JPEG', quality=quality, optimize=True)
original_mb = os.path.getsize(input_path) / 1024 / 1024
compressed_mb = os.path.getsize(output_path) / 1024 / 1024
print(f"Original: {original_mb:.2f}MB")
print(f"Compressed: {compressed_mb:.2f}MB ({100*(1-compressed_mb/original_mb):.1f}% reduction)")
print(f"Output: {output_path}")
return output_path
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python compress_image.py <input_image> [output_image] [quality]")
sys.exit(1)
input_path = sys.argv[1]
output_path = sys.argv[2] if len(sys.argv) > 2 else None
quality = int(sys.argv[3]) if len(sys.argv) > 3 else 85
compress_for_wechat(input_path, output_path, quality)
Usage:
# Compress with default settings (quality=85)
python scripts/compress_image.py infographic.png
# Compress with custom quality
python scripts/compress_image.py infographic.png output.jpg 75
# Compress and specify output path
python scripts/compress_image.py infographic.png compressed.jpg
Always Check Tools First
Follow Priority Order Strictly
Be Transparent with User
Read All Reference Documentation
Systematic Troubleshooting
WeChat Publishing on Windows (CRITICAL)
python -X utf8 flag for WeChat publishing\uXXXX sequences indicating encoding failureNotebookLM Infographic Workflow
scripts/compress_image.py for consistent compressionImage Compression for WeChat
All API keys and credentials are stored in .env file for security and easy management.
Setup Steps:
Copy the example file:
cd ~/.claude/skills\content-factory
copy .env.example .env
Edit .env and add your credentials:
# WeChat Official Account (Required for auto-publishing)
WECHAT_APP_ID=your-wechat-app-id
WECHAT_APP_SECRET=your-wechat-app-secret
Get your credentials:
notebooklm login (for cover photo generation)Verify configuration:
python scripts/check_env.py
Important:
.env file to Git (it's in .gitignore).env.example as a template (safe to commit)API_KEY_SETUP.md for detailed setup instructionsCONFIGURATION.md for configuration management detailsResearch Tools:
scripts/yt_dlp_captions.py - Download YouTube captions/transcriptsscripts/yt_dlp_search.py - Search and collect YouTube metadatascripts/compress_image.py - Compress images for WeChat uploadscripts/wechat_publish.py - Auto-publish to WeChat Official Accountnotebooklm-api skill - Generate infographics and cover photosReference Guides:
references/youtube_research_checklist.md - YouTube-specific research workflowreferences/web_research_guide.md - Multi-source web research best practicesreferences/wechat_viral_frameworks.md - Article frameworks and hooksreferences/wechat_publishing_guide.md - WeChat publishing documentationreferences/reference.html - HTML template and styling reference for outputTemplates:
assets/wechat_outline_template.md - Outline template (optional)Output Directory:
/root/.openclaw/workspace/output/ - Target directory for generated MD, HTML, Xiaohongshu, Tweet files, and cover photos如果觉得这篇文章对您帮助,欢迎关注公众号。