npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

koishi-plugin-get-shared-videos

v1.1.0

Published

下载转发消息内的所有图片和视频到本地

Readme

Koishi 获取转发媒体插件

下载转发消息内的所有图片和视频到本地的 Koishi 插件。

功能特性

  • 任意深度嵌套转发 - 使用递归算法,支持无限层级嵌套的转发消息
  • 智能内容解析 - 自动识别并解析多种转发消息格式
  • 多种获取方式 - 支持直接解析内嵌内容或通过 API 获取
  • 自动分类保存 - 图片和视频分开存放
  • 自动去重 - 避免重复下载
  • 文件名冲突处理 - 自动添加序号避免覆盖
  • 打包发送 - 可选打包成 ZIP 发送
  • 防死循环保护 - 可配置最大递归深度

使用方法

指令:gsv

支持以下使用方式:

  1. 回复转发消息

    回复一条转发消息
    gsv
  2. 当前消息是转发消息

    (直接在转发消息中发送)
    gsv
  3. 回复包含媒体文件的普通消息

    回复包含图片/视频的消息
    gsv

配置项

基础设置

| 配置项 | 默认值 | 说明 | |--------|--------|------| | downloadPath | ./downloads | 下载目录路径 | | sendArchive | false | 下载后打包发送 | | archiveThreshold | 5 | 触发打包的文件数量下限 | | httpUrl | '' | HTTP 服务地址(用于生成下载链接) |

高级设置

| 配置项 | 默认值 | 说明 | |--------|--------|------| | maxDepth | 8 | 最大递归层数(防止死循环) | | debug | false | 开启调试日志 |

配置示例

基础配置

plugins:
  get-shared-videos:
    downloadPath: ./downloads
    sendArchive: false
    archiveThreshold: 5
    httpUrl: ''
    maxDepth: 8
    debug: false

启用打包发送

plugins:
  get-shared-videos:
    downloadPath: ./downloads
    sendArchive: true
    archiveThreshold: 3
    httpUrl: http://192.168.1.100:5140  # 配置 HTTP 地址
    debug: true

配置 httpUrl 后,会自动生成可下载的链接:

下载链接: http://192.168.1.100:5140/assets/downloads_1234567890.zip

文件结构

下载后的文件会自动分类:

downloads/
├── images/     # 图片文件
│   ├── image1.jpg
│   └── image2.png
└── videos/     # 视频文件
    ├── video1.mp4
    └── video2.mp4

支持的文件格式

图片格式

  • JPEG / JPG
  • PNG
  • GIF
  • WebP
  • BMP

视频格式

  • MP4
  • AVI
  • MKV
  • MOV
  • WMV
  • FLV
  • WebM
  • M4V

使用示例

用户A: [转发了一条包含多个图片和视频的消息]
用户B: gsv

机器人: 找到 5 个文件,开始下载...
机器人: 下载完成!成功: 5,失败: 0
保存位置: ./downloads

注意事项

  1. 网络依赖:需要能够访问媒体文件的 URL
  2. 存储空间:请确保有足够的磁盘空间
  3. 文件权限:确保 Koishi 对下载目录有写入权限
  4. 文件名安全:自动处理不安全字符,避免文件系统错误
  5. 下载时间:大量文件可能需要较长时间,请耐心等待

安装方法

  1. 在 Koishi 配置文件中添加插件:
plugins:
  get-shared-videos:
    downloadPath: ./downloads
    debug: false
  1. 或者在控制台中搜索并安装 koishi-plugin-get-shared-videos

调试模式

开启调试模式可以看到详细的处理过程:

plugins:
  get-shared-videos:
    debug: true

调试日志会显示:

  • 检测到的转发消息 ID
  • 转发消息包含的子消息数量
  • 每个文件的 URL 和类型
  • 下载进度和结果

开发者

基于 Koishi 4.x 开发,支持 OneBot 等主流适配器。

许可证

MIT License