Loading repository dataโฆ
Loading repository dataโฆ
zouyongfu / repository
๐ค AI-powered social media operations framework โ automated content creation, cross-platform publishing, trending monitor & analytics for Chinese social platforms
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
AI-Powered Social Media Operations Framework
Monitor, create, distribute, and analyze social media content across platforms โ all powered by AI.
English | ไธญๆ
Social Agent is an open-source AI framework that automates social media operations across Chinese social platforms. It integrates LLM-powered content generation, multi-platform publishing, trending monitoring, and performance analytics into one unified framework.
Core idea: Write once, publish everywhere. Let AI handle the heavy lifting.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Social Agent โ
โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ โ
โ โ Monitor โ โ Generate โ โ Analyze โ โ
โ โ Trending โโโโ Content โโโโ Performance โ โ
โ โโโโโโฌโโโโโโ โโโโโโโโฌโโโโโโโโ โโโโโโโโโโโฌโโโโโโโโโโ โ
โ โ โ โ โ
โ โโโโโโผโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโ โ
โ โ Plugin System โ โ
โ โ โโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโ โโโโโโโโโโโโโ โ โ
โ โ โ Weibo โ โ Xiaohu โ โDouyin โ โ Bilibili โ โ โ
โ โ โ ๅพฎๅ โ โ ๅฐ็บขไนฆ โ โ ๆ้ณ โ โ B็ซ โ โ โ
โ โ โโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโ โโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ LLM Layer: OpenAI | Claude | Qwen | GLM | Ollamaโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# Clone the repo
git clone https://github.com/zouyongfu/social-agent.git
cd social-agent
# Install with Weibo support (default)
pip install -e .
# Install with specific platform support
pip install -e ".[weibo]" # Weibo
pip install -e ".[xiaohongshu]" # Xiaohongshu
pip install -e ".[bilibili]" # Bilibili
pip install -e ".[all]" # All platforms
# For development
pip install -e ".[dev]"
Copy the example env file and fill in your credentials:
cp .env.example .env
Edit .env:
# LLM Provider (openai / claude / dashscope / zhipu / ollama)
LLM_PROVIDER=openai
OPENAI_API_KEY=sk-your-key-here
# Or use free Chinese alternatives:
# LLM_PROVIDER=dashscope
# DASHSCOPE_API_KEY=sk-your-key-here
# Weibo cookie (required for reading trending + publishing)
WEIBO_COOKIE=your_weibo_cookie_here
CLI Commands:
# Check status
social-agent status
# Get trending topics
social-agent trending
social-agent trending --platform weibo --limit 20
# Generate content
social-agent generate --topic "AI tools for productivity" --platform weibo --style casual
# Generate for multiple platforms
social-agent generate -t "Today's tech news" -p weibo -p xiaohongshu
# Search across platforms
social-agent search --keyword "ไบบๅทฅๆบ่ฝ" --platform weibo
# Publish content
social-agent publish --topic "My thoughts on AI" --platform weibo
social-agent publish -t "AI review" -p weibo -p xiaohongshu --dry-run
Python API:
import asyncio
from social_agent import SocialAgent, Settings
async def main():
# Initialize agent
settings = Settings.load()
agent = SocialAgent(settings)
await agent.initialize()
# Monitor trending
trending = await agent.get_trending(platform="weibo", limit=10)
for topic in trending:
print(f"๐ฅ {topic.title} (score: {topic.hot_score})")
# Generate content for multiple platforms
contents = await agent.create_content(
topic="AI makes coding 10x faster",
platforms=["weibo", "xiaohongshu"],
style="casual",
keywords=["AI", "ๆ็", "็ผ็จ"],
)
# Publish to all platforms
for content in contents:
result = await agent.publish(
platform=content.platform,
text=content.text,
hashtags=content.hashtags,
)
print(f"{'โ
' if result.success else 'โ'} {content.platform}")
await agent.shutdown()
asyncio.run(main())
# Adapt content from one platform style to another
adapted = await agent.content_engine.adapt(
content="Original Weibo post text here...",
from_platform="weibo",
to_platform="xiaohongshu",
)
print(adapted.text) # Now in Xiaohongshu style
# Daily post at 9 AM
agent.schedule_daily_post(
task_id="morning_post",
topic="ๆฏๆฅ็งๆ่ต่ฎฏ",
platforms=["weibo"],
hour=9,
minute=0,
)
# Monitor trending every 30 minutes
agent.schedule_trending_monitor(
task_id="trending_alert",
keywords=["AI", "ๅคงๆจกๅ", "GPT"],
interval_minutes=30,
)
# Start the scheduler loop
await agent.scheduler.start()
social-agent/
โโโ src/social_agent/
โ โโโ __init__.py # Package init
โ โโโ agent.py # Core Agent orchestrator
โ โโโ config.py # Configuration management
โ โโโ content.py # Content generation engine
โ โโโ llm.py # LLM adapter layer
โ โโโ plugin.py # Plugin system
โ โโโ scheduler.py # Task scheduler
โ โโโ cli.py # Command-line interface
โ โโโ plugins/
โ โโโ weibo/ # Weibo platform plugin
โ โโโ xiaohongshu/ # Xiaohongshu platform plugin
โโโ examples/ # Usage examples
โโโ tests/ # Test suite
โโโ pyproject.toml # Project config
โโโ .env.example # Environment template
| Design | Rationale |
|---|---|
| Plugin-based | Each platform is a self-contained plugin, easy to add/remove |
| Async-first | Built on asyncio for efficient concurrent operations |
| Multi-LLM | Not locked to any single provider, works with OpenAI/Claude/Qwen/GLM/Ollama |
| No browser dependency | Core reads via HTTP API, browser automation optional for publishing |
| Platform | Read (Trending/Search) | Write (Publish) | Status |
|---|---|---|---|
| ๅพฎๅ Weibo | โ | โ | Full support |
| ๅฐ็บขไนฆ Xiaohongshu | โ | ๐ | Read ready, publish via companion |
| ๆ้ณ Douyin | ๐ | ๐ | Planned |
| B็ซ Bilibili | ๐ | ๐ | Planned |
| ็ฅไน Zhihu | ๐ | ๐ | Planned |
| Provider | Models | Setup |
|---|---|---|
| OpenAI | GPT-4o, GPT-4o-mini | Set OPENAI_API_KEY |
| Anthropic Claude | Claude 3.5 Sonnet | Set CLAUDE_API_KEY |
| DashScope (Qwen) | Qwen-Plus, Qwen-Max | Set DASHSCOPE_API_KEY, free tier available |
| Zhipu (GLM) | GLM-4-Flash, GLM-4 | Set ZHIPU_API_KEY, free tier available |
| Ollama (Local) | Any local model | Set OLLAMA_BASE_URL, fully offline |
๐ก For Chinese users, DashScope (Qwen) or Zhipu (GLM) offer free tiers and work great out of the box.
from social_agent.plugin import BasePlatformPlugin, PluginMeta, PluginType, ActionScope
class DouyinPlugin(BasePlatformPlugin):
meta = PluginMeta(
name="douyin",
version="0.1.0",
description="Douyin (TikTok China) platform integration",
plugin_type=PluginType.PLATFORM,
supported_actions=[ActionScope.READ, ActionScope.WRITE],
tags=["douyin", "tiktok", "china"],
)
async def verify_auth(self) -> bool:
# Your auth check logic
return True
async def get_trending(self, limit: int = 10):
# Your trending fetch logic
return [{"title": "...", "hot_score": 1000}]
async def search(self, keyword: str, limit: int = 20):
# Your search logic
return []
async def publish(self, text: str, **kwargs):
# Your publish logic
return {"id": "...", "url": "..."}
Contributions are welcome! Here's how you can help:
pip install -e ".[dev]"
pytest tests/ -v
MIT โ Free for personal and commercial use.
Made with โค๏ธ by zouyongfu
If you find this project useful, please give it a โญ!
Social Agent ๆฏไธไธชๅผๆบ็ AI ็คพไบคๅชไฝ่ฟ่ฅๆกๆถ๏ผๆฏๆไธ้ฎ็ๆง็ญ็นใAI ็ๆๅ ๅฎนใๅคๅนณๅฐๅๅใๆฐๆฎๅๆใ
ๆ ธๅฟ็ๅฟต๏ผๅไธๆฌก๏ผๅๅฐๅคใ่ฎฉ AI ๅธฎไฝ ๆๅฎ็คพไบคๅชไฝ่ฟ่ฅใ
git clone https://github.com/zouyongfu/social-agent.git
cd social-agent
pip install -e ".[weibo]"
cp .env.example .env
# ็ผ่พ .env ๅกซๅ
ฅไฝ ็ API Key ๅ Cookie
social-agent status
social-agent trending