Skip to content

shike/mp-copy

Repository files navigation

mp-rewrite

A Hermes-Agent skill that scrapes a WeChat public-account article and produces a deep-rewritten, copy-pasteable HTML.

What it does

  1. Takes a https://mp.weixin.qq.com/s/... URL
  2. Scrapes title, author, body blocks (paragraphs, headings, images, blockquotes, lists)
  3. Downloads images to local with the WeChat referer header
  4. Hermes-Agent LLM rewrites the content (deep rewrite — change perspective, structure, examples, tone)
  5. Generates a new title
  6. Renders into a beautified HTML using inline CSS
  7. Outputs index.html that can be directly copy-pasted into the WeChat editor

Install

cd /Users/shike/Desktop/code/mp-copy  # this repo
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

To make it a Hermes-Agent skill:

ln -s /Users/shike/Desktop/code/mp-copy ~/.hermes/skills/mp-rewrite

Usage (inside Hermes-Agent)

Ask Hermes-Agent something like:

帮我改写这篇公众号文章:https://mp.weixin.qq.com/s/...

The skill is triggered. Output lands in your current working directory under ./output/<article_id>/index.html. Open the file:// link in a browser, select all, copy, paste into the WeChat editor.

Usage (CLI, without Hermes)

# 1. Scrape
PYTHONPATH=. python3 scripts/scrape.py "https://mp.weixin.qq.com/s/..." --output ./output

# 2. Manually copy/edit original.json -> rewritten.json (or have Claude/Hermes do it)

# 3. Render
PYTHONPATH=. python3 scripts/generate_html.py \
  ./output/<id>/rewritten.json \
  --template templates/article.html

Project structure

mp-rewrite/
├── SKILL.md
├── README.md
├── requirements.txt
├── scripts/
│   ├── scrape.py
│   ├── generate_html.py
│   └── similarity.py
├── templates/
│   └── article.html
└── tests/
    ├── unit/
    ├── integration/
    └── e2e/

Tests

# Unit + integration (offline, fast)
PYTHONPATH=. pytest tests/unit tests/integration

# E2E Case A — real network (requires editing tests/e2e/fixtures.yaml with a real URL)
PYTHONPATH=. pytest tests/e2e -m network

# E2E Case B — manual run with similarity check
PYTHONPATH=. python tests/e2e/run_full_skill.py ./output/<id>

Limitations

  • Only works with public, non-paywalled WeChat articles
  • Does not bypass login walls or captchas
  • Assumes Chinese-language input (no translation)
  • Does not auto-publish to WeChat

About

mp-copy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors