Перейти к навигации

Which WeChat article and account page fields can I retrieve?

Each WeChat page field comes from one specific action. For an article review sheet, take titles and text from wechat_mp.v2.fetch_article_detail_h5, reads and engagement from the standard wechat_mp.v2.fetch_article_stats, placement within a publication batch from the account list wechat_mp.v2.fetch_account_articles, and account fields from fetch_account_profile. Record each column’s source action and collection time, and leave missing values blank.

For example, a campaign review reads what each article covers, compares engagement over a comparable period and checks which article led its publication batch. Account information is a separate request with the verified account ID.

Choose required columns before requesting everything

DecisionEvidence to prepareWhen evidence is missing
What the article says and whether it supports a claimVerified article URL, returned text and original sourceRetain unread images/attachments and unanswered questions as gaps
Whether current engagement warrants investigationStandard statistics for the same article, collection time and visibilityDo not turn missing/hidden values into zero or rank different ages as equal-age performance
The article’s position within a publication batchVerified account, and article identity and position from the listLeave the position unknown without list evidence; the first row is not automatically a headline
Which account and linked Channels identity are involvedActual identifiers and linkage fields from account materialDo not merge namesakes or treat a display name as a legal entity

If you only need title and body, skip the profile, comment and metric queries. Add requests only for newly required columns, and reuse existing records where they fit. Account material can be reused for the verified account only, never copied to another account with the same name.

Make every row traceable to its evidence

Keep the requested URL, the returned article link, the account identity, and separate request IDs and collection times for the body and the statistics. Matching titles do not make two records a pair, and short and long aliases are not assumed equivalent. When an association is unresolved, stop; do not place numbers next to the most similar title.

join_article_review.py (the last section of this page) rechecks raw responses, hashes and fields instead of trusting an editable metrics CSV. join_article_review.py combines validated saved body records with standard statistics only: headline position stays unjoined, and join_article_review.py collects no comments or profile information. A hash shows that archived bytes are unchanged; a hash does not show that an article is true or independently authenticate the article’s network origin.

Deliver a review table with states, not guessed completeness

Each requested column needs an actual source, an observation time and a state, or a reason the column remains unavailable or unsupported. Keep candidate judgments, excerpts, interpretations and follow-up steps as human review material, separate from API facts. Keep an abnormal visibility state next to an otherwise normal-looking number. Do not fill position 1 without headline evidence.

join_article_review.py accepts 1–5 articles per batch. Twenty articles need four explicit pair manifests and four new output directories, plus a separate cross-batch duplicate check; join_article_review.py does not retrieve every field for twenty articles automatically. When a pair fails, keep the batch inputs and investigate; do not drop the article to make the delivery look complete.

The field map and the offline body/statistics join follow. Sources: the published output contracts of each action listed. Account-private data and complete-page coverage are outside the fields listed.

Article text, identity and publication metadata

Use data:wechat_mp.v2.fetch_article_detail_h5. The optional published fields below sit inside data.content in both raw modes; raw=true adds metadata and does not move the body.

Page itemResponse pathInterpretation
Title / bylinedata.content.title / authorThe byline is not the account’s legal owner
Account name / IDdata.content.nick_name / user_nameJoin by verified ID, not equal display names
Plain text / HTMLdata.content.content_text / content_noencodeHTML is untrusted; the plain text does not include watching videos or reading images
Summary / coverdata.content.desc / data.content.cdn_urlThe summary is not the full text; the cover URL is not the entire image set
Publication timedata.content.create_timestamp / create_timeUnix timestamp and original formatted value; collection time is separate
Article / original-source linkdata.content.link / source_urlsource_url may be empty or lead elsewhere
Publication regiondata.content.country_name / province_nameDisplayed publication region, not reader location or home address

The current fixed output schema does not declare _content_type. Do not require _content_type, and do not infer a classic article from a missing _content_type. Local export and joining accept a missing _content_type or an explicit article marker, and stop for review on any other explicit value; this is a conservative local rule, not a guaranteed taxonomy returned by the action. Image pages and extra metadata do not mean the whole visible page was read. The article reading workflow records the returned-text scope and checks exact quotes against the saved source text.

Headline or secondary article comes from the account list

For wechat_mp.v2.fetch_account_articles with raw:false and article item_show_type:0, read data.articles[].idx: 1 is the headline, and larger values are secondary positions within the batch. Keep account ID, app_msg_id and idx together, and use the position inside the publication batch, not the row on the page.

Filter headline and secondary articles provides an offline exporter, unknown-position handling and raw-source evidence. For identity derived from links, use the link audit; a short link alone carries no idx.

Engagement requires the correct statistics action

ItemStandard fetch_article_stats, under dataH5 fetch_article_stats_h5
Readsread_numUnavailable, not zero
Likes / recommendations (在看)like_count / old_like_countUnavailable
Shares / savesshare_count / collect_countUnavailable
Comment countcomment_countcomment_count plus elected_comment_count
Star fieldPreserve star_num as namedUnavailable; do not call it donation revenue

Standard raw:true includes show_* visibility flags. Keep a hidden metric, an absent value, null, a display threshold and an actual zero distinct. An H5 fallback cannot recover reads. Export a metric review sheet keeps the action, URL, collection time, original value and state for each metric.

Comments, replies and account homepage

Comments and replies are separate requests. First-level fetch_article_comments pages with buffer; fetch_comment_replies targets one content_id and pages with an integer offset. To get more replies, continue with the offset of fetch_comment_replies. A comment count is not a collected comment, one page is not the whole discussion, and hidden or unpublished comments are not promised. ID and precision rules explain why an unsafe unquoted numeric ID must stop a reply workflow that depends on the ID; converting the ID to a string afterward does not restore the digits.

For fetch_account_profile with raw:false, the documented fields under data include user_name, nick_name, ip_wording, original_article_count, original_content_str, finder_username, finder_nickname and ban_type. Read the fields as account identity, displayed region, original-content information, linked Channels identity and raw status code. The fields are not a legal owner, a registered address, exact followers or complete history. signature and head_url are explicitly unavailable on the fetch_account_profile route; an empty value is not a profile choice. See account fields and ownership boundaries.

The account homepage list uses item_show_type: 0 articles, 5 videos, 7 audio, 8 image-text posts. Keep a separate cursor for each account and tab; the homepage list is not a Channels query. See content tabs and pagination for the saved-page exporter and the actual next_offset rules.

The published WeChat catalog has no dedicated corporate-owner action: check the registered entity against public registration records, and check followers and donation revenue in a backend you have access to. Do not fill registration numbers from nicknames, and do not infer followers from reads. Donation amounts, private audience analytics and unselected comments are not part of the field map.

Deliver a five-article review without buying every endpoint

  1. Start with five exact public article URLs and save each requested URL; do not silently merge short and long aliases. Choose the required columns before calling anything.
  2. Plan five H5 detail requests for titles and text. Add five standard statistics requests if you also need engagement counts. Check the rate of each action on BeatAPI’s pricing page.
  3. If headline position is required, reuse a saved article list that contains the article identity, or budget the list pages separately. The ten detail and statistics requests do not return the five positions. Profile, comment pages and selected reply pages add separate requests, only when needed.
  4. Use the linked text and statistics exporters to keep raw responses and hashes. Join by your saved request-to-article mapping, not by title. Keep each request ID with the request’s own collection time; sequential calls are not an atomic snapshot.
  5. Join the detail and standard-statistics exports with join_article_review.py below, using the saved request mapping. Deliver one row per article with the requested URL, title, account ID, publication time, text and metric source files, metric observation time, and a state next to every requested metric. Add headline position only with list evidence. A missing field stays missing; annotate unavailable, hidden and threshold values instead of filling zero. Do not copy the full body into a summary cell and call the copy analysis.

For a synthetic example: a source with title=“Example”, read_num:null, show_read:false and no headline evidence yields the title Example, reads null with hidden visibility, and position unknown. The row does not show zero reads, first position or a failed article.

Check two rows before sharing

Pick one complete row and one row with a missing value. Open both articles and compare the sheet with the saved details, statistics and list records. Ask a teammate to say when each count was collected and whether each blank means missing, hidden or failed.

Build the review table from saved detail and standard-statistics exports

First run the article source exporter and the metrics exporter. The join reuses the two exporters’ output and makes no new query. Create pairs.json with, for each article, an explicit source record, a metrics directory and a one-based index into the evidence.json requests:

[{"source_record":"article-1/wechat-article-source.json","metric_directory":"metric-review","metric_source_index":1}]

Keep the original wechat-article.json that each source record references. Pair paths are relative to pairs.json; source_file inside a record is relative to the record’s directory unless the path is already absolute. Select up to five pairs explicitly, not by title or by guessed short/long URL equivalence. The recorded request URL must match byte for byte between detail and statistics; do not substitute another returned link as the join key.

Save the code below as join_article_review.py and run python3 join_article_review.py pairs.json article-review:

import csv, hashlib, json, pathlib, sys
from datetime import datetime, timezone
from urllib.parse import urlsplit, parse_qs
manifest, output = map(pathlib.Path, sys.argv[1:3])
manifest_bytes = manifest.read_bytes()
entries = json.loads(manifest_bytes)
if not isinstance(entries, list) or not 1 <= len(entries) <= 5:
raise ValueError('Provide 1–5 explicit article pairs')
DETAIL = 'wechat_mp.v2.fetch_article_detail_h5'
STATS = 'wechat_mp.v2.fetch_article_stats'
metrics = {'read_num':'show_read','like_count':'show_like','old_like_count':'show_old_like','share_count':'show_share','collect_count':'show_collect','comment_count':'comment_enabled','star_num':'show_star'}
rows, evidence, archives, urls, ids = [], [], [], set(), set()
def load(path):
raw = path.read_bytes()
return json.loads(raw), raw
def sha(raw): return hashlib.sha256(raw).hexdigest()
def time(value):
if not isinstance(value, str): raise ValueError('Collection time missing')
parsed = datetime.fromisoformat(value.replace('Z','+00:00'))
if parsed.tzinfo is None: raise ValueError('Collection time needs timezone')
return value
def url(value):
if not isinstance(value, str) or any(c.isspace() or ord(c)<32 for c in value): raise ValueError('Invalid request URL')
u = urlsplit(value); q = parse_qs(u.query, keep_blank_values=True)
if u.scheme not in ('https','http') or u.hostname != 'mp.weixin.qq.com' or u.username is not None or u.password is not None or u.port not in (None,80,443): raise ValueError('Expected public article URL')
if any(k.lower() in ('key','uin','pass_ticket','ticket','access_token') for k in q): raise ValueError('Use a public share URL without session data')
if u.path == '/s':
if any(len(q.get(k,[]))!=1 or not q[k][0] for k in ('__biz','mid','idx')): raise ValueError('Ambiguous long URL')
if not all(q[k][0].isascii() and q[k][0].isdigit() for k in ('mid','idx')) or int(q['idx'][0])<1: raise ValueError('Invalid article position')
elif not u.path.startswith('/s/') or not u.path[3:] or '/' in u.path[3:]: raise ValueError('Missing article token')
return value
def success(body, action, expected_id):
if not isinstance(body,dict) or body.get('status')!='succeeded' or body.get('action')!=action or body.get('error') is not None or not isinstance(body.get('data'),dict): raise ValueError('Expected successful recorded action')
rid=body.get('request_id')
if not isinstance(rid,str) or not rid.strip() or rid!=expected_id or rid in ids: raise ValueError('Missing, mismatched or reused request ID')
ids.add(rid)
return body['data']
def classify(value, present):
if not present: return 'missing', None
if value is None: return 'null', None
if isinstance(value,bool): return 'invalid_boolean', None
if type(value) is int:
if value>9007199254740991:return 'unsafe_numeric',None
return ('reported_integer',str(value)) if value>=0 else ('invalid_negative',None)
if isinstance(value,str):return ('reported_integer',value) if value.isascii() and value.isdigit() else ('reported_text',None)
raise ValueError('Structured or floating metric unsupported')
for index, entry in enumerate(entries,1):
if set(entry)!={'source_record','metric_directory','metric_source_index'}: raise ValueError('Use explicit source record and metric evidence index')
record_path = manifest.parent / entry['source_record']
record, record_bytes = load(record_path)
requested = url(record['requested_url'])
if requested in urls: raise ValueError('Duplicate requested URL; choose one observation explicitly')
urls.add(requested)
detail_path = record_path.parent / record['source_file']
detail, detail_bytes = load(detail_path)
if record.get('source_sha256')!=sha(detail_bytes):raise ValueError('Detail hash mismatch')
data = success(detail,DETAIL,record.get('request_id')); article=data.get('content')
if not isinstance(article,dict) or article.get('_content_type') not in (None,'article'):raise ValueError('Need a classic article source')
body=article.get('content_text')
if not isinstance(body,str) or not body.strip() or body!=record.get('text'):raise ValueError('Source text differs from recorded detail')
if body.strip() in ('[redacted]','[redacted-depth]') or (isinstance(article.get('desc'),str) and body.strip()==article['desc'].strip()):raise ValueError('Body is redacted or identical to summary')
if data.get('url') is not None and data['url']!=requested:raise ValueError('Detail request URL mismatch')
for field,key in [('title','title'),('user_name','account_id'),('nick_name','account_name')]:
if article.get(field)!=record.get(key) or (record.get(key) is not None and not isinstance(record[key],str)):raise ValueError('Detail metadata mismatch')
returned=article.get('link'); chosen=url(returned) if returned not in (None,'') else requested
if chosen!=record.get('article_url'):raise ValueError('Returned article URL mismatch')
detail_time=time(record.get('collected_at'))
stamp=article.get('create_timestamp')
if stamp is not None and (isinstance(stamp,bool) or not isinstance(stamp,(int,float))):raise ValueError('Invalid publication timestamp')
published=datetime.fromtimestamp(stamp,timezone.utc).isoformat() if stamp is not None else None
if published!=record.get('published_at_utc'):raise ValueError('Publication time mismatch')
metric_dir=manifest.parent / entry['metric_directory']
metric_evidence, metric_evidence_bytes=load(metric_dir/'evidence.json')
n=entry['metric_source_index']; requests=metric_evidence.get('requests')
if type(n) is not int or not isinstance(requests,list) or not 1<=n<=len(requests):raise ValueError('Invalid metric source index')
m=requests[n-1]; params=m.get('params')
if m.get('action')!=STATS or type(m.get('http_status')) is not int or m['http_status']!=200 or m.get('error_code') is not None:raise ValueError('Need successful standard stats, not H5 or failure')
if not isinstance(params,dict) or set(params)!={'url','raw'} or params['url']!=requested or type(params['raw']) is not bool:raise ValueError('Pair by exact recorded request URL, not title or guessed alias')
stats, stats_bytes=load(metric_dir/('raw-%03d.json'%n))
if m.get('sha256')!=sha(stats_bytes):raise ValueError('Stats hash mismatch')
counts=success(stats,STATS,m.get('request_id')); stats_time=time(m.get('collected_at'))
unavailable=counts.get('unavailable',[])
if not isinstance(unavailable,list) or any(not isinstance(x,str) for x in unavailable):raise ValueError('Invalid unavailable flags')
row={'requested_url':requested,'article_url':chosen,'title':record.get('title'),'account_id':record.get('account_id'),'published_at_utc':published,'detail_collected_at':detail_time,'stats_collected_at':stats_time,'detail_request_id':record['request_id'],'stats_request_id':m['request_id'],'get_data_succ_raw':json.dumps(counts.get('get_data_succ')),'position_state':'not_joined','coverage':'returned_plain_text_and_one_stats_observation'}
for metric,flag in metrics.items():
raw_value=counts.get(metric);state,value=classify(raw_value,metric in counts)
if metric in unavailable:state,value=('unavailable' if raw_value is None else 'inconsistent_unavailable'),None
row[metric+'_value']=value;row[metric+'_state']=state
row[metric+'_raw']=json.dumps(raw_value,ensure_ascii=False)
row[metric+'_visibility_raw']=json.dumps(counts.get(flag),ensure_ascii=False)
rows.append(row)
prefix='article-%02d-'%index
files={prefix+'source-record.json':record_bytes,prefix+'detail.json':detail_bytes,prefix+'metric-evidence.json':metric_evidence_bytes,prefix+'stats.json':stats_bytes}
archives.extend(files.items())
evidence.append({'requested_url':requested,'input_pair':entry,'files':{name:sha(raw) for name,raw in files.items()},'detail_request_url_echo_verified':data.get('url')==requested,'identity_basis':'saved request metadata; no network identity verification'})
def cell(value):
if value is None:return ''
value=str(value)
return "'"+value if value.startswith(('=','+','-','@','\t','\r','\n')) else value
output.mkdir(parents=False,exist_ok=False)
with (output/'article-review.csv').open('x',encoding='utf-8-sig',newline='') as f:
writer=csv.DictWriter(f,fieldnames=list(rows[0]));writer.writeheader();writer.writerows({k:cell(v) for k,v in row.items()} for row in rows)
for name,raw in archives:(output/name).write_bytes(raw)
(output/'pair-manifest.json').write_bytes(manifest_bytes)
(output/'review-evidence.json').write_text(json.dumps({'manifest_sha256':sha(manifest_bytes),'articles':evidence,'executed_calls':0,'atomic_snapshot':False,'automatic_ranking':False,'position_joined':False},ensure_ascii=False,indent=2),encoding='utf-8')
print(json.dumps({'articles':len(rows),'executed_calls':0}))

The new article-review.csv has one row per article, separate detail and statistics collection times and request IDs, and value/state/raw/visibility_raw columns for each metric. review-evidence.json and the archived originals keep file hashes. CSV safety prefixes do not change the archived text. join_article_review.py reclassifies the original statistics instead of trusting editable metrics.csv values, and checks the source record’s title, account, text and publication time against the original detail.

Input conditionOutcome
Exact matching request URL, successful actions and matching hashesOne joined row, which still holds two independent observations rather than an atomic snapshot
Same title with different URLs, or guessed URL aliasesReject the pair without automatic normalization
H5 statistics or failed statisticsReject the batch; never substitute zero reads
Duplicate article pair or reused request_idReject until the intended observation is selected explicitly
Changed original/source fields with mismatched hashes or contentStop before creating the output directory and preserve the previous table
False visibility with null, threshold or zero valuesPreserve the states without automatic rankings or audience estimates

position_state is always not_joined, because join_article_review.py does not join headline-position evidence. join_article_review.py does not collect comments, replies or account profiles. Only a validated batch produces the table: fix invalid source pairs instead of removing validation or silently dropping failed articles. Treat output interrupted by a filesystem write error as incomplete; the original inputs stay unchanged, and a partial table does not pass acceptance.

Hashes show matching archived bytes; hashes do not establish factual truth or the network authenticity of editable request metadata. Original bodies, metrics and evidence may contain private working information: keep the files local by default, and review and redact a separate copy for sharing. Local generation makes no new BeatAPI call.

WeChat questions