CommunityWriting & Editinggithub.com

WeChat Article Fetcher

Fetch and discover WeChat Official Account articles with zero dependencies, no login required, and only a browser User-Agent as the entry barrier (SKILL + 3 Python scripts, MIT license).

What is WeChat Article Fetcher?

This skill provides a lightweight, zero-dependency toolchain for fetching and discovering public WeChat Official Account articles. It consists of three Python scripts (`wechat_fetch.py`, `wechat_discover.py`, and `batch_fetch.py`) that operate entirely without login credentials, cookies, or JavaScript execution. The core mechanism relies on setting a browser User-Agent header to access server-rendered HTML, extracting article content from the `#js_content` div, and obtaining image URLs from `data-src` attributes (no hotlink protection). For discovery, it uses Sogou search to retrieve metadata and generates clean HTTP direct article links from encrypted redirect chains, but with strict rate limits (approximately 15–20 requests per 30 minutes trigger IP-level CAPTCHA). The skill emphasizes legal and ethical constraints: no login state handling, no CAPTCHA bypassing, no large-scale scraping (≤500 articles/day), and non-commercial, non-redistribution use. It supports multiple output formats (Markdown, JSON, plain text) and includes robust error handling with structured `WeChatError` exceptions and a diagnostic table for troubleshooting failures.

Works with~Claude Code~Codex CLI~Cursor
npx skills add JJ-Yvain-Skills/wechat-article-fetch

Installed? Explore more Writing & Editing skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

wechat-article-fetch · Fetch WeChat Official Account Articles

Core Facts (Verified, Directly Executable)

  • User-Agent is the Only Entry Barrier: Use a browser UA built into the scripts. Without a UA / curl / python-requests / MicroMessenger → all get 302 redirect.
  • Article Body is Easily Accessible: Server-rendered, in <div id="js_content">, raw GET suffices, no JS/Cookie/Login required.
  • Images Have No Hotlink Protection: Real URLs are in data-src.
  • Discovery Layer: Original articles are not indexed by search engines; Sogou provides encrypted redirect chains. Clean-state pure HTTP can decode the signature into a direct link (window ≥1 hour, fetch promptly) ; ⚠️ Sending ~15–20 requests in 30 minutes triggers IP-level CAPTCHA (requires human intervention, browser cannot solve it) → serialize with low frequency, stop on trigger.

UA Example (for writing your own scripts): Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Usage (Scripts in same directory, zero dependencies, CLI + library dual mode, structured WeChatError)

python wechat_fetch.py "<url>" [--format md|json|text] [--out FILE]   # Fetch article body
python wechat_discover.py "keyword" [--format table|json]              # Search metadata (redirect chain decoding see channel status)
python batch_fetch.py urls.txt [--min-delay 3] [--max-delay 8] [--daily-limit 500]  # Batch: rate limit / resume from breakpoint / halt on CAPTCHA

Channel Status (Tested 2026-08, to avoid dead ends)

ChannelStatus
Public article page raw fetch✅ Long-term stable (core of this skill)
Sogou search✅ Only recent metadata (clean state); redirect chain pure HTTP decode signature URL (window ≥1 hour, fetch promptly); ⚠️ ~15–20 requests in 30 minutes trigger IP CAPTCHA, requires human
Collection (album) page⚠️ Anonymous browsing possible, only articles within the collection
Official Account homepage history list❌ Anonymous access blocked: "Please open the link in WeChat client"; getmsg returns only latest ~10 articles
Official Account backend cross-account search❌ Defunct (WeChat closed on 2026-07-30, industry tools all down)

Conclusion: Fetching layer stable; discovery layer ceiling = Sogou recent + collections (⚠️ dynamic rate limiting, use low frequency); full history has no compliant channel.

Workflow

  • Have a link → GET (with browser UA) → Extract #js_content → Output. On failure, consult the diagnostic table, do not blindly retry.
  • Have only a keyword → Get metadata from Sogou; to get the article body, pure HTTP decode the redirect chain JS string to get the signed URL, then feed back into the fetch workflow (on failure / anti-crawl trigger, fall back to browser; or look for mirrored reprints, alert user that content may be deleted/edited). Do not attempt homepage history or backend search (dead/blocked).

Parsing (Only needed if writing your own regex; can skip when using the scripts directly)

Anchors: var msg_title / nickname / ct + #js_content. ⚠️ msg_title/nickname may have .html(false)/htmlDecode() wrappers — regex must match only the first quoted string after the equals sign, otherwise everything will be empty; images take data-src instead of src.

Failure Diagnosis (Do not retry blindly)

SymptomCauseAction
302Invalid UASwitch to browser UA
200 + Parameter errorInvalid linkStop, verify the link
302 → antispiderSogou-side block (IP-level CAPTCHA, tested 2026-08-13, requires human)Stop, do not bypass; retry at low frequency or wait for recovery (browser also blocked)
302 → appmsgcaptchaAbnormal link / CAPTCHA triggeredStop, do not bypass
200 + Page does not existUA detected as crawlerSwitch to browser UA
200 + Please open in WeChat clientPage requires loginChannel unavailable, switch to Sogou/collection
200 + Deleted/ViolationArticle has been processedSkip, record reason

Hard Constraints (Stop on violation)

  1. Do not touch login state: Personal WeChat / Official Account backend cookies, QR code login states are never used (account ban + contract breach).
  2. Do not bypass CAPTCHA: Triggering means full stop (bypassing technical measures violates Article 285 of Chinese Criminal Law).
  3. Do not scrape at scale: robots.txt disallows entire site; intended for small-scale personal research; serialize with second-level intervals, ≤500 articles per day.
  4. No commercial use, no redistribution: Articles are protected by copyright; personal study/research falls under fair use (prerequisite: no redistribution, no commercial use, retain attribution).
  5. Discovery layer is subject to dynamic rate limits (tested 2026-08-13: ~15–20 requests per 30 minutes trigger IP CAPTCHA, not automatically lifted within hours): serialize at low frequency (recommended ≤10 requests per 30 minutes), stop entirely on trigger, wait for recovery, do not attempt to bypass.

Related Skills