agentleFS
AlienHubAlienHub/wechat-article-skill/SKILL.md

wechat-article-fetcher

Skill1 starsChanged 8 months agoMITView on GitHub

微信公众号文章链接处理。当用户发送微信公众号文章链接时,自动获取并提取文章内容。 触发条件:(1) 用户发送 http(s)://mp.weixin.qq.com/s/ 开头的链接 (2) 用户请求获取公众号文章内容

  • Installs packages

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. wwwzhouhui/skills_collection★ 292same name
    2. wulaosiji/skills★ 28same name
    3. Liuzln/openclaw-skills★ 6same name
    4. mrlong0129/wechat-article-fetcher★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Files
SKILL.md

微信公众号文章获取

识别公众号链接

公众号文章链接特征:

  • 域名: mp.weixin.qq.com
  • 路径: /s/ 开头
  • 示例: https://mp.weixin.qq.com/s/abc123def456

获取文章内容的方法

⚠️ 微信服务器会检测请求头,必须携带正常浏览器的 User-Agent,否则返回 403。

Agent 调用顺序(重要)

  1. 优先使用 get_content.py 脚本 —— 稳定、无头、输出直接供模型消费。
  2. 仅在脚本失败时改用 browser 工具 —— 脚本 stderr 会输出「建议 Agent 改用 browser 工具」等提示,此时再考虑浏览器。

方法一:get_content.py 脚本(首选)

本地 CLI,urllib + certifi + 真实 UA,自带重试(最多 3 次)。失败时 stderr 提示是否改用 browser。

# 安装依赖(首次)
pip install -r requirements.txt

# 调用
python scripts/get_content.py --url "https://mp.weixin.qq.com/s/xxx"
  • 成功:正文输出到 stdout。
  • 失败:stderr 输出原因及「建议 Agent 改用 browser 工具」。

方法二: browser 工具(脚本失败时的回退)

仅在脚本返回非 0 且 stderr 建议改用 browser 时使用:

browser(action="navigate", url="用户发送的链接")
browser(action="snapshot")

内容提取要点

公众号页面结构:

  • 文章正文在 #page-content 元素中
  • 标题通常在 #activity-name 或 h1 标签
  • 作者信息在 .account_nickname 或类似元素
  • 发布时间需要从页面元数据提取

处理流程

  1. 识别链接 → 检测到 mp.weixin.qq.com/s/ 链接
  2. 获取内容 → 调用 get_content.py --url <链接>
  3. 成功 → 正文在 stdout,直接供模型消费
  4. 失败 → 检查 stderr,若建议改用 browser,再用 browser 工具重试

注意事项

  • 公众号文章可能需要登录才能完整抓取
  • 部分文章有访问时间限制
  • 图片可能需要单独处理(使用微信图床域名)
  • 必须使用正常浏览器的 User-Agent

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.