ima-gzh
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "ima-gzh" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-a27c3bad5575484eb018f56fa0a00eb55a4162c6c5918b77a3a49cd55a107d89. Verify the upstream source and version against https://skillhub.cn/skills/user_4c9c5ac8/ima-gzh before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Skill for searching public-account articles and bulk importing them into an IMA knowledge base. It searches WeChat public articles via Sogou (supports keyword-only or specified-account+keyword modes), resolves listed links to real WeChat article URLs, and bulk-imports them into a user-specified IMA knowledge base for aggregating competitor, trending, or specified account historical articles.
Introduction source: third_party · user_4c9c5ac8 · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Software, accounts and paid services
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: ima-gzh
description: "公众号文章搜索并导入 ima 知识库。基于搜狗微信 weixin.sogou.com 检索微信公众号文章(支持仅关键字、指定公众号 + 关键字两种模式),将返回列表中的所有链接解析为真实微信文章 URL 后,批量导入用户指定名称的 ima 知识库。适用于把竞品/热点/指定公众号的历史文章批量归集到 ima 做二次检索、内容沉淀等场景。"
description_zh: "搜索微信公众号文章并把链接批量导入指定 ima 知识库"
description_en: "Search WeChat official-account articles and import the result links into a user-specified ima knowledge base"
version: 1.0.0
agent_created: true
allowed-tools: Bash,Read,Write
metadata:
clawdbot:
emoji: "\U0001F4E5"
requires:
bins:
- node
display_name: "ima-gzh"
display_name_en: "ima-gzh"
visibility: "public"公众号文章搜索导入 IMA
把「搜索微信公众号文章 → 把链接导入 ima 知识库」两步合一。
数据源:搜狗微信 weixin.sogou.com(公众号专用搜索引擎)。
导入端:复用 ima-skills 技能的 ima_api.cjs(凭证自动从 ~/.config/ima/ 或环境变量读取)。
零外部依赖(搜索/解析用内置 https + 正则,无需 npm install)。
何时使用
- 用户想批量搜集某公众号(或某关键字)下的微信文章,并直接导入到某个 ima 知识库做沉淀/二次检索。
- 典型表述:「把梁林评里含『重置』的文章都导入我的『匹克球库』」「搜 workbuddy 最新文章导入 ima 的 XX 知识库」。
- 不要用于:本地批量抓微信文章正文(会被反爬拦截,见文末「反爬兜底」)。
前置依赖
- 已安装
ima-skills技能(提供ima_api.cjs),并已配置 ima 凭证(~/.config/ima/client_id+api_key,或环境变量IMA_CLIENT_ID/IMA_API_KEY)。 - Node 18+。
用法
SKILL_DIR="<本技能目录>"
# 模式B:指定公众号 + 关键字,导入到「我的知识库」
node "$SKILL_DIR/scripts/search_and_import.js" "重置" --account 梁林评 --kb "我的知识库"
# 模式A:仅关键字,导入到「资讯库」
node "$SKILL_DIR/scripts/search_and_import.js" "workbuddy" --kb "资讯库"
# 先预览(解析知识库 + 分批),不真正导入
node "$SKILL_DIR/scripts/search_and_import.js" "重置" --account 梁林评 --kb "我的知识库" --dry-run
# 复用已保存的搜索结果 JSON(search_and_fetch.js -o 产出,或本脚本 -o 产出)做导入
node "$SKILL_DIR/scripts/search_and_import.js" --from-json result.json --kb "我的知识库"
# 指定导入到知识库内的某个子文件夹
node "$SKILL_DIR/scripts/search_and_import.js" "重置" --account 梁林评 --kb "我的知识库" --folder "存档"
参数说明
- 位置参数
query:搜索关键字(必填,除非用--from-json)。 --account <名称>:限定公众号名称(可选,模糊包含匹配)。不填则为「仅关键字」模式。--kb <名称>:目标 ima 知识库名称(必填,由用户指定)。也可用--kb-id <ID>直接给知识库 ID。-n, --num:返回/导入数量(默认 50,最大建议 ≤ 50)。--pages <数字>:搜狗翻页数(默认 6,每页约 10 条)。--from-json <文件>:跳过搜索,直接导入指定 JSON 中的链接(支持 antispider 兜底时由 WebFetch 取得的清单)。-o, --out-json <文件>:把解析后的链接清单另存为 JSON(便于复用/审计)。--no-resolve:不把 sogou 中转链接解析为真实微信 URL,直接导入原链接(不推荐,中转 token 可能过期)。--folder <子文件夹>:导入到知识库内的指定子文件夹(缺省进根目录)。--dry-run:只解析知识库与批次并预览,不真正导入。
执行流程(脚本内部)
- 搜索:模式 B 时先用「公众号名」拉取该账号文章流,再按关键字在标题/摘要本地过滤(避免小号排不进纯关键字结果);模式 A 直接用关键字检索。按发布时间倒序取最新 N 条。
- 解析链接:把返回列表中的
weixin.sogou.com/link?url=...中转链接,跟随 302 解析为真实mp.weixin.qq.com/s?...文章 URL。这一步很关键——sogou 中转链接带有时效 token,直接交给 ima 服务端抓取可能过期失败;解析后得到稳定、规范的原文链接。 - 导入 ima:先用
--kb名称解析知识库 ID(search_knowledge_base覆盖订阅库,get_addable_knowledge_base_list回退个人库),再取根目录folder_id,按import_urls每批 ≤ 10 条批量导入。code===0或msg==='success'判定成功。
⚠️ 反爬兜底(重要)
搜狗微信对服务器 IP 有严格反爬。本环境 Node 直连可能返回 antispider 验证页而解析失败。此时按以下顺序处理:
- 脚本会打印 WARN 并停止搜索。先尝试换网络/稍后重试(部分沙箱出口 IP 偶发可通过)。
- 仍不行则在本软件中用 WebFetch(浏览器通道) 访问同样 URL,手动整理出「标题 + 链接」清单:
WebFetch: https://weixin.sogou.com/weixin?type=2&query=<关键字>&ie=utf8&page=1 要求:列出每篇文章标题、来源公众号、链接;指定了公众号则只保留该公众号文章,按时间倒序列 50 条。多翻几页(page=1..5)凑足数量,把清单存成 JSON(
[{"title":"...","link":"https://weixin.sogou.com/link?url=..."}]),再用node search_and_import.js --from-json 清单.json --kb "知识库"完成导入(此时--no-resolve也可,因为 antispider 情况下中转链接通常已可用)。
踩坑备忘
- 根目录 folder_id ≠ 知识库 ID:
import_urls的folder_id必须取自get_knowledge_list返回的根目录folder_id,不能用kb_id充当(否则报「文件夹不存在 222000」)。脚本已自动处理。 - 批量上限 10 个/次:脚本自动分批;ima 按 URL 去重,重复导入安全。
- 微信公众号正文不可本地批量抓,但
import_urls由 ima 服务端自动抓取,所以「搜链接 → 交给 ima 导入」是正确姿势。 - 中转链接先解析:默认开启
--resolve,将 sogou 中转解析为真实mp.weixin.qq.com/sURL,提升 ima 抓取成功率。
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决微信公众号文章批量搜索与知识库导入的实际痛点,适用于竞品分析、内容沉淀等高频场景
- 支持多种搜索模式(仅关键字、指定公众号+关键字)和灵活导入配置,实用性强
Highlights
- 触发描述清晰完整,覆盖多种使用场景和典型用户表述,边界明确
Areas to improve
-
description写错位置 Reported severity: Minor
顶层 frontmatter 中 description 字段为空,但 skill_body 内部有实质描述内容
Recommendation: 建议将 description 内容移至顶层 frontmatter 的 description 字段中,以符合规范
Highlights
- 文档结构清晰,包含完整的使用说明、参数说明、执行流程和反爬兜底方案
- 提供多种使用示例和 dry-run 预览功能,便于用户理解和测试
Highlights
- 工具来源明确,参数处理完善,自动处理链接解析和分批导入
- 覆盖反爬兜底方案,提供 WebFetch 手动兜底路径,确保执行可靠性
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 26 -
Accounts, secrets or authorization
Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.
Mentioned in main document · lines 36
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- weixin.sogou.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.