| name | weibo-publisher |
| description | Publish posts to Weibo (Sina Weibo) using browser automation. Use when the user wants to post content to Weibo, share updates on Weibo, publish microblogs, or automate Weibo posting. Supports text posts with emoji, hashtags, and mentions. No API key required - uses browser automation with managed browser profile. |
Weibo Publisher
Automate posting to Weibo (Sina Weibo) using browser automation through OpenClaw's managed browser.
Prerequisites
- Weibo account must be logged in via managed browser (profile="openclaw")
- Browser must have active session with valid cookies
Quick Start
Basic Post
content = "刚刚解决了一个技术难题!💪"
escaped_content = content.encode('unicode_escape').decode('ascii')
browser(action="navigate", targetUrl="https://weibo.com/", targetId=<tab_id>)
browser(action="snapshot", targetId=<tab_id>)
browser(action="act", request={"kind": "click", "ref": "e31"}, targetId=<tab_id>)
browser(action="act", request={"kind": "type", "ref": "e31", "text": escaped_content}, targetId=<tab_id>)
browser(action="snapshot", targetId=<tab_id>)
browser(action="act", request={"kind": "click", "ref": "e32"}, targetId=<tab_id>)
sleep(3)
browser(action="navigate", targetUrl="https://weibo.com/u/<your_uid>", targetId=<tab_id>)
browser(action="snapshot", targetId=<tab_id>)
Element References
Common element references on Weibo homepage (as of 2026-03-02):
- Main post textbox:
e31 (placeholder: "有什么新鲜事想分享给大家?")
- Send button:
e32 (text: "发送", becomes enabled after typing)
- Quick post button (top nav):
e10 (text: "发微博")
- Quick post textbox (popup):
e746 (when using quick post popup)
- Quick post send button:
e804
Important Notes:
- Element references change frequently between sessions
- Always take a fresh snapshot before each operation
- Refs may differ between homepage (
/) and profile page (/u/<uid>)
- Send button is disabled until content is entered
Content Features
Supported Content Types
- Plain text: Direct text input
- Emoji: Include emoji directly in text (e.g., "😊🎉")
- Hashtags: Use
#topic# format (e.g., "#微博话题#")
- Mentions: Use
@username format
- Line breaks: Use
\n in text
Content Limits
- Maximum length: ~2000 characters (Weibo's limit)
- Recommended length: 140-280 characters for better engagement
Workflows
Workflow 1: Simple Post
Use the main homepage textbox for quick posts:
- Open
https://weibo.com/
- Snapshot to get element refs
- Click textbox (e136)
- Type content
- Click send (e194)
- Verify success
Workflow 2: Quick Post (Popup)
Use the "发微博" button for popup posting:
- Open
https://weibo.com/
- Click "发微博" button (usually e75)
- Snapshot to get popup element refs
- Type in popup textbox (e1028)
- Click popup send button (e1086)
- Verify success
Workflow 3: Scheduled Post
For posts to be published later:
- Follow Workflow 1 or 2 to enter content
- Click "定时微博" icon (clock icon, ref varies)
- Select date and time
- Click send
State Management
Track posting history in memory/weibo-state.json:
{
"lastPublishTime": 1740880260,
"lastPublishDate": "2026-03-02T12:38:00+08:00",
"lastContent": "Your last post content..."
}
Update this file after each successful post.
Error Handling
Common Issues
-
"request: must be object" validation error
- Symptom:
Validation failed for tool "browser": - request: must be object
- Cause: Chinese quotation marks in text causing JSON parsing failure
- Solution: Use Unicode escape for all Chinese characters (see Technical Details)
-
Login expired
- Symptom: Redirected to login page
- Solution: Manually log in via browser, then retry
-
Send button disabled
- Symptom: Button has
disabled attribute
- Solution: Check if textbox is empty or content violates rules
-
Element refs changed
- Symptom: Elements not found with old refs
- Solution: Take fresh snapshot and use updated refs
-
Content rejected
- Symptom: Error message after clicking send
- Solution: Check for sensitive words, adjust content
-
Post not appearing
- Symptom: No error but post doesn't show on timeline
- Solution: Wait 5-10 seconds, refresh page, check if content triggered review
Best Practices
- Always use Unicode escape for Chinese: Prevents JSON parsing errors with quotation marks
- Always snapshot first: Element refs change frequently between sessions
- Separate operations: Click textbox → Type content → Snapshot → Click send (don't combine)
- Verify after posting: Navigate to profile page and snapshot to confirm post appears
- Rate limiting: Wait at least 60 seconds between posts to avoid restrictions
- Content quality: Keep posts engaging, use hashtags for visibility
- State tracking: Always update weibo-state.json after successful posts
- Handle emoji properly: Emoji work in Unicode escape format (e.g.,
\ud83d\udcaa for 💪)
Technical Details
Browser Automation
- Profile:
openclaw (managed browser)
- Method: Chrome DevTools Protocol (CDP)
- Session: Cookie-based, persists across restarts
- No API needed: Pure browser automation
Request Format
Critical: The request parameter must be a JSON object, not a string:
request={"kind": "type", "ref": "e136", "text": "content"}
request="{\"kind\": \"type\", \"ref\": \"e136\", \"text\": \"content\"}"
Unicode Escape for Chinese Content (IMPORTANT!)
Problem: Chinese quotation marks (""、'') in JSON text can cause parsing errors.
Solution: Use Unicode escape (\uXXXX) for all Chinese characters:
text = "刚刚解决了一个技术难题,感觉特别有成就感!"
escaped = text.encode('unicode_escape').decode('ascii')
Example:
request={"kind": "type", "ref": "e31", "text": "\u521a\u521a\u89e3\u51b3\u4e86\u4e00\u4e2a\u6280\u672f\u96be\u9898"}
request={"kind": "type", "ref": "e31", "text": "刚刚解决了一个"技术难题""}
Why: Chinese quotation marks conflict with JSON string delimiters, causing the request parameter to be serialized as a string instead of an object.
Reference Files
Scripts