dsh-picture-text-reader
Manifest validRequires Python 3.12+; Xiaohongshu reading needs the xiaohongshu-mcp backend and a QR sign-in (ffmpeg/OCR optional). Batch-read Xiaohongshu notes and WeChat public-account articles: per-note body, ima
图文平台内容抓取(xhs-batch-reader)
DSH Host 插件:在对话里直接按关键词批量抓取小红书笔记与微信公众号文章,并把每篇的正文、图片文字、视频抽帧文字和评论样本读成结构化数据。每条结果都带原文链接(sourceUrl)。
工具
| 工具 | 什么时候用 |
|---|---|
xhs_search | 用户说「去小红书搜一下 X」「批量找 X 的笔记并识别内容」。支持多关键词、sort 指定排序(不指定则四种排序轮换)、图文/视频筛选 |
xhs_read | 用户贴来几条小红书链接说「把这几篇读一下」,或指定博主主页 / 首页推荐流 |
xhs_login | 小红书搜索和博主主页需要登录;默认弹出真 Chrome 登录窗口,扫码一次后 cookie 长期复用 |
xhs_status | 后端是否活着、小红书登录状态、cookie 到期时间 |
gzh_search | 用户说「搜一下公众号里关于 X 的文章」。走搜狗微信搜索,默认继续逐篇读正文(read:false 只看搜索结果清单) |
gzh_read | 用户贴来几条 mp.weixin.qq.com 文章链接说「读一下」 |
实现
工具本身很薄,真正干活的是随包分发的 Python 脚本 python/xhs_batch.py(同样可被 ~/.dsh/skills/xhs-batch-reader 技能直接调用):
- 小红书取数复用本机已部署的
xiaohongshu-mcp只读后端(端口 18861); - 公众号文章直接 HTTP 抓取解析(微信文章是服务端渲染),关键词批量走搜狗微信搜索;都不需要登录、不弹浏览器;
- 图片文字用本地
rapidocr-onnxruntime,视频用 ffmpeg 抽帧后再 OCR; - 小红书只调用 health / login / feeds/list / feeds/search / feeds/detail / user/profile 这些只读端点,发布、点赞、关注、评论类接口一律不调;
- 产物落在
~/.xhs-batch-reader/runs/<时间戳>/(公众号在wechat-runs/):notes.json、notes.md、digest.md、images/、ocr/。
原文链接
- 小红书:
https://www.xiaohongshu.com/explore/<note_id>?xsec_token=<token>&xsec_source=pc_search - 公众号:文章原始 URL(
https://mp.weixin.qq.com/s?...)
notes.md 每篇有「原文链接」行,digest.md 每篇有「原文:」行,notes.json 里有 source_url 字段,工具返回的 articles[].sourceUrl 也是它。
运行前提(第一次装完要配一次)
小红书通道需要本机的只读后端二进制和一次扫码;公众号通道只需要 Python 标准库。
- Python 3.12+:插件按
XHS_PYTHON→~/.dsh/runtimes/skills/py/python.exe→python的顺序找解释器。 - 图片 OCR(可选):
python -m pip install rapidocr-onnxruntime;不装也能跑,只是不出图片文字。 - 视频抽帧(可选):把
ffmpeg放进 PATH,或用XHS_FFMPEG指向可执行文件。 - 小红书只读后端:下载 xpzouying/xiaohongshu-mcp 的
xiaohongshu-mcp-windows-amd64.exe,放到~/.xhs-batch-reader/bin/,或用XHS_MCP_EXE指到它。首次登录后 cookie 存在~/.xhs-batch-reader/cookies.json,之后长期复用。 - 登录:调用
xhs_login弹出 Chrome 登录窗口扫码;xhs_status会显示后端端口、登录状态和 cookie 到期时间。
环境变量
XHS_PYTHON:Python 解释器,默认自动找 DSH 运行时 python,找不到退回pythonXHS_CLI:xhs_batch.py路径,默认用包内python/xhs_batch.pyXHS_RUNS:输出根目录,默认~/.xhs-batch-reader/runsXHS_MCP_EXE:小红书只读后端可执行文件XHS_FFMPEG:ffmpeg 路径
限制
- 小红书搜索、博主主页需要登录(扫码一次,cookie 长期复用);只读单篇链接不需要登录,但链接必须带
xsec_token。 - 公众号搜索依赖搜狗微信,触发反爬时会返回「要求验证码」;此时改用文章链接直接读。搜狗跳转出来的链接带
timestamp/signature时效签名,过期后请用文章原始/s/<code>短链。 - 一次最多读 50 篇;每篇默认最多 12 张图、视频 4 帧。批量 20 篇通常两三分钟。
- OCR 会认错个别字,识别结果按原文保留,不做自动纠错。
调研与借鉴(2026-10-21)
公众号抓取没有引入任何运行时依赖,只参考了以下项目的做法(星数取 GitHub API):
| 项目 | ★ | License | 借鉴点 |
|---|---|---|---|
| wechat-article/wechat-article-exporter | 13081 | MIT | 页面字段(var ct/nickname/author/user_name/biz/mid/idx/sn)与 samples/ 真实快照可当回归样本 |
| chyroc/WechatSogou | 6400 | Apache-2.0 | 搜狗 cookie(SUV/SNUID)、/link 跳转与 antispider 处理思路 |
| likemaoke/wechat-article-to-md | 37 | MIT | URL→Markdown 的最小解析参考 |
没有采用 wechatDownload(无源码、无 license)、wechat_articles_spider(需公众号后台扫码,按公众号名抓而非 URL)、MediaCrawler(不支持公众号,且许可限非商业学习)。
Versions
| Latest version | Published | Size |
|---|---|---|
| 1.0.0 | — | — |
Comments
Loading…
Similar plugins
by jing-hy
DSH plugin: pixel-to-text image reading for text-only models. image_scan/image_ocr/image_sample tools + image-reading skill (34-image trained methodology). Pure local, optional PaddleOCR.
★ 36
MIT
JavaScript
Oct 17, 2026
dsh plugin --profile web add picturereaderby FuncWei
WeChat Official Account content studio: anti-homogenization rotation writing, low-creativity remediation playbook, blessing-image visual baseline, gpt-image pipeline with OCR acceptance, and the measu
★ 3
MIT
Python
Aug 16, 2026
dsh plugin --profile web add dsh-wechat-mp-studioby wjx-ai
DSH Markdown 阅读插件:点击会话中的 MD/图片链接,在浏览器右侧以真三栏布局(侧边栏 | 会话区 | 文档)直接阅读 —— 目录 TOC、自动跟随磁盘变更、图片内联预览、复制原文、字号缩放。dsh plugin --profile web add github:wjx-ai/dsh-md-reader
★ 0
MIT
JavaScript
Sep 22, 2026
dsh plugin --profile web add dsh-md-readerReads Bilibili video content as text for DSH agents: metadata, subtitles, ASR, frame OCR, comments and danmaku. Frame OCR needs ffmpeg; the ASR/OCR venvs need Python 3.10+; AI subtitles need a Bilibil
★ 0
MIT
JavaScript
dsh plugin --profile web add dsh-bili-watchby WSL043
Upgrades DSH image viewing with pointer-centered zoom, pan, galleries, downloads, keyboard support, and inline region notes (Beta).
★ 2
↓ 2.9k/wk
MIT
JavaScript
Oct 23, 2026
dsh plugin --profile web add dsh-image-viewerby coolbreezecoin
Turns markdown into a WeChat Official Account (微信公众号) draft: inlines every CSS rule onto its element because the editor discards `<style>` blocks and class names, uploads each local image through WeCh
★ 0
↓ 161/wk
TypeScript
Aug 16, 2026
dsh plugin --profile web add dsh-wechat-mp