SSkilltecabyclaudinhocode
Enviar skill
← Voltar para o catálogo

wechat-article-downloader

DevOps e Infra

Downloads WeChat Official Account (微信公众号) articles and converts to Markdown with local images. Supports single URL, batch file, search by account name via Sogou, or bulk download via WeChat API. Use when user mentions "download wechat article", "保存公众号文章", "下载公众号", "微信文章转markdown", "备份公众号", or provides mp.weixin.qq.com URLs.

2estrelas
Ver no GitHub ↗Autor: acchaaccLicença: MIT

WeChat Article Downloader

Downloads WeChat Official Account articles via Chrome CDP and converts to clean Markdown with locally saved images.

Script Directory

Agent Execution Instructions:

  1. Determine this SKILL.md file's directory path as SKILL_DIR
  2. Detect runtime: if bun is available use bun, otherwise use npx -y bun. Store as ${BUN_X}
  3. Script path = ${SKILL_DIR}/scripts/main.ts

Runtime Detection (one-time per session):

command -v bun >/dev/null 2>&1 && echo "bun" || echo "npx -y bun"

Run ${BUN_X} ${SKILL_DIR}/scripts/main.ts --help for full CLI options.

Preferences (EXTEND.md)

Check for user preferences (priority order):

test -f .wechat-article-downloader/EXTEND.md && echo "project"
test -f "$HOME/.wechat-article-downloader/EXTEND.md" && echo "user"
ResultAction
FoundRead, parse, apply settings
Not foundUse defaults

See references/config/preferences-schema.md for full schema.

Usage

Single Article

${BUN_X} ${SKILL_DIR}/scripts/main.ts "https://mp.weixin.qq.com/s/xxxx"

Custom Output Directory

${BUN_X} ${SKILL_DIR}/scripts/main.ts "https://mp.weixin.qq.com/s/xxxx" -o ./articles/

Search by Account Name (via Sogou)

${BUN_X} ${SKILL_DIR}/scripts/main.ts --search "公众号名称" --max 5
${BUN_X} ${SKILL_DIR}/scripts/main.ts --search "公众号名称" --list

Batch Download from URL List

${BUN_X} ${SKILL_DIR}/scripts/main.ts urls.txt -o ./backup/

Download from Own Account (API)

Requires WeChat Official Account API credentials (see Environment Variables):

${BUN_X} ${SKILL_DIR}/scripts/main.ts --account --list
${BUN_X} ${SKILL_DIR}/scripts/main.ts --account -o ./my-articles/
${BUN_X} ${SKILL_DIR}/scripts/main.ts --account --max 20

Download Modes

ModeTriggerBehavior
Single URLPass a mp.weixin.qq.com URLDownload one article via CDP
Batch filePass a .txt file pathDownload all URLs sequentially
Search--search "name"Find articles via Sogou, then download
Account--account flagList + download all via WeChat API
Wait--wait flagOpen Chrome, user logs in, press Enter to capture

Output Format

YAML frontmatter + Markdown body:

---
title: "Article Title"
author: "Author Name"
date: "2024-01-15"
source_url: "https://mp.weixin.qq.com/s/xxxx"
description: "Article digest..."
captured_at: "2024-01-15T12:00:00.000Z"
---

Environment Variables

VariableDescription
WECHAT_DL_CHROME_PATHCustom Chrome executable path
WECHAT_DL_CHROME_PROFILE_DIRCustom Chrome profile directory
WECHAT_APP_IDWeChat Official Account App ID (for --account mode)
WECHAT_APP_SECRETWeChat Official Account App Secret (for --account mode)

API credentials can also be set in .wechat-article-downloader/.env or ~/.wechat-article-downloader/.env.

Troubleshooting

IssueFix
Chrome not foundInstall Chrome or set WECHAT_DL_CHROME_PATH
TimeoutIncrease --timeout value
Login requiredUse --wait mode
API errorsCheck WECHAT_APP_ID and WECHAT_APP_SECRET
Images not loadingPage may need more scroll time; increase timeout
Sogou captchaTry again later or use direct article URL

Como adicionar

/plugin marketplace add acchaacc/wechat-article-downloader

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Comentários · Nenhum comentário

Entre para comentar. Entrar

  • Ainda não há comentários. Seja o primeiro.