SuperAPI AI Directory

zhihu-post

Marketing & growth

View repository

Updated 10-15 08:08

About this skill

Zhihu Posting Skill

Content Types

Type URL Applicable Scenario
Column Article https://zhuanlan.zhihu.com/write Long-form, in-depth content
Idea (Dynamic Post) https://www.zhihu.com/ Short content, casual thoughts, ≤1000 characters

Prerequisites

The user needs to complete the following operations in Windows Chrome :

  1. Open the target URL (article or homepage)
  2. Ensure you are logged in to Zhihu
  3. Click the OpenClaw Browser Relay toolbar icon to attach tab (badge lights up)

Publishing a Column Article Workflow

Step 1: Confirm tab connection

browser(action=tabs, profile="chrome")

Confirm that the Zhihu editor page is in the list.

Step 2: Get page snapshot

browser(action=snapshot, profile="chrome", interactive=True)

Step 3: Fill in the title

Zhihu article title input selector:

input[placeholder*="标题"]

Or use the aria ref to click the title area and use browser(action=act, request={kind:type, ref:<ref>, text:"..."}) to fill it in.

You can also use JS:

const titleInput = document.querySelector('textarea[placeholder], input[placeholder*="标题"]');
titleInput.value = "你的标题";
titleInput.dispatchEvent(new Event('input', {bubbles: true}));

Step 4: Fill in the body

The Zhihu article editor is Draft.js,selector:

.notranslate.public-DraftEditor-content[contenteditable="true"]

⚠️ Draft.js You cannot directly assign innerHTML, you must use execCommand:

const el = document.querySelector('[contenteditable="true"]');
el.focus();
document.execCommand('selectAll');
document.execCommand('insertText', false, '你的正文内容(纯文本)');

If you need multiple paragraphs, insert \n\n to separate paragraphs. If you need rich text formatting such as bold/headings, click the corresponding button in the toolbar before executing insertText.

Step 5: Publish

Find the ref for the "Publish" button in the snapshot and click it:

browser(action=act, profile="chrome", request={kind:click, ref:<发布按钮ref>})

Or JS:

// 找包含"发布"文字的按钮
[...document.querySelectorAll('button')].find(b => b.textContent.includes('发布文章'))?.click()

Step 6: Confirm successful publishing

The page redirects to the article detail page (URL contains zhuanlan.zhihu.com/p/) which means success.


Publishing an Idea (Dynamic Post) Workflow

An idea is the short content box on the Zhihu homepage, limited to about 1000 characters.

Step 1: Open the idea input box

At https://www.zhihu.com/ After the snapshot, click "Write an idea" or the top input box to trigger the editor to expand.

Step 2: Fill in the content

Idea editor selector (contenteditable div):

const editor = document.querySelector('.PublishThought-editor .DraftEditor-contentWrapper [contenteditable="true"]');
// 或尝试:
const editor = document.querySelector('[contenteditable="true"][data-contents]');
editor.focus();

Use browser(action=act, request={kind:type, ref:<ref>, text:"..."}) to input, or set it with JS.

Step 3: Publish

Click the "Publish" button (usually at the bottom right).


Notes

  • Before first useLog in to Zhihu manually in Chrome first to avoid a CAPTCHA popping up when publishing
  • When the content contains images: first copy the images to /tmp/openclaw/uploads/, then use browser(action=upload) to upload
  • Zhihu has posting frequency limits for new accounts; the interval between consecutive posts should be ≥ 3 minutes
  • After publishing is complete, take a screenshot browser(action=screenshot) to keep as evidence

Reference Files

  • references/dom-selectors.md — Quick reference for the DOM structure of various Zhihu pages