Skip to navigation

Make a WeChat RSS feed from article listings and move an existing subscription

To follow new WeChat articles in a reader, generate wechat.xml from the titles, links and available summaries that wechat_mp.v2.fetch_account_articles returns in the account’s article list. Publish wechat.xml at an HTTPS address the reader can reach and subscribe to that address. Each refresh costs only the list pages you actually request. To show more article text in the reader, use the body excerpt RSS workflow for selected articles.

Generate a listing snapshot for one account

  1. Call wechat_mp.v2.fetch_account_articles with a confirmed username and raw:false, following incremental article checks.
  2. Keep the successful scan’s state.json and coverage.json, and check the account, the pages read and the stop reason in coverage.json.
  3. For a migration trial, select two older articles and one current article and record each article’s app_msg_id and idx.
  4. For scheduled updates, start each check on page one and follow that run’s cursor within your page limit.

If a scan fails, keep the published feed unchanged and update the feed after the next successful scan.

When the team only wants to see what was published today, a title, a source link and the available list summary are enough for a feed item. For example, a reader clicks the feed item “Installation manual update” and opens the original WeChat post. If readers need a body excerpt inside the reader, use the article-excerpt workflow for the selected articles.

Turn selected articles into feed input

  1. Save make_feed.py from the two-feed guide. make_feed.py reads a JSON file with items.
  2. Save the adapter below as wechat_feed_input.py. wechat_feed_input.py reads the article keys you choose from the saved state.json and writes the items input for make_feed.py.
  3. Run wechat_feed_input.py with the saved state file, the feed homepage’s HTTPS URL and the article keys to publish:
python3 wechat_feed_input.py state.json https://feeds.example.com/ 11801:1 11802:1 11803:1 > wechat-items.json &&
python3 make_feed.py wechat-items.json wechat.xml
import json
import sys
from pathlib import Path
from urllib.parse import urlsplit
state_path, homepage, *selected = sys.argv[1:]
if not selected or len(set(selected)) != len(selected):
raise SystemExit("Supply one or more distinct app_msg_id:idx keys")
state = json.loads(Path(state_path).read_text(encoding="utf-8"))
account = state["username"]
articles = {f"{row['app_msg_id']}:{row['idx']}": row for row in state["articles"]}
items = []
for key in selected:
if key not in articles:
raise SystemExit(f"Article key unavailable: {key}")
row = articles[key]
link = urlsplit(row["url"])
if link.scheme != "https" or link.hostname != "mp.weixin.qq.com" or link.username:
raise SystemExit(f"Verify the source link for {key}")
items.append({
"id": f"wechat:{account}:{key}",
"title": row["title"],
"url": row["url"],
"excerpt": row.get("digest") or "",
})
print(json.dumps({
"title": f"WeChat: {account}",
"link": homepage,
"description": "Selected article listing excerpts",
"items": items,
}, ensure_ascii=True, indent=2))

wechat_feed_input.py passes the saved digest when the article has one, and omits publication times. To filter by date, verify the unit and timezone of create_time, then set the generator’s published_at field. Keep the collection time in your scan records.

Trial an existing subscription migration

  1. Keep a copy of the old OPML and of the old feed XML if available.
  2. Compare the link and guid of two articles that appear in both the old feed and wechat.xml. wechat_feed_input.py creates a stable ID from the account and the article key. If your reader relies on the old IDs, replace the new input item’s id with the old guid after verifying that both point to the same original article, and keep the ID mapping for later runs.
  3. Keep URLs that contain private access tokens in local records only.
  4. Serve wechat.xml at an HTTPS URL you control and add one test subscription in your reader. If the reader supports OPML import, replace xmlUrl in the sample OPML below.

The OPML file carries subscription URLs only; whether read state migrates depends on the reader.

<opml version="2.0">
<head><title>WeChat trial subscription</title></head>
<body>
<outline text="WeChat research" type="rss"
xmlUrl="https://feeds.example.com/wechat.xml" />
</body>
</opml>

What should you see in a three-article trial?

What happens after you publish the feedWhat to check
Two older articles and one current article are availableOpen a link and confirm the link leads to the original WeChat article. A summary-only item needs its summary and original link.
The same three articles reappear as unread after regenerating the feedCompare guid and link across both versions of the XML at the same subscription URL. If the XML has not changed, check whether the reader treats the old and trial URLs as separate subscriptions.
You add one article and the new article is the only new item after refreshSwitch subscriptions. To preserve history or read state, check what your reader can migrate and back up before disabling the old feed.

Checking one page for each of five accounts daily for 30 days uses 150 list requests. Extra pages and article details are counted separately. See BeatAPI pricing.

RSS specification · OPML specification