文章搜索
在指定类别(如关注的账号、最新、最近读过或热门)内按关键词搜索微信公众号文章,支持连续分页。用于将文章发现聚焦在特定结果流上。
参数
| 参数 | 必填 | 类型 | 说明 | 示例 | 可选值 |
|---|---|---|---|---|---|
keyword |
必填 | string | 分类微信公众号文章网页搜索的搜索关键词。 | 咖啡 |
— |
sub_search_type |
可选 | string | 微信公众号文章分类搜索子类型 | ALL |
ALLFOLLOWEDLATESTRECENT_READHOT |
current_page |
可选 | integer | 微信网页搜索分页的当前页码,从1开始。 | 1 |
— |
offset |
可选 | integer | 上一次响应返回的搜索结果偏移量。第一页使用0。 | 0 |
— |
cookies_buffer |
可选 | string | 由上一个微信网页搜索响应返回的不透明分页状态。第一页请留空。对于此 POST 接口,请以 application/x-www-form-urlencoded 表单体形式发送。 | — | — |
代码示例
curl -G "https://api.mofa-ai.com/v1/weixin/search_article_v2" \
-H "Authorization: Bearer $MOFA_API_KEY" \
--data-urlencode 'keyword=咖啡' \
--data-urlencode 'sub_search_type=ALL' \
--data-urlencode 'current_page=1' \
--data-urlencode 'offset=0'
import os
import requests
resp = requests.get(
"https://api.mofa-ai.com/v1/weixin/search_article_v2",
headers={"Authorization": f"Bearer {os.environ['MOFA_API_KEY']}"},
params={
"keyword": "咖啡",
"sub_search_type": "ALL",
"current_page": "1",
"offset": "0",
},
timeout=60,
)
body = resp.json()
if body["success"]:
print(body["cost_usd"], body["data"])
else:
print(body["error"], body["message"])
const url = new URL("https://api.mofa-ai.com/v1/weixin/search_article_v2");
url.search = new URLSearchParams({
keyword: "咖啡",
sub_search_type: "ALL",
current_page: "1",
offset: "0",
});
const resp = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.MOFA_API_KEY}` },
});
const body = await resp.json();
if (body.success) console.log(body.cost_usd, body.data);
else console.error(body.error, body.message);
在线试用
登录后可以在这里直接调用此接口,按价格从余额扣费,失败不收费。新账户赠送 $0.50 试用额度。
响应示例
采集于 2026-11-07,耗时 1356 ms · 请求参数 {"offset": "0", "keyword": "咖啡", "current_page": "1", "sub_search_type": "ALL"}
JSON
{
"success": true,
"code": 0,
"message": "success",
"request_id": "req_5f1c2a9be04d7c3a81f6e2d0",
"endpoint": "weixin.search_article_v2",
"cost_usd": 0.16,
"data": {
"code": 0,
"data": {
"ret": 0,
"data": [
{
"type": 2,
"boxID": "0x2-0-15988177807488435251",
"count": 38,
"items": [
{
"date": 1793675675,
"desc": "都是<em class=\"highlight\">咖啡</em>,美式、拿铁、三合一,不只是口感不同,对骨骼的友好程度也不同。美式是浓缩加水,几乎不含钙。一杯常规美式造成的钙丢失其实很少,日常喝够奶,基本能够对冲。",
"docID": "15988177807488435251",
"title": "美式、拿铁、三合一,谁才是骨头的“梦中情咖”?",
"source": {
"title": "羊城晚报",
"dateTime": "4天前"
},
"docType": 0,
"doc_url": "http://mp.weixin.qq.com/s?__biz=MjM5MTYwMTMwMQ==&mid=2651755447&idx=1&sn=0cd0e3e6f514a39465beb06ef5c9dd71&chksm=bc60e75e50b8c121631a8573c86b22d864e3eeb6516eb08573de2f43b7a5778077ac52e43c67&scene=7#rd",
"mpScene": 7,
"reportId": "15988177807488435251:mp:129897",
"src_type": 49,
"thumbUrl": "https://mmbiz.qpic.cn/mmbiz_jpg/j41VnwgcJibF9OIRp67OG4HSQ0YwsnrLIG84pQApAfPICJJTPlKJ83lqOb3qI8YKHFmZcFycZdUFW9lwaibuqualfJU9vIMPpVljDsc7VjjLg/0?wx_fmt=jpeg",
"timestamp": 1793675675,
"itemShowType": 0,
"report_extinfo_str": "src_channel%3D2013145042_4_0_3664493363_0%26tuple%3D2391601301_2651755447_1"
},
{
"date": 1794092447,
"desc": "<em class=\"highlight\">咖啡</em>是埃塞俄比亚在进博会上最具辨识度的品类,也是最容易用数据说话的品类。埃塞俄比亚是非洲最大的阿拉比卡<em class=\"highlight\">咖啡</em>生产国,全国<em class=\"highlight\">咖啡</em>年产量约60万吨,<em class=\"highlight\">咖啡</em>产业与数百万小农的生计直接挂钩。",
"docID": "5244603196470908087",
"title": "埃塞俄比亚连续九年参展进博会:<em class=\"highlight\">咖啡</em>对华出口额一年增58%",
"source": {
"title": "埃塞商务圈",
"dateTime": "57分钟前"
},
"docType": 0,
"doc_url": "http://mp.weixin.qq.com/s?__biz=MzI2NDQ3OTE1Nw==&mid=2247584918&idx=3&sn=ad65793f667659065fd77c48c7f7a6e0&chksm=eb4e179f45e53c8c47cf6183aa467b766d2b0617655133bcae94784a9fa1cb16bafa98efe8f3&scene=7#rd",
"mpScene": 7,
"reportId": "5244603196470908087:mp:680344",
"src_type": 49,
"thumbUrl": "https://mmbiz.qpic.cn/sz_mmbiz_jpg/PS69M3BiauTdca6liaGJ42ricuicdfVniaBA69ATbrD8kRicBdhzme1Dx6rvJfSfsyxEkriaSw6NVF4svyE8f3QDACxyD6j1qRvSXM5UP4zGUUkbfo/0?wx_fmt=jpeg",
"timestamp": 1794092447,
"itemShowType": 0,
"report_extinfo_str": "src_channel%3D2804691747_4096_0_2893846665_0%26tuple%3D3264479157_2247584918_3"
},
"… +36"
],
"boxPos": 1,
"subType": 0,
"real_type": 2,
"resultType": 0,
"totalCount": 244,
"boxPosMerge": 1,
"useNativeRender": false
}
],
"lang": "zh_CN",
"query": "咖啡",
"offset": 38,
"cookies": "{\"box_offset\":0,\"businessType\":2,\"clm_box_offset\":1,\"clm_sub_box_offset\":1,\"cookies_buffer\":\"UpAHCGIQARgCIgblkpbllaFQAVoKbmV3c3NlYXJjaIIBhgYQAKIBgAYxNTk4ODE3NzgwNzQ4ODQzNTI1MTs1MjQ0NjAzMTk2NDcwOTA4MDg…",
"category": [
{
"type": 0,
"word": "全部"
},
{
"type": 7,
"word": "视频号"
},
"… +14"
],
"isDivide": 0,
"searchID": "1794095914918116573",
"direction": 2,
"timeStamp": 1794095911,
"experiment": [
{
"key": "mmsearch_shopping_cart_entry",
"value": "1"
},
{
"key": "s1s_all_prefetch_next_page",
"value": "2"
},
"… +3"
],
"isHomePage": 0,
"pageNumber": 1,
"resultType": 0,
"slideFilter": {
"type": 87,
"boxID": "0x2000000000-12-",
"isHold": 1,
"filters": [
{
"type": 1,
"title": "搜索范围",
"display": 1,
"options": [
{
"type": 1,
"title": "不限",
"paramKey": "docSuperType",
"reportId": "docSuperType_0:filter_option:777846",
"selected": 1,
"paramValue": "0"
},
{
"type": 1,
"title": "最新",
"paramKey": "docSortType",
"reportId": "docSortType_2:filter_option:910545",
"paramValue": "2"
},
"… +8"
],
"paramKey": "docSuperType",
"mutexGroup": "doc_filter",
"isArrayValue": 1
}
],
"showType": 2
},
"continueFlag": 1,
"isAutoPlayVideo": 1,
"enableQuestionClosely": false
},
"message": null,
"requestId": "72cd2d4f73ce456b803774b90a5718d2",
"recordTime": "2026-11-08T07:58:32.250114318",
"requestParams": {
"body": {
"offset": "0",
"keyword": "咖啡",
"currentPage": "1",
"subSearchType": "ALL"
},
"query": {}
}
}
}