wechat-article-search
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese微信公众号文章搜索说明
WeChat Official Account Article Search Instructions
适用场景
Applicable Scenarios
- 用户说“帮我搜某个关键词的公众号文章/最近文章”
- 需要快速拿到:标题、摘要、发布时间、公众号名称、可访问链接
- When users say "Help me search for official account articles/recent articles on a certain keyword"
- Need to quickly obtain: title, abstract, publication time, official account name, accessible link
工作流程
Workflow
步骤1: 确认已安装依赖包
Step 1: Confirm that dependencies are installed
该脚本依赖NodeJS依赖包 ,建议先执行全局安装或在项目中安装:
cheeriobash
npm install -g cheerioThis script depends on the NodeJS package . It is recommended to perform global installation or install it in the project first:
cheeriobash
npm install -g cheerio步骤2: 确认搜索词语数量
Step 2: Confirm the number of search terms
1、 确认关键词与数量
- Confirm keywords and quantity
步骤3: 执行搜索命令
Step 3: Execute the search command
1、执行搜索命令(默认会自动尝试解析真实微信文章链接)
bash
node scripts/search_wechat.js "关键词"- Execute the search command (will automatically try to parse the real WeChat article link by default)
bash
node scripts/search_wechat.js "关键词"特殊流程(可选)
Special Process (Optional)
- 执行包含数量限制的搜索命令
bash
node scripts/search_wechat.js "关键词" -n 15- 如果用户需要保存结果到文件,执行命令
bash
node scripts/search_wechat.js "关键词" -n 20 -o result.json- 如果用户需要 JSON 格式输出,执行命令
bash
node scripts/search_wechat.js "关键词" json- Execute the search command with quantity limit
bash
node scripts/search_wechat.js "关键词" -n 15- If users need to save results to a file, execute the command
bash
node scripts/search_wechat.js "关键词" -n 20 -o result.json- If users need JSON format output, execute the command
bash
node scripts/search_wechat.js "关键词" json参数说明
Parameter Description
- :搜索关键词(必填)
query - :返回数量(默认 10,最大 50)
-n, --num - :输出 JSON 文件路径(可选)
-o, --output - :解析真实的微信文章URL(默认启用)
-r, --resolve-url - :跳过真实链接解析,直接返回搜狗转链
--no-resolve-url - :直接输出 JSON 格式数据,便于程序处理
json, --json
- : Search keyword (required)
query - : Number of returned results (default 10, maximum 50)
-n, --num - : Output JSON file path (optional)
-o, --output - : Parse real WeChat article URL (enabled by default)
-r, --resolve-url - : Skip real link parsing and directly return Sogou redirect link
--no-resolve-url - : Directly output data in JSON format for easy program processing
json, --json
输出格式
Output Format
格式化输出(默认)
Formatted Output (Default)
以易读的文本格式输出搜索结果,每篇文章包含以下信息:
序号. 文章标题
📌 来源: 公众号名称 | ⏰ 时间信息
💡 文章内容概要
🔗 [查看详情](<完整链接>)
时间信息格式:
- 如果有完整时间戳:,例如:
HH:MM (相对时间描述)23:45 (1小时前) - 如果只有相对时间:直接显示,例如:
2小时前
输出特点:
- 每篇文章之间有空行分隔
- 来源和时间在同一行显示
- 链接显示完整的URL地址,使用 格式
[查看详情](<链接>)
Output search results in a human-readable text format. Each article includes the following information:
No. Article Title
📌 Source: Official Account Name | ⏰ Time Information
💡 Article Content Summary
🔗 [View Details](<Full Link>)
Time Information Format:
- If there is a complete timestamp: , e.g.:
HH:MM (Relative Time Description)23:45 (1 hour ago) - If only relative time is available: Display directly, e.g.:
2 hours ago
Output Features:
- Empty line separation between each article
- Source and time are displayed on the same line
- Links display full URL addresses in the format
[View Details](<Link>)
JSON 输出(使用 json
参数)
jsonJSON Output (Using json
parameter)
jsonjson
{
"query": "搜索关键词",
"total": 10,
"articles": [
{
"title": "文章标题",
"source": "公众号名称",
"datetime": "2026-03-08 10:30:00",
"date_text": "2026年03月08日",
"date_description": "2小时前",
"summary": "文章摘要",
"url": "https://mp.weixin.qq.com/s/...",
"url_resolved": true
}
]
}JSON 字段说明:
- :文章标题
title - :来源公众号名称
source - :文章发布时间(中国时区,格式:YYYY-MM-DD HH:mm:ss)
datetime - :日期描述(格式:YYYY年MM月DD日)
date_text - :相对时间描述(如"2小时前"、"1天前"、"刚刚")
date_description - :文章摘要
summary - :文章链接(可能为真实微信链接或搜狗转链)
url - :是否成功解析到真实微信链接(
url_resolved/true)false
json
{
"query": "Search Keyword",
"total": 10,
"articles": [
{
"title": "Article Title",
"source": "Official Account Name",
"datetime": "2026-03-08 10:30:00",
"date_text": "March 08, 2026",
"date_description": "2 hours ago",
"summary": "Article Abstract",
"url": "https://mp.weixin.qq.com/s/...",
"url_resolved": true
}
]
}JSON Field Description:
- : Article title
title - : Source official account name
source - : Article publication time (China Time Zone, format: YYYY-MM-DD HH:mm:ss)
datetime - : Date description (format: YYYY-MM-DD)
date_text - : Relative time description (e.g., "2 hours ago", "1 day ago", "just now")
date_description - : Article abstract
summary - : Article link (may be a real WeChat link or Sogou redirect link)
url - : Whether the real WeChat link was successfully parsed (
url_resolved/true)false
输出说明
Output Instructions
- 所有链接使用 格式,可以正确处理特殊字符
[查看详情](<链接>) - 文章已按发布时间降序排序(最新在前)
- 只显示最近60天内的文章,自动过滤旧内容
- 时间优先从页面script标签中的时间戳解析,如果没有时间戳则尝试从文本提取
- All links use the format , which can correctly handle special characters
[View Details](<Link>) - Articles are sorted in descending order of publication time (latest first)
- Only articles from the last 60 days are displayed, old content is automatically filtered out
- Time is parsed from the timestamp in the page script tag first; if there is no timestamp, try to extract from text
常见问题处理
Common Problem Handling
- 结果为空:尝试更换关键词、更少的特殊字符、或稍后重试
- 解析真实 URL 失败:这是常态(反爬限制);可提示用户用浏览器打开中间链接
- Empty results: Try changing keywords, using fewer special characters, or retrying later
- Failure to parse real URL: This is normal (anti-crawling restrictions); you can prompt users to open the intermediate link with a browser
注意事项
Notes
- 本工具仅用于学习和研究目的,请勿用于商业用途或大规模爬取。
- 使用本工具时请遵守相关网站的使用条款和规定。
- 过度使用可能导致 IP 被封禁,请谨慎使用。
- This tool is for learning and research purposes only. Do not use it for commercial purposes or large-scale crawling.
- Please comply with the terms of use and regulations of relevant websites when using this tool.
- Excessive use may lead to IP blocking. Please use it with caution.