I Automated Publishing to 9 Platforms with Python + Playwright
Writing the article takes 40 minutes. Publishing to 9 platforms takes another 30. So I built a tool to handle it automatically.
The Problem
Every tech blogger knows this pain:
- Open Juejin → paste title → paste content → fix formatting → pick tags → publish
- Open Zhihu → paste title → paste content → fight with Draft.js eating line breaks → publish
- Open CSDN → paste title → paste content → set category → publish
- Open Cnblogs → remember to add
[Markdown]tag → paste everything → publish - Repeat for SegmentFault, Xiaohongshu, Douyin, Bilibili, WeChat Video...
Each platform has its own editor quirks. Markdown that looks perfect on one platform breaks on another. Code blocks lose syntax highlighting. Line breaks multiply or disappear.
So I built PolyPost — an open-source tool that publishes to all 9 platforms with a single click.
GitHub: https://github.com/wxfwxf911/polypost (⭐ star it if you find it useful!)
Architecture
User writes Markdown once
|
v
Content adaptation layer (Markdown → HTML / Rich Text / Plain Text)
|
v
Platform adapters (Juejin, Zhihu, CSDN, Cnblogs...)
|
v
Platform APIs / Playwright browser automation
The Interesting Parts
1. Zhihu's Anti-Crawler Signature (x-zse-96)
Zhihu requires a cryptographic signature on every API request. It's an AES-CBC encrypted MD5 hash with a fixed prefix and uses the d_c0 cookie value as part of the signed string. Had to reverse-engineer this from Zhihu's frontend JavaScript.
2. CSDN's X-Ca HMAC-SHA256
CSDN uses Alibaba Cloud's API Gateway signing mechanism — every request needs X-Ca-Signature, X-Ca-Nonce, and X-Ca-Timestamp headers. The signing string must use \n as the separator (not spaces!), which took me 2 hours to debug.
3. Cnblogs MetaWeblog XML-RPC
One of the few platforms with a standard API — though it's the ancient XML-RPC protocol from 2002. And yes, you must include [Markdown] in the categories or it parses your content as HTML. Not documented anywhere.
4. Playwright for Platforms Without APIs
Some platforms (Xiaohongshu, Douyin) don't have public APIs. For those, PolyPost falls back to Playwright browser automation — injecting pre-extracted cookies, filling forms, and clicking submit.
Tech Stack
| Layer | Tech | Why |
|---|---|---|
| Backend | Python / FastAPI | Async, fast, great docs |
| Frontend | Vanilla HTML/CSS/JS | Zero npm dependencies |
| DB | SQLite | Single file, zero ops |
| Browser Extension | Chrome MV3 | One-click cookie extraction |
| Fallback | Playwright | For platforms without APIs |
Results
After two weeks of evening hacking, it works. I write an article, click publish, go make coffee, and when I come back it's on all 9 platforms.
The tool handles:
- Automatic format adaptation per platform
- Cookie management via browser extension
- Stats aggregation (views, likes, comments)
- Scheduled publishing (coming soon)
Try It
Open source, MIT licensed:
👉 https://github.com/wxfwxf911/polypost
If you publish to multiple Chinese platforms, give it a try. If you want support for another platform, open an issue.
Tags: #python #playwright #automation #opensource #productivity
Top comments (0)