Wx Gzh Link Crawler
Use this skill to export historical article links for one WeChat Official Account, also called a gongzhonghao or gzh. The bundled script only collects list metadata from mp.weixin.qq.com: title, digest, publish time, article URL, and cover URL. It does not open article pages and does not fetch article body content.
First-Run Checklist
Before running, make sure the user has:
- A logged-in WeChat Official Account Platform session at
https://mp.weixin.qq.com. - A valid
tokenfrom the mp.weixin.qq.com URL. - A valid
Cookierequest header formp.weixin.qq.com. - The target official account name, or its
fakeidif already known.
If credentials are missing, tell the user to read references/credentials.md. Never ask the user to paste cookie/token into chat unless they explicitly accept that risk; prefer local config, environment variables, or command-line arguments typed on their machine.
Script
Use scripts/fetch_gzh_links.py.
Default behavior:
- One WeChat backend API page returns up to 5 articles. This is the practical page size to explain to users.
- One script run exports up to 100 articles by default.
- Change the run limit with
--max-articles N. - Use
--max-articles 5to fetch one page only. - Use
--max-articles 20,--max-articles 50,--max-articles 100, etc. to fetch a specific maximum count. - Use
--max-articles 0to keep turning pages until the API stops returning more items or the session/rate limit blocks the run. - Use
--since-date,--after-date, and--until-datefor incremental or date-range exports. - Output format is CSV by default, encoded as
utf-8-sigfor Excel compatibility. - Optional JSON output is available with
--format json. - The script exports link-list metadata only. It must not fetch article body content unless the skill is explicitly extended later.
CSV columns:
account_query, fakeid, title, digest, publish_time, create_time, link, cover_url
Crawl Amount Choices
Always tell the user which mode will be used before running:
- One page test:
--max-articles 5 --page-size 5; saves at most 5 links. - Default run: omit
--max-articles; saves at most 100 links. - Specific count:
--max-articles N; saves at most N links, turning pages in batches of 5. - Best-effort full history:
--max-articles 0; keeps paging until no more list items are returned or WeChat rejects/limits the session. - Incremental update: use
--after-date YYYY-MM-DDor--since-date YYYY-MM-DD; starts from the newest page and stops once articles are older than the lower date bound. - Date range: use
--since-date YYYY-MM-DD --until-date YYYY-MM-DD; keeps only articles in that range and stops when older pages are no longer needed.
Do not promise true "all historical articles" as guaranteed. The mp.weixin.qq.com backend can stop, rate-limit, or hide older items depending on account/session state.
Incremental Update Guidance
Use date filtering for repeat crawls instead of re-fetching everything.
--since-date 2026-07-04keeps articles published on or after2026-07-04 00:00:00.--after-date 2026-07-04keeps articles published after2026-07-04 23:59:59; this is the right choice for "after July 4".--until-date 2026-07-11keeps articles published on or before2026-07-11 23:59:59.
Example: if the user fetched links on July 4, 2026 and comes back on July 11, 2026 asking for only new links after July 4, run:
python C:\Users\ASUS\.codex\skills\wx-gzh-link-crawler\scripts\fetch_gzh_links.py --account "account name" --after-date 2026-07-04 --max-articles 0
This still requests pages in 5-article batches because that is how the WeChat backend list works, but it does not need to save or continue through the full history. It stops when it reaches articles at or before the requested lower date bound.
Workflow
- If credentials are missing, guide the user through references/credentials.md.
- If the user has only an account name, run the script with
--account. - If the user already has
fakeid, run the script with--fakeidto skip search. - After export, tell the user how many links were saved and where the output file is.
- Tell the user the output format: CSV by default, or JSON when
--format jsonis used. - Reconfirm that no article body content was fetched.
- If the API returns
ret=200003,ret=200013, orinvalid session, tell the user the cookie/token expired and send them back to the credential refresh steps.
Commands
Create a local config template:
python C:\Users\ASUS\.codex\skills\wx-gzh-link-crawler\scripts\fetch_gzh_links.py --init-config
Fetch by official account name:
python C:\Users\ASUS\.codex\skills\wx-gzh-link-crawler\scripts\fetch_gzh_links.py --account "account name" --max-articles 100
Fetch one page only:
python C:\Users\ASUS\.codex\skills\wx-gzh-link-crawler\scripts\fetch_gzh_links.py --account "account name" --max-articles 5 --page-size 5
Fetch as much as the backend will return:
python C:\Users\ASUS\.codex\skills\wx-gzh-link-crawler\scripts\fetch_gzh_links.py --account "account name" --max-articles 0
Fetch only articles after a prior crawl date:
python C:\Users\ASUS\.codex\skills\wx-gzh-link-crawler\scripts\fetch_gzh_links.py --account "account name" --after-date 2026-07-04 --max-articles 0
Fetch a date range:
python C:\Users\ASUS\.codex\skills\wx-gzh-link-crawler\scripts\fetch_gzh_links.py --account "account name" --since-date 2026-07-04 --until-date 2026-07-11 --max-articles 0
Fetch by known fakeid:
python C:\Users\ASUS\.codex\skills\wx-gzh-link-crawler\scripts\fetch_gzh_links.py --fakeid "MzkxMjYzMzE2Mg==" --account "account label" --max-articles 100
Save JSON instead of CSV:
python C:\Users\ASUS\.codex\skills\wx-gzh-link-crawler\scripts\fetch_gzh_links.py --account "account name" --format json
User Guidance
When the user is ready to run it, explain these points in the user's language:
- Prepare the mp.weixin.qq.com cookie and token first; offer credential steps if they do not have them.
- Store credentials in the local config, or set
WX_MP_COOKIEandWX_MP_TOKEN. - Ask for the target WeChat Official Account name next.
- Ask how much to fetch: one page (5 links), a specified maximum count, default 100, or best-effort full history.
- For repeat crawls, ask whether the user wants new links after a previous date; prefer
--after-datefor "after that day". - State that one API page returns up to 5 articles and the script turns pages automatically in batches of 5.
- State that the result is CSV by default and contains article links plus list metadata only, not body content.
Scan to join WeChat group