How do I export Channels comments and organize recurring viewer questions?
Fetch a video’s visible comments with wechat_channels.v2.fetch_video_comments and the video’s numeric ID, save each response, then export the saved responses to comment-observations.csv with export_channel_comments.py. Leave comment_id empty for top-level comments. To read the replies to one comment, pass that parent comment’s comment_id and start at page one of the parent’s reply thread.
For example, for an event-introduction video, you might investigate viewer questions about tickets, reservations and admission. Find the specific questions, check whether the video already answers each question, then decide what to add to the FAQ or the video description.
Start with one video
- Confirm the target video. Reuse the video’s numeric ID. With only a share link, follow the link and identifier workflow to confirm the video and the account.
- Retrieve root comments. Start with at most three pages, and save the text, the returned like counts, the times and the sources. Plan another batch when the research needs broader coverage.
- Expand replies that change the meaning. A comment such as “Does this also need a reservation?” may refer to a specific activity. Read that parent comment’s replies and keep the parent–reply relationship.
- Organize the questions. Keep each commenter’s original wording separate from your summary. Check the video’s own explanation, then mark the next action: cite an existing answer, add an explanation or verify a detail.
For an assistant connected to BeatAPI:
Read at most three comment pages for this event video. Organize questions about ticket price, reservations and admission. Keep original wording and sources, and inspect replies when context requires them. Export the source table and list questions worth adding to the FAQ.
Turn comments into useful FAQ leads
Comments with similar wording may belong to one theme, but the same comment returned twice stays one source. Describe the question records you actually reviewed; a three-page sample does not represent every viewer.
Read the export
comment-observations.csv holds one observation per row. coverage.json records the video, the parent branch, the pages actually read and the stop reason. Review the comment text first, then select reply parents from the original response. prepare_reply_branch.py (later on this page) prepares a reply-branch request from the saved response, so you never copy a long ID that spreadsheet software may have altered.
comment-observations.csv omits the nickname, avatar and location profile columns, so the review stays on the questions. Before sharing, check the comment text for personal details that commenters disclosed themselves, and store the raw responses separately from the working table.
The sections below cover retrieval, saved pages and local export. Each run of export_channel_comments.py processes one branch of one video.
Select the root branch or one reply branch
Both branches use data:wechat_channels.v2.fetch_video_comments:
- For root comments, set
comment_id="". - For replies, set
comment_idto the selected parent’s exactcomment_id.
The root branch and the reply branch are one action with different scope, not a separate reply endpoint. Reset last_buffer to "" at the start of each branch, and set raw:false explicitly. The response contains data.object_id, comment_id, comments, down_continue and last_buffer. Each comment has comment_id and content, and optionally like_count, reply_count and create_time. A reply_count value counts replies; the value is not a collected reply.
A root-page request looks like the body below. Sending the request needs its own approval; the exporter further down runs offline.
Save full responses and export one branch
- Create
comment-pages.json. Paths incomment-pages.jsonare relative to the manifest file. For each later page, pass the actuallast_bufferfrom the preceding page, not a page number, and keepobject_id,comment_idandrawunchanged. Save the actual HTTP status and the collection time of every page, including a final failed response. Do not fabricate a JSON response for a transport timeout.
- Save the script below as
export_channel_comments.pyand runpython3 export_channel_comments.py comment-pages.json root-review. - For a selected parent’s replies, use a separate manifest and a separate output directory, such as
reply-123-review. Never mix root pages and reply pages in one chain.
export_channel_comments.py checks the returned object_id and parent identity. If the returned echo is unsafe or does not match, export_channel_comments.py stops before creating output instead of trusting a possibly rounded identifier.
Accept the table, not just a successful HTTP response
- One CSV row is one observation.
export_channel_comments.pyflags duplicate usable comment IDs instead of silently replacing the earlier row, and keeps missing and null counts distinguishable. A duplicate comment is not a second independent opinion. - A row with an unsafe comment ID has no usable
comment_id. You can still review the row’s text by itssource_indexandcomment_index, but the row cannot safely drive a reply request. Do not repair an unsafe ID by casting a rounded number to text. provider_endmeans only that the current branch reached the provider’s reported end. A finished root branch does not finish any reply branch. Budget exhaustion, a repeated or missing cursor, an empty page that still reports more, and unsupported flags are separate stop reasons.- A final gateway error keeps the earlier comments and the error evidence. A mixed object or parent, a bad schema or a broken cursor chain rejects the whole batch.
export_channel_comments.pynever overwrites existing output; treat an output directory whose writing was interrupted as incomplete. - The CSV deliberately leaves out the nickname, username, avatar and IP-region fields. Comment text can still identify people, so removing profile columns is not anonymization. Review and redact a separate copy for sharing, and keep the originals only in the private local evidence directory. The scripts do not upload or notify anywhere.
Budget the review before collecting
For example, three root pages plus one reply page for each of two selected parents is at most five planned comment-page requests. Estimate the five requests with current pricing. Finding the video and any extra pages are separate requests; the actual number of comments depends on the responses. Exporting and reviewing saved material locally needs no new retrieval.
Read the exported text and choose a few questions or complaints worth checking; keep the source row next to each quoted example. A bounded sample does not support claims about sentiment, representativeness, unique users or all public discussion. A selected reply branch can add context, but the saved reply request must name the exact safe parent taken from the root evidence.
Before exporting, check the comment fields and cursor fields against your saved response. The examples on this page use synthetic records.
Select a reply parent from the saved root evidence, not from a copied spreadsheet ID
- In the root export, choose the parent’s
source_index(one-based page number) andcomment_index(zero-based row in the originalcommentsarray). - Save the script below as
prepare_reply_branch.pyand runpython3 prepare_reply_branch.py root-review 1 0 selected-parent. Inspect the exact source comment first; do not pick a parent automatically by title, author name or largestreply_count. prepare_reply_branch.pyrereads the archived response and checks the response’s hash, action, root scope and identity.prepare_reply_branch.pydoes not trust an edited comment ID in the CSV: a safe integer or an original digit string is accepted, and an unsafe numeric parent stops before output.reply_countis not treated as proof that replies are currently available.prepare_reply_branch.pywrites an unexecuted reply request and the local parent provenance into the new directoryselected-parent.
After separately approved collection, record the exact object_id and comment_id with the actual response and time in a new reply manifest that starts with last_buffer="". Run export_channel_comments.py into a separate reply directory and keep selected-parent beside the reply directory. selected-parent links the branch decision back to a recorded root page; selected-parent does not mean the reply page was already fetched. The root evidence hashes verify local bytes, not network authenticity, so do not edit both a source file and its metadata to get past a check. Neither script makes calls, retries or expands branches automatically.

