How to export WeChat Channels video comments and replies
Four endpoints, in this order: WeChat Channels video search, video detail (it turns the search result's export/… ID into the numeric video ID), video comments, then comment replies. The worked example below is 14 calls and costs $0.24; a failed call is not charged.
Updated
The job: a product or topic is being discussed on WeChat Channels (视频号), and you want what viewers wrote under those videos, not only what the creators said. WeChat gives Channels videos no web page and no public comment feed, so the usual way is scrolling the app with a phone in hand. Here you search, resolve each video you keep, read its comments a page at a time and open the reply threads that matter. You end with one table of comments and replies, each with its text, the commenter's name, likes, time and the IP location WeChat shows next to it.
There is one detail that trips people up: search results and the comment endpoints use different IDs. Search hands out an encrypted export/… ID; comments want the numeric video ID. Video detail converts one into the other, which is why it sits between search and comments below.
Step by step
Step 1: search for videos
Call WeChat Channels video search with query set to what you would type into WeChat Search (搜一搜). sort takes relevance (the default), latest or popular, and published_within takes day, week or half_year if you only want recent videos. One call returns up to about 10 videos for $0.02.
curl -G "https://api.okdata.online/v1/wechat_channels/videos/search" \
-H "Authorization: Bearer $OKDATA_API_KEY" \
--data-urlencode 'query=露营装备' \
--data-urlencode 'sort=popular' \
--data-urlencode 'published_within=half_year'
Each result has the description in text, published_at, the account's name and avatar under author, metrics.likes and a cover image in url. Comment counts are null at this stage, and author.id is empty: WeChat Search does not give them. The id looks like export/UzFfBgAAigSMv7F8h8d7wY6qhwxyunx6wtIhB9zjKomRhS82ch. It expires, so resolve it in the same run instead of saving it for next week.
Step 2: resolve each video
Pass the export/… ID as id to WeChat Channels video detail ($0.02 per call). A share link from the app works too, as url=https://weixin.qq.com/sph/AqR7tLm2Kd. The answer carries the numeric video id (such as 14987320651142873906), the account ID in author.id, and metrics.likes, metrics.comments, metrics.shares and metrics.favorites. Now you can see which videos have enough comments to be worth reading. Keep the numeric ID: it does not expire.
curl -G "https://api.okdata.online/v1/wechat_channels/videos/get" \
-H "Authorization: Bearer $OKDATA_API_KEY" \
--data-urlencode 'id=export/UzFfBgAAigSMv7F8h8d7wY6qhwxyunx6wtIhB9zjKomRhS82ch' \
--data-urlencode 'fields=id,text,author.id,author.name,metrics'
Step 3: read the comments
WeChat Channels video comments takes the numeric video ID as id. It returns about 25 top-level comments a page, hottest first, for $0.015. Each has id, text, author.name, likes, replies, published_at and ip_location. For more, send page.next_cursor back as cursor, unchanged, and stop when page.has_more is false.
curl -G "https://api.okdata.online/v1/wechat_channels/videos/comments/list" \
-H "Authorization: Bearer $OKDATA_API_KEY" \
--data-urlencode 'id=14987320651142873906'
Step 4: open the reply threads
WeChat Channels comment replies needs two IDs: id is the top-level comment's ID and post_id is the numeric ID of its video. About 20 replies come back per page for $0.015, each with parent_id set to the comment it answers.
curl -G "https://api.okdata.online/v1/wechat_channels/comments/replies/list" \
-H "Authorization: Bearer $OKDATA_API_KEY" \
--data-urlencode 'id=14987411208833651275' \
--data-urlencode 'post_id=14987320651142873906'
Step 5: put it together in Python
The script runs the four steps and writes one CSV, with a level column that says whether a row is a comment or a reply. MAX_PAGES caps the comment pages per video, which also caps the bill.
import csv
import os
import requests
API = "https://api.okdata.online"
HEADERS = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}
MAX_PAGES = 1 # comment pages per video; each page is one call
VIDEOS = 5 # videos to read
THREADS = 3 # reply threads to open in total
def get(path, **params):
body = requests.get(API + path, headers=HEADERS, params=params, timeout=60).json()
if body["code"] == "not_found":
return None # deleted or private: not charged
if body["code"] != "ok":
raise RuntimeError(f"{body['code']}: {body['message']} (charged: {body['charged']})")
return body
hits = get("/v1/wechat_channels/videos/search", query="露营装备", sort="popular")["data"]["items"]
hits = sorted(hits, key=lambda h: h["metrics"]["likes"] or 0, reverse=True)[:VIDEOS]
videos = []
for h in hits:
body = get("/v1/wechat_channels/videos/get", id=h["id"]) # export/... -> numeric ID
if body:
videos.append(body["data"]["item"])
rows, top = [], []
for v in videos:
cursor = None
for _ in range(MAX_PAGES):
body = get("/v1/wechat_channels/videos/comments/list", id=v["id"], **({"cursor": cursor} if cursor else {}))
if not body:
break
for c in body["data"]["items"]:
rows.append([v["id"], "comment", c["id"], c["text"], c["author"]["name"], c["likes"], c["ip_location"], c["published_at"]])
top.append((c["likes"] or 0, c["id"], v["id"]))
if not body["page"]["has_more"]:
break
cursor = body["page"]["next_cursor"]
for _, comment_id, video_id in sorted(top, reverse=True)[:THREADS]:
body = get("/v1/wechat_channels/comments/replies/list", id=comment_id, post_id=video_id)
for r in (body["data"]["items"] if body else []):
rows.append([video_id, "reply", r["id"], r["text"], r["author"]["name"], r["likes"], r["ip_location"], r["published_at"]])
with open("channels_comments.csv", "w", newline="", encoding="utf-8-sig") as f:
out = csv.writer(f)
out.writerow(["video_id", "level", "id", "text", "user", "likes", "ip_location", "published_at"])
out.writerows(rows)
With the defaults that is 1 search, 5 details, 5 comment pages and 3 reply pages: the worked example above. Three comment pages under each video would add 10 more comment calls, $0.15.
Good to know
- Search IDs expire. An
export/…ID is only good for a short while. Resolve it with video detail right away and store the numericidinstead. - Reply counts can be missing. WeChat does not always send a reply count, so
repliescan be null. That is why the script picks threads by likes; a comment without replies just comes back as an empty page. - No play counts. WeChat does not show how many times a Channels video was played, so
metrics.viewsis null andmeta.unavailablesaysplatform. - Commenter IDs. A commenter's
author.idends in@finderwhen it is a Channels account. Some end in@strangerinstead; the account endpoints do not take those. - Order. Comments come hottest first. There is no newest-first option, so sort by
published_atyourself if time matters. - Retries and missing videos. Send an
Idempotency-Keyheader with each call: a repeat of the same request within 24 hours returns the stored result withmeta.replayed: trueand no new charge. A video deleted since the search answersnot_found, which is free.
To follow one account instead of a keyword, start from WeChat Channels account videos. For turning comments into findings across platforms, see word of mouth.
What the example costs
One page of search results for 露营装备 (camping gear), the detail of 5 videos, the first page of comments under each, then the replies under the 3 most-liked comments
| Endpoint | Calls | Price | Subtotal |
|---|---|---|---|
| WeChat Channels video search | 1 | $0.02 | $0.02 |
| WeChat Channels video detail | 5 | $0.02 | $0.10 |
| WeChat Channels video comments | 5 | $0.015 | $0.075 |
| WeChat Channels comment replies | 3 | $0.015 | $0.045 |
| Total | 14 | $0.24 |
Prices in force when this page was built. A failed call costs nothing.
In your AI (MCP)
Connect the MCP server once, then say what you want. The agent finds these endpoints, reads their prices and calls them on your balance.
SaySearch WeChat Channels for 露营装备, look up the 5 videos with the most likes, get the first page of comments under each, then the replies under the 3 most-liked comments. Give me one table: video, comment or reply, likes, IP location, time.
What the agent sends to the call tool first
{
"endpoint": "wechat_channels.videos.search",
"params": {
"query": "露营装备推荐"
},
"idempotency_key": "<a new UUID>"
}