返回顶部
w

wechat-articles微信文章

>

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
516
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

wechat-articles

微信公众号文章搜索与读取 (v1.0)

搜索和读取微信公众号文章的完整工具,支持 simple(快速)和 playwright(稳定)双模式 + auto 自动切换。

快速开始

搜索文章

bash python3 scripts/search.py 关键词 [数量]

示例:
bash
python3 scripts/search.py 绿电直连政策 10

读取文章

bash python3 scripts/read.py 微信文章URL [--mode MODE] [--screenshot PATH]

模式选择:

  • - --mode=simple - 快速模式(requests + BeautifulSoup)
  • --mode=playwright - 稳定模式(真实浏览器)
  • --mode=auto - 自动切换(默认,推荐)

Python API 使用(推荐)

python
import sys
sys.path.append(scripts)

from wechatarticles import searcharticles, read_article

搜索文章

articles = searcharticles(绿电直连政策, topnum=5)

读取文章(建议加错误处理)

try: content = read_article(articles[0][url], mode=auto) print(f标题: {content[title]}) print(f公众号: {content[author]}) print(f发布时间: {content[publish_time]}) # 若有 print(f读取模式: {content[mode]}) for p in content[paragraphs][:10]: print(p) except Exception as e: print(f读取失败: {e}) # auto 模式失败时会抛出异常,建议捕获后降级处理或提示用户

返回数据结构说明

read_article() 返回一个字典,包含以下字段:

字段类型说明
titlestr文章标题
author
str | 公众号名称 |
| publish_time | str | 发布时间(部分文章可能为空) |
| paragraphs | list[str] | 正文段落列表 |
| mode | str | 实际使用的读取模式(simple 或 playwright) |

search_articles() 返回列表,每项包含:

字段类型说明
titlestr文章标题
url
str | 文章链接(有时效性,建议尽快读取) |
| author | str | 公众号名称 |
| digest | str | 文章摘要 |

模式对比

模式速度资源稳定性适用场景
simple快 (0.5-1s)轻量一般简单页面,频繁调用
playwright
慢 (3-5s) | 较重 | 很高 | 复杂页面,稳定优先 | | auto | 自适应 | 自适应 | 最佳 | 默认推荐 |

安装依赖

Simple 模式(默认,轻量快速)

bash pip install beautifulsoup4 requests miku-ai

这些包通常已随 agent-reach 安装。

Playwright 模式(可选,推荐稳定读取)

bash pip install playwright playwright install chromium --with-deps

--with-deps 会自动安装 Linux 系统依赖(如 libnss3、libgbm 等),首次运行需几分钟。

注意事项

  • - 搜索结果 URL 有时效性,建议尽快读取
  • 避免高频请求防止触发反爬
  • auto 模式优先尝试 simple,失败后自动切换 playwright;若两者均失败则抛出异常
  • Playwright 首次运行需安装 Chromium(约几分钟)

欢迎反馈 & PR!GitHub: https://github.com/johan-oilman/wechat-articles

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 wechat-articles-1776117122 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 wechat-articles-1776117122 技能

通过命令行安装

skillhub install wechat-articles-1776117122

下载

⬇ 下载 wechat-articles v1.0.1(免费)

文件大小: 8.97 KB | 发布时间: 2026-4-14 14:29

v1.0.1 最新 2026-4-14 14:29
- 更新 author 字段至“油太人 / @johan-oilman”
- 更新 homepage 与 Github 链接指向新的仓库 (johan-oilman/wechat-articles)
- 其余功能、接口及用法描述保持不变

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部