ナビゲーションにスキップ

How do I search only WeChat articles and collect ideas from the past week?

Search with wechat_search.v2.fetch_search and set business_type:"article" to get Official Account articles only, without Channels videos mixed into the results. Add publish_time:"week" for the past week and sort:"latest" for newest first. For example, for a hiring research task, search a recruitment keyword, review the result cards and select the articles worth reading before you retrieve any article text.

Define the collection you need

For an assistant already connected to BeatAPI, a useful instruction is:

Search WeChat for recruitment articles from the past week, newest first. Review at most three result pages. Select articles about product manager jobs in Shanghai, keep verifiable source links and tell me which ones need full-text reading.

“Product manager jobs in Shanghai” is your relevance judgement, not a search setting. Search a few narrower keyword combinations, then check each result’s location, role and application deadline. Read the full text of articles that are relevant or whose details are incomplete.

Run an article search

Request example for data:wechat_search.v2.fetch_search:

curl -sS https://api.beatapi.io/v1/social-data/call \
-H "Authorization: Bearer $BEATAPI_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"action":"wechat_search.v2.fetch_search","params":{"keyword":"招聘","business_type":"article","publish_time":"week","sort":"latest","offset":0,"raw":false}}' \
-o wechat-article-search.json

Choose settings for the task:

GoalSettings
Follow today’s updatespublish_time:"day", sort:"latest"
Collect the past week’s materialpublish_time:"week", sort:"latest"
Find relevant candidatessort:"default"
Discover candidates ranked by likessort:"hot"

publish_time also supports half_year and all. sort:"hot" finds candidates ranked by likes; an industry readership ranking needs its own data and comparison rules. Account search uses business_type:"account"; video search uses "video".

Continue to the next page

  1. Request the first page with offset:0.
  2. For the next page, keep the keyword, publish_time and sort unchanged and pass the returned data.cursor unchanged into the next request.
  3. Continue while data.continue_flag says more results exist.

Changing only offset to 20 returns the first page again.

With explicit raw:false, results are in data.items. data.count is the page count; data.total is the largest count reported by the search boxes, rather than a verified count of unique articles. For a three-page task, report the number of pages actually saved and the number of candidate observations collected.

Turn the results into a useful shortlist

  1. Review each result card and record the title, source, time and article link you can confirm.
  2. Add a short selection reason, such as “role and city match; read the article to check the deadline.”
  3. Move unrelated training offers and outdated reposts to an exclusions list.
  4. Retrieve the text of the selected articles only, with the text-reading workflow. To follow one account over time, continue with the account’s article list.

The search_archive.py helper below saves the raw result cards. search_archive.py does not extract article titles and URLs or hand them to body retrieval, because the mapping from a card to an article is not yet verified. Use the search_archive.py output to save and review search results, and edit the shortlist article by article yourself or with your assistant.

For example, a search for Shanghai frontend jobs returns the original listing and a repost. Save the verifiable original link and note which listing the repost points to. Check the role, city and deadline before handing over the candidate. If you have only the search snippet, mark the deadline as unconfirmed.

Optional search archive

Keep 1–3 pages of real requests and saved responses in one directory and create manifest.json:

[{"action":"wechat_search.v2.fetch_search","params":{"keyword":"招聘","business_type":"article","publish_time":"week","sort":"latest","offset":0,"raw":false},"http_status":200,"collected_at":"2026-11-17T03:00:00+08:00","response_file":"wechat-article-search.json"}]

Save the Python script below as search_archive.py and run python3 search_archive.py manifest.json search-run-01. search_archive.py writes items.jsonl, coverage.json and copies of the original responses locally, and records each item’s page, position, request ID and collection time. search_archive.py stops instead of replacing an existing output directory.

import hashlib, json, pathlib, sys
from datetime import datetime
manifest, target = map(pathlib.Path, sys.argv[1:3])
entries = json.loads(manifest.read_text(encoding='utf-8'))
if not isinstance(entries, list) or not 1 <= len(entries) <= 3:
raise ValueError('Supply 1–3 saved pages; this helper makes no requests')
action = 'wechat_search.v2.fetch_search'
items, sources, blobs, seen, request_ids = [], [], [], set(), set()
base, expected, previous_time, stop = None, None, None, 'saved_pages_end'
for n, entry in enumerate(entries, 1):
p = entry['params']
if entry['action'] != action or p.get('business_type') != 'article' or p.get('raw') is not False:
raise ValueError('Use article with explicit raw=false')
if set(p) - {'keyword','business_type','publish_time','sort','offset','cursor','raw'}:
raise ValueError('Unexpected parameter')
if p.get('publish_time') != 'week' or p.get('sort') != 'latest' or type(p.get('offset')) is not int or p['offset'] != 0:
raise ValueError('This workflow uses week/latest/offset=0 throughout')
if not isinstance(p.get('keyword'), str) or not 1 <= len(p['keyword'].strip()) <= 100:
raise ValueError('Invalid keyword')
core = {k:v for k,v in p.items() if k != 'cursor'}
if base is None: base = core
if core != base or (n == 1 and p.get('cursor') not in (None,'')) or (n > 1 and p.get('cursor') != expected):
raise ValueError('Query changed or cursor chain broken')
ts = datetime.fromisoformat(entry['collected_at'].replace('Z','+00:00'))
if ts.tzinfo is None or (previous_time is not None and ts < previous_time):
raise ValueError('Use chronological timezone-aware collection times')
previous_time = ts
status = entry['http_status']
if type(status) is not int or not 100 <= status <= 599: raise ValueError('Invalid HTTP status')
raw = (manifest.parent / entry['response_file']).read_bytes()
body = json.loads(raw)
if not isinstance(body, dict): raise ValueError('Expected gateway object')
error = body.get('error')
ok = status == 200 and body.get('status') == 'succeeded' and not error
if not ok and not (isinstance(error,dict) and isinstance(error.get('code'),str) and error['code'].strip()):
raise ValueError('Malformed or unrecognized failure envelope')
rid = body.get('request_id') or (error.get('request_id') if isinstance(error,dict) else None)
if ok and (body.get('action') != action or not isinstance(rid,str) or not rid or rid in request_ids):
raise ValueError('Mismatched action or missing/repeated request ID')
if ok: request_ids.add(rid)
raw_name = 'raw-%03d.json' % n
record = {'page':n,'request_id':rid,'params':p,'collected_at':entry['collected_at'],
'http_status':status,'error_code':error.get('code') if isinstance(error,dict) else None,'raw_file':raw_name,'sha256':hashlib.sha256(raw).hexdigest()}
blobs.append((raw_name, raw)); sources.append(record)
if not ok:
stop = 'gateway_failed'
else:
data = body.get('data')
if not isinstance(data,dict) or not isinstance(data.get('items'),list) or not all(isinstance(x,dict) for x in data['items']):
raise ValueError('Expected data.items object array')
if data.get('keyword') != p['keyword'].strip(): raise ValueError('Keyword echo mismatch')
vertical = data.get('business_type')
if (isinstance(vertical,str) and vertical != 'article') or vertical == 33554499:
raise ValueError('Response explicitly reports a non-article vertical')
record.update({k:data.get(k) for k in ('count','total','business_type','no_more','continue_flag','cursor','offset')})
for i,item in enumerate(data['items']):
items.append({'page':n,'item_index':i,'request_id':rid,'item':item})
more, cursor = data.get('continue_flag'), data.get('cursor')
if more is False or (type(more) is int and more == 0): stop = 'provider_end'
elif not (more is True or (type(more) is int and more == 1)): stop = 'unsupported_more_flag'
elif not data['items']: stop = 'empty_page_with_more'
elif not isinstance(cursor,str) or not cursor: stop = 'missing_cursor'
elif cursor in seen: stop = 'repeated_cursor'
else:
seen.add(cursor); expected = cursor; stop = 'saved_pages_end'
if stop != 'saved_pages_end' and n != len(entries):
raise ValueError('Manifest continues after a terminal or invalid page')
if stop == 'saved_pages_end' and len(entries) == 3: stop = 'helper_page_cap'
report = {'query':base,'pages_saved':len(entries),'item_observations':len(items),
'stop_reason':stop,'complete_search':False,'deduplicated_articles':False,'sources':sources}
target.mkdir(parents=True,exist_ok=False)
for name,raw in blobs: (target/name).write_bytes(raw)
(target/'items.jsonl').write_text(''.join(json.dumps(x,ensure_ascii=False)+'\n' for x in items),encoding='utf-8')
(target/'coverage.json').write_text(json.dumps(report,ensure_ascii=False,indent=2),encoding='utf-8')
if stop == 'saved_pages_end':
(target/'next-request.json').write_text(json.dumps({'action':action,'params':{**base,'cursor':expected}},ensure_ascii=False,indent=2),encoding='utf-8')
print(json.dumps({'pages_saved':len(entries),'item_observations':len(items),'stop_reason':stop}))

Read the stop reason and the actual page count in coverage.json, then review items.jsonl. A card that appears twice stays as two observations. search_archive.py does not accept the data.results structure returned with raw:true, and an account card’s jumpInfo.userName does not map an article to an account.

Search prices are on the current pricing page; body and statistics retrieval are separate requests. To edit the shortlist, review the saved responses instead of searching again.

WeChat questions