wechat-article-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

微信公众号文章搜索说明

WeChat Official Account Article Search Instructions

适用场景

Applicable Scenarios

  • 用户说“帮我搜某个关键词的公众号文章/最近文章”
  • 需要快速拿到:标题、摘要、发布时间、公众号名称、可访问链接
  • When the user says "Help me search for official account articles/recent articles with a certain keyword"
  • Need to quickly obtain: title, abstract, publication time, official account name, accessible link

工作流程

Workflow

步骤1: 确认已安装依赖包

Step 1: Confirm Dependencies are Installed

该脚本依赖NodeJS依赖包
cheerio
,建议先执行全局安装或在项目中安装:
bash
npm install -g cheerio
This script depends on the NodeJS package
cheerio
, it is recommended to install it globally or in the project first:
bash
npm install -g cheerio

步骤2: 确认搜索词语数量

Step 2: Confirm Keyword and Result Count

1、 确认关键词与数量
  1. Confirm keyword and quantity

步骤3: 执行搜索命令

Step 3: Execute Search Command

1、执行常规搜索命令
bash
node scripts/search_wechat.js "关键词" 
  1. Execute regular search command
bash
node scripts/search_wechat.js "keyword" 

特殊流程(可选)

Special Workflow (Optional)

  1. 执行包含数量限制的搜索命令
bash
node scripts/search_wechat.js "关键词"  -n 15
  1. 如果用户需要保存结果到文件,执行命令
bash
node scripts/search_wechat.js "关键词" -n 20 -o result.json
  1. 若想要获取微信文章域名的真实链接”,执行如下命令
bash
node scripts/search_wechat.js "关键词" -n 5 -r
  1. Execute search command with quantity limit
bash
node scripts/search_wechat.js "keyword"  -n 15
  1. If users need to save results to a file, execute the command
bash
node scripts/search_wechat.js "keyword" -n 20 -o result.json
  1. If you want to obtain the real link of WeChat article domains, execute the following command
bash
node scripts/search_wechat.js "keyword" -n 5 -r

参数说明

Parameter Description

  • query
    :搜索关键词(必填)
  • -n, --num
    :返回数量(默认 10,最大 50)
  • -o, --output
    :输出 JSON 文件路径(可选)
  • -r, --resolve-url
    :尝试把中间链接解析成微信文章真实链接(会额外请求每条结果)
  • query
    : Search keyword (required)
  • -n, --num
    : Number of results to return (default 10, max 50)
  • -o, --output
    : Output JSON file path (optional)
  • -r, --resolve-url
    : Attempt to resolve intermediate links to real WeChat article links (will make additional requests for each result)

输出字段(文章对象)

Output Fields (Article Object)

文章标题、文章地址、文章概要、发布时间、来源公众号名称
Article title, article URL, article summary, publication time, source official account name

常见问题处理

Common Issue Handling

  • 结果为空:尝试更换关键词、更少的特殊字符、或稍后重试
  • 解析真实 URL 失败:这是常态(反爬限制);可提示用户用浏览器打开中间链接
  • Empty results: Try changing keywords, using fewer special characters, or retrying later
  • Failed to resolve real URL: This is normal (anti-crawling restrictions); you can prompt users to open the intermediate link in 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 service and regulations of relevant websites when using this tool.
  • Excessive use may lead to IP blocking, please use it cautiously.