marketing-pipeline-share-content-automation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMarketing Pipeline Share - Content Automation Skill
Marketing Pipeline Share - 内容自动化技能
Overview
概述
Marketing Pipeline Share is a complete TypeScript-based content automation system that transforms keywords into finished content through AI-powered research, scriptwriting, and video generation. It crawls real-time data from sources like TechCrunch, a16z, Twitter/X, and LinkedIn, then uses Claude 3 or OpenAI to generate multi-format content (articles, videos, infographics) with automatic posting capabilities.
Key capabilities:
- Auto-scan research from news sources (last 24h)
- AI-powered content generation (Claude/OpenAI) in multiple formats (Toplist, POV, Case Study, How-to)
- Bilingual support (English/Vietnamese) with customizable tone
- Automatic video rendering with Remotion
- Multi-platform optimization (Reels, TikTok, Shorts)
Marketing Pipeline Share 是一个基于TypeScript的完整内容自动化系统,通过AI驱动的调研、脚本撰写和视频生成,将关键词转化为成品内容。它会从TechCrunch、a16z、Twitter/X和LinkedIn等来源抓取实时数据,然后使用Claude 3或OpenAI生成多格式内容(文章、视频、信息图),并具备自动发布功能。
核心功能:
- 自动扫描新闻来源的调研内容(最近24小时)
- 基于AI的多格式内容生成(Claude/OpenAI),支持排行榜、观点文、案例研究、教程等类型
- 双语支持(英语/越南语),可自定义语气风格
- 借助Remotion实现自动视频渲染
- 多平台优化(Reels、TikTok、Shorts)
Installation
安装
Prerequisites
前置条件
bash
undefinedbash
undefinedNode.js 18+ required
需要 Node.js 18+ 版本
node --version
node --version
pnpm recommended (or npm/yarn)
推荐使用 pnpm(也可使用 npm/yarn)
npm install -g pnpm
undefinednpm install -g pnpm
undefinedSetup
设置步骤
bash
undefinedbash
undefinedClone the repository
克隆仓库
git clone https://github.com/pennydinh/marketing-pineline-share.git
cd marketing-pineline-share
git clone https://github.com/pennydinh/marketing-pineline-share.git
cd marketing-pineline-share
Install dependencies
安装依赖
pnpm install
pnpm install
Copy environment template
复制环境变量模板
cp .env.example .env
undefinedcp .env.example .env
undefinedEnvironment Configuration
环境变量配置
Create file with required API keys:
.envbash
undefined创建文件并填入所需API密钥:
.envbash
undefinedAI Models
AI 模型
ANTHROPIC_API_KEY=your_claude_api_key
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_claude_api_key
OPENAI_API_KEY=your_openai_api_key
Research APIs
调研相关API
RAPIDAPI_KEY=your_rapidapi_key
RAPIDAPI_KEY=your_rapidapi_key
Database (if applicable)
数据库(如有需要)
DATABASE_URL=postgresql://user:password@localhost:5432/content_pipeline
DATABASE_URL=postgresql://user:password@localhost:5432/content_pipeline
Video Rendering
视频渲染
REMOTION_BUCKET=your_s3_bucket_name
AWS_ACCESS_KEY_ID=your_aws_key
AWS_SECRET_ACCESS_KEY=your_aws_secret
REMOTION_BUCKET=your_s3_bucket_name
AWS_ACCESS_KEY_ID=your_aws_key
AWS_SECRET_ACCESS_KEY=your_aws_secret
Social Media Auto-Post (optional)
社交媒体自动发布(可选)
FACEBOOK_PAGE_TOKEN=your_fb_token
LINKEDIN_ACCESS_TOKEN=your_linkedin_token
undefinedFACEBOOK_PAGE_TOKEN=your_fb_token
LINKEDIN_ACCESS_TOKEN=your_linkedin_token
undefinedRun Development Server
启动开发服务器
bash
undefinedbash
undefinedStart Next.js development server
启动 Next.js 开发服务器
pnpm dev
pnpm dev
Server runs on http://localhost:3000
服务器运行在 http://localhost:3000
undefinedundefinedCore Architecture
核心架构
Project Structure
项目结构
marketing-pineline-share/
├── src/
│ ├── app/ # Next.js app router pages
│ ├── components/ # React components
│ ├── lib/
│ │ ├── ai/ # AI integration (Claude, OpenAI)
│ │ ├── research/ # Web crawling & data extraction
│ │ ├── content/ # Content generation logic
│ │ └── video/ # Remotion video rendering
│ ├── services/ # API services
│ └── utils/ # Helper functions
├── remotion/ # Video templates
└── public/ # Static assetsmarketing-pineline-share/
├── src/
│ ├── app/ # Next.js app router 页面
│ ├── components/ # React 组件
│ ├── lib/
│ │ ├── ai/ # AI 集成(Claude、OpenAI)
│ │ ├── research/ # 网页抓取与数据提取
│ │ ├── content/ # 内容生成逻辑
│ │ └── video/ # Remotion 视频渲染
│ ├── services/ # API 服务
│ └── utils/ # 辅助函数
├── remotion/ # 视频模板
└── public/ # 静态资源Key Features & Usage
核心功能与使用方法
1. Research Auto-Scan
1. 调研自动扫描
Crawl latest news from multiple sources:
typescript
import { scanSources } from '@/lib/research/scanner';
import { extractInsights } from '@/lib/research/insights';
async function performResearch(keyword: string) {
// Scan sources from last 24 hours
const sources = ['techcrunch', 'a16z', 'twitter', 'linkedin'];
const rawData = await scanSources({
keyword,
sources,
timeRange: '24h'
});
// Extract actionable insights
const insights = await extractInsights(rawData, {
minRelevance: 0.7,
includeStats: true,
language: 'en'
});
return insights;
}
// Usage
const data = await performResearch('AI automation');
console.log(data.articles); // Crawled articles
console.log(data.trends); // Identified trends
console.log(data.stats); // Data points & metrics从多个来源抓取最新新闻:
typescript
import { scanSources } from '@/lib/research/scanner';
import { extractInsights } from '@/lib/research/insights';
async function performResearch(keyword: string) {
// 扫描最近24小时的来源内容
const sources = ['techcrunch', 'a16z', 'twitter', 'linkedin'];
const rawData = await scanSources({
keyword,
sources,
timeRange: '24h'
});
// 提取可落地的洞察信息
const insights = await extractInsights(rawData, {
minRelevance: 0.7,
includeStats: true,
language: 'en'
});
return insights;
}
// 使用示例
const data = await performResearch('AI automation');
console.log(data.articles); // 抓取到的文章
console.log(data.trends); # 识别出的趋势
console.log(data.stats); # 数据点与指标2. AI Content Generation
2. AI内容生成
Generate content using Claude or OpenAI:
typescript
import { generateContent } from '@/lib/ai/content-generator';
import { ContentFormat, ToneStyle } from '@/types';
async function createBlogPost(keyword: string, insights: any) {
const content = await generateContent({
keyword,
insights,
// Format options
format: ContentFormat.CASE_STUDY, // or TOPLIST, POV, HOW_TO
// Language & tone
language: 'vi', // 'en' or 'vi'
tone: ToneStyle.PROFESSIONAL, // FRIENDLY, HUMOROUS, EXPERT
// AI provider
provider: 'claude', // or 'openai'
model: 'claude-3-sonnet-20240229',
// Content parameters
wordCount: 1500,
includeImages: true,
includeSEO: true
});
return {
title: content.title,
body: content.body,
meta: content.seoMetadata,
images: content.suggestedImages,
cta: content.callToAction
};
}使用Claude或OpenAI生成内容:
typescript
import { generateContent } from '@/lib/ai/content-generator';
import { ContentFormat, ToneStyle } from '@/types';
async function createBlogPost(keyword: string, insights: any) {
const content = await generateContent({
keyword,
insights,
// 格式选项
format: ContentFormat.CASE_STUDY, // 也可选 TOPLIST、POV、HOW_TO
// 语言与语气
language: 'vi', // 'en' 或 'vi'
tone: ToneStyle.PROFESSIONAL, // 可选 FRIENDLY、HUMOROUS、EXPERT
// AI 提供商
provider: 'claude', // 也可选 'openai'
model: 'claude-3-sonnet-20240229',
// 内容参数
wordCount: 1500,
includeImages: true,
includeSEO: true
});
return {
title: content.title,
body: content.body,
meta: content.seoMetadata,
images: content.suggestedImages,
cta: content.callToAction
};
}3. Bilingual Content Generation
3. 双语内容生成
Create parallel English and Vietnamese versions:
typescript
import { generateBilingual } from '@/lib/content/bilingual';
async function createBilingualPost(keyword: string) {
const { english, vietnamese } = await generateBilingual({
keyword,
format: 'toplist',
tone: 'friendly',
// Shared context
research: await performResearch(keyword),
// Language-specific customization
enConfig: {
targetAudience: 'international marketers',
useImperial: true
},
viConfig: {
targetAudience: 'doanh nghiệp Việt Nam',
useLocalExamples: true
}
});
return { english, vietnamese };
}创建英文和越南语并行版本:
typescript
import { generateBilingual } from '@/lib/content/bilingual';
async function createBilingualPost(keyword: string) {
const { english, vietnamese } = await generateBilingual({
keyword,
format: 'toplist',
tone: 'friendly',
// 共享上下文
research: await performResearch(keyword),
// 语言专属配置
enConfig: {
targetAudience: 'international marketers',
useImperial: true
},
viConfig: {
targetAudience: 'doanh nghiệp Việt Nam',
useLocalExamples: true
}
});
return { english, vietnamese };
}4. Video Rendering with Remotion
4. 借助Remotion实现视频渲染
Generate videos from content:
typescript
import { renderVideo } from '@/lib/video/renderer';
import { VideoTemplate } from '@/remotion/templates';
async function createContentVideo(content: any) {
const videoConfig = {
template: VideoTemplate.INFOGRAPHIC, // or SHORT_FORM, TUTORIAL
// Content data
title: content.title,
keyPoints: content.highlights,
statistics: content.stats,
// Visual settings
aspectRatio: '9:16', // For Reels/TikTok/Shorts
duration: 60, // seconds
// Branding
logo: '/assets/logo.png',
colorScheme: {
primary: '#3B82F6',
secondary: '#10B981',
background: '#1F2937'
},
// Audio
voiceover: content.voiceoverScript,
backgroundMusic: 'upbeat-corporate'
};
const video = await renderVideo(videoConfig);
return {
url: video.publicUrl,
thumbnail: video.thumbnailUrl,
metadata: video.metadata
};
}从内容生成视频:
typescript
import { renderVideo } from '@/lib/video/renderer';
import { VideoTemplate } from '@/remotion/templates';
async function createContentVideo(content: any) {
const videoConfig = {
template: VideoTemplate.INFOGRAPHIC, // 也可选 SHORT_FORM、TUTORIAL
// 内容数据
title: content.title,
keyPoints: content.highlights,
statistics: content.stats,
// 视觉设置
aspectRatio: '9:16', // 适配 Reels/TikTok/Shorts
duration: 60, // 秒
// 品牌设置
logo: '/assets/logo.png',
colorScheme: {
primary: '#3B82F6',
secondary: '#10B981',
background: '#1F2937'
},
// 音频设置
voiceover: content.voiceoverScript,
backgroundMusic: 'upbeat-corporate'
};
const video = await renderVideo(videoConfig);
return {
url: video.publicUrl,
thumbnail: video.thumbnailUrl,
metadata: video.metadata
};
}5. Complete Pipeline Example
5. 完整流水线示例
Full workflow from keyword to published content:
typescript
import { ContentPipeline } from '@/lib/pipeline';
async function runCompletePipeline() {
const pipeline = new ContentPipeline({
aiProvider: 'claude',
autoPost: true,
platforms: ['facebook', 'linkedin']
});
// Execute full pipeline
const result = await pipeline.execute({
keyword: 'AI marketing automation 2026',
// Research phase
research: {
sources: ['techcrunch', 'twitter'],
timeRange: '24h',
minArticles: 10
},
// Content generation phase
content: {
formats: ['article', 'video'],
languages: ['en', 'vi'],
tone: 'expert'
},
// Video rendering phase
video: {
enabled: true,
templates: ['infographic', 'short-form'],
aspectRatios: ['9:16', '1:1']
},
// Publishing phase
publish: {
schedule: new Date('2026-06-01T10:00:00Z'),
platforms: {
facebook: {
pageId: process.env.FB_PAGE_ID,
includeVideo: true
},
linkedin: {
companyId: process.env.LINKEDIN_COMPANY_ID,
includeArticle: true
}
}
}
});
return {
researchData: result.research,
generatedContent: result.content,
renderedVideos: result.videos,
publishedPosts: result.published
};
}从关键词到发布内容的全流程:
typescript
import { ContentPipeline } from '@/lib/pipeline';
async function runCompletePipeline() {
const pipeline = new ContentPipeline({
aiProvider: 'claude',
autoPost: true,
platforms: ['facebook', 'linkedin']
});
// 执行完整流水线
const result = await pipeline.execute({
keyword: 'AI marketing automation 2026',
// 调研阶段
research: {
sources: ['techcrunch', 'twitter'],
timeRange: '24h',
minArticles: 10
},
// 内容生成阶段
content: {
formats: ['article', 'video'],
languages: ['en', 'vi'],
tone: 'expert'
},
// 视频渲染阶段
video: {
enabled: true,
templates: ['infographic', 'short-form'],
aspectRatios: ['9:16', '1:1']
},
// 发布阶段
publish: {
schedule: new Date('2026-06-01T10:00:00Z'),
platforms: {
facebook: {
pageId: process.env.FB_PAGE_ID,
includeVideo: true
},
linkedin: {
companyId: process.env.LINKEDIN_COMPANY_ID,
includeArticle: true
}
}
}
});
return {
researchData: result.research,
generatedContent: result.content,
renderedVideos: result.videos,
publishedPosts: result.published
};
}API Routes
API 路由
Content Generation Endpoint
内容生成端点
typescript
// src/app/api/generate/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { generateContent } from '@/lib/ai/content-generator';
export async function POST(request: NextRequest) {
const { keyword, format, language } = await request.json();
try {
const content = await generateContent({
keyword,
format,
language,
provider: 'claude'
});
return NextResponse.json({ success: true, content });
} catch (error) {
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}typescript
// src/app/api/generate/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { generateContent } from '@/lib/ai/content-generator';
export async function POST(request: NextRequest) {
const { keyword, format, language } = await request.json();
try {
const content = await generateContent({
keyword,
format,
language,
provider: 'claude'
});
return NextResponse.json({ success: true, content });
} catch (error) {
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}Video Rendering Endpoint
视频渲染端点
typescript
// src/app/api/render-video/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { renderVideo } from '@/lib/video/renderer';
export async function POST(request: NextRequest) {
const { contentId, template, aspectRatio } = await request.json();
const video = await renderVideo({
contentId,
template,
aspectRatio,
outputBucket: process.env.REMOTION_BUCKET
});
return NextResponse.json({ videoUrl: video.publicUrl });
}typescript
// src/app/api/render-video/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { renderVideo } from '@/lib/video/renderer';
export async function POST(request: NextRequest) {
const { contentId, template, aspectRatio } = await request.json();
const video = await renderVideo({
contentId,
template,
aspectRatio,
outputBucket: process.env.REMOTION_BUCKET
});
return NextResponse.json({ videoUrl: video.publicUrl });
}Common Patterns
常见模式
Custom Content Templates
自定义内容模板
typescript
// Define custom content template
interface CustomTemplate {
structure: string[];
sections: Record<string, string>;
style: string;
}
const caseStudyTemplate: CustomTemplate = {
structure: [
'introduction',
'challenge',
'solution',
'results',
'conclusion'
],
sections: {
introduction: 'Hook with problem statement',
challenge: 'Detail the specific challenges faced',
solution: 'Explain implementation with steps',
results: 'Present data-backed outcomes',
conclusion: 'Key takeaways and CTA'
},
style: 'professional'
};
// Use template in generation
const content = await generateContent({
keyword: 'marketing automation success',
template: caseStudyTemplate,
provider: 'claude'
});typescript
// 定义自定义内容模板
interface CustomTemplate {
structure: string[];
sections: Record<string, string>;
style: string;
}
const caseStudyTemplate: CustomTemplate = {
structure: [
'introduction',
'challenge',
'solution',
'results',
'conclusion'
],
sections: {
introduction: 'Hook with problem statement',
challenge: 'Detail the specific challenges faced',
solution: 'Explain implementation with steps',
results: 'Present data-backed outcomes',
conclusion: 'Key takeaways and CTA'
},
style: 'professional'
};
// 在生成时使用模板
const content = await generateContent({
keyword: 'marketing automation success',
template: caseStudyTemplate,
provider: 'claude'
});Batch Processing
批量处理
typescript
import { batchProcess } from '@/lib/utils/batch';
async function generateMultipleContent(keywords: string[]) {
const results = await batchProcess(keywords, async (keyword) => {
const research = await performResearch(keyword);
const content = await createBlogPost(keyword, research);
const video = await createContentVideo(content);
return { keyword, content, video };
}, {
concurrency: 3, // Process 3 at a time
retries: 2
});
return results;
}typescript
import { batchProcess } from '@/lib/utils/batch';
async function generateMultipleContent(keywords: string[]) {
const results = await batchProcess(keywords, async (keyword) => {
const research = await performResearch(keyword);
const content = await createBlogPost(keyword, research);
const video = await createContentVideo(content);
return { keyword, content, video };
}, {
concurrency: 3, // 同时处理3个任务
retries: 2
});
return results;
}Scheduled Content Calendar
定时内容日历
typescript
import { scheduleContent } from '@/lib/scheduling/calendar';
async function setupContentCalendar(keywords: string[]) {
const calendar = await scheduleContent({
keywords,
frequency: 'daily', // daily, weekly, monthly
time: '10:00',
timezone: 'Asia/Ho_Chi_Minh',
platforms: ['facebook', 'linkedin'],
// Auto-generate content on schedule
autoGenerate: true,
// Content variety
formatRotation: ['article', 'toplist', 'case-study']
});
return calendar;
}typescript
import { scheduleContent } from '@/lib/scheduling/calendar';
async function setupContentCalendar(keywords: string[]) {
const calendar = await scheduleContent({
keywords,
frequency: 'daily', // daily、weekly、monthly
time: '10:00',
timezone: 'Asia/Ho_Chi_Minh',
platforms: ['facebook', 'linkedin'],
// 定时自动生成内容
autoGenerate: true,
// 内容类型轮换
formatRotation: ['article', 'toplist', 'case-study']
});
return calendar;
}Troubleshooting
故障排除
API Rate Limits
API 速率限制
typescript
// Implement rate limiting and retry logic
import { withRetry } from '@/lib/utils/retry';
const content = await withRetry(
() => generateContent({ keyword, provider: 'claude' }),
{
maxRetries: 3,
delayMs: 2000,
backoff: 'exponential',
onRetry: (attempt) => console.log(`Retry attempt ${attempt}`)
}
);typescript
// 实现速率限制与重试逻辑
import { withRetry } from '@/lib/utils/retry';
const content = await withRetry(
() => generateContent({ keyword, provider: 'claude' }),
{
maxRetries: 3,
delayMs: 2000,
backoff: 'exponential',
onRetry: (attempt) => console.log(`Retry attempt ${attempt}`)
}
);Video Rendering Issues
视频渲染问题
typescript
// Debug video rendering
import { validateVideoConfig } from '@/lib/video/validator';
const config = {
template: 'infographic',
aspectRatio: '9:16'
};
const validation = validateVideoConfig(config);
if (!validation.valid) {
console.error('Invalid config:', validation.errors);
// Fix issues before rendering
}typescript
// 调试视频渲染
import { validateVideoConfig } from '@/lib/video/validator';
const config = {
template: 'infographic',
aspectRatio: '9:16'
};
const validation = validateVideoConfig(config);
if (!validation.valid) {
console.error('Invalid config:', validation.errors);
// 渲染前修复问题
}Content Quality Check
内容质量检查
typescript
import { validateContent } from '@/lib/content/validator';
const content = await generateContent({ keyword });
const quality = await validateContent(content, {
minWordCount: 1000,
checkGrammar: true,
checkPlagiarism: true,
requireImages: true
});
if (!quality.passed) {
console.log('Issues found:', quality.issues);
// Regenerate or manually fix
}typescript
import { validateContent } from '@/lib/content/validator';
const content = await generateContent({ keyword });
const quality = await validateContent(content, {
minWordCount: 1000,
checkGrammar: true,
checkPlagiarism: true,
requireImages: true
});
if (!quality.passed) {
console.log('Issues found:', quality.issues);
// 重新生成或手动修复
}Memory Issues with Large Batches
大批次处理内存问题
typescript
// Use streaming for large datasets
import { createReadStream } from 'fs';
import { pipeline } from 'stream/promises';
async function processLargeKeywordList(filePath: string) {
const stream = createReadStream(filePath, { encoding: 'utf-8' });
await pipeline(
stream,
async function* (source) {
for await (const chunk of source) {
const keywords = chunk.split('\n');
for (const keyword of keywords) {
yield await generateContent({ keyword });
}
}
},
async function (contents) {
for await (const content of contents) {
await saveContent(content);
}
}
);
}typescript
// 对大型数据集使用流式处理
import { createReadStream } from 'fs';
import { pipeline } from 'stream/promises';
async function processLargeKeywordList(filePath: string) {
const stream = createReadStream(filePath, { encoding: 'utf-8' });
await pipeline(
stream,
async function* (source) {
for await (const chunk of source) {
const keywords = chunk.split('\n');
for (const keyword of keywords) {
yield await generateContent({ keyword });
}
}
},
async function (contents) {
for await (const content of contents) {
await saveContent(content);
}
}
);
}Advanced Configuration
高级配置
Custom AI Model Settings
自定义AI模型设置
typescript
// Fine-tune AI behavior
const customSettings = {
temperature: 0.7, // Creativity (0-1)
maxTokens: 2000,
topP: 0.9,
frequencyPenalty: 0.5,
presencePenalty: 0.5,
// Custom system prompts
systemPrompt: `You are an expert marketing content creator...`,
// Context management
includeResearch: true,
contextWindow: 8000
};
const content = await generateContent({
keyword,
provider: 'openai',
modelSettings: customSettings
});This skill enables AI coding agents to help developers build, customize, and troubleshoot complete content automation pipelines using the Marketing Pipeline Share system.
typescript
// 微调AI行为
const customSettings = {
temperature: 0.7, // 创意程度(0-1)
maxTokens: 2000,
topP: 0.9,
frequencyPenalty: 0.5,
presencePenalty: 0.5,
// 自定义系统提示词
systemPrompt: `You are an expert marketing content creator...`,
// 上下文管理
includeResearch: true,
contextWindow: 8000
};
const content = await generateContent({
keyword,
provider: 'openai',
modelSettings: customSettings
});该技能可让AI编码助手帮助开发者基于Marketing Pipeline Share系统构建、自定义和排查完整的内容自动化流水线。