特色栏目

ASP源码

PHP源码

.NET源码

JSP源码

游戏频道
专题合集
关闭菜单
首页> AI教程> 媒体下载器:自动下载视频和音乐 - Openclaw Skills

媒体下载器:自动下载视频和音乐 - Openclaw Skills

时间:2026-03-20 19:00:01 作者:互联网

什么是 媒体下载器?

媒体下载器是 Openclaw 技能生态系统中的一个强大工具,旨在简化获取在线内容的过程。它能自动对下载内容进行分类,将视频放入 ~/Movies,音频放入 ~/Music,是管理本地媒体库用户的必备工具。通过利用 uv 的速度和专业脚本的多功能性,该技能填补了网络内容与本地存储基础设施之间的空白。

无论您是在构建个人存档还是为家庭媒体服务器提供内容,此技能都提供了一种无需手动干预的媒体管理方法。它旨在处理诸如播放列表下载和 T@elegrimm 集成之类的复杂任务,确保您的内容始终在您需要的时间和地点准备就绪。

下载入口:https://github.com/openclaw/skills/tree/main/skills/guoqiao/dl

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install dl

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 dl。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

媒体下载器 应用场景

媒体下载器 工作原理
  1. 用户提供媒体 URL 或自然语言命令以启动下载。
  2. 该技能确认请求并使用 Openclaw Skills 协议准备执行环境。
  3. 通过 uv run 执行底层脚本,处理 URL 以识别最佳可用媒体格式。
  4. 根据内容分类为音乐还是视频,将文件保存到相应的系统目录中。
  5. 该技能从输出中捕获最终的文件或文件夹路径以便进一步处理。
  6. 对于基于 T@elegrimm 的会话,音频文件会自动上传并作为消息发送给用户。

媒体下载器 配置指南

要利用此项及其他 Openclaw 技能,请确保您已安装 uv 包管理器。按照以下步骤设置下载器:

# 如果尚未安装,请安装所需的 uv 工具
curl -LsSf https://astral.sh/uv/install.sh | sh

# 使用目标 URL 运行下载脚本
uv run --script dl.py ""

# 可选:指定自定义输出目录
uv run --script dl.py "" -o 

为了在具有身份验证的平台上增强可靠性,请在根目录中放置一个 .cookies.txt 文件或设置 $COOKIES_FILE 环境变量。

媒体下载器 数据架构与分类体系

媒体下载器技能遵循严格的组织分类法,以确保您的媒体保持易于访问且整洁:

媒体类型 目标文件夹 描述
视频内容 ~/Movies/ 或 ~/Videos/ 来自 YouTube、X 等的标准视频文件。
音频内容 ~/Music/ 提取的音乐或播客文件。
播放列表 ~/Music// 为分组项目组织的子目录。
元数据 .cookies.txt 受限 URL 的可选身份验证数据。
name: dl
description: Download Video/Music from YouTube/Bilibili/X/etc.
author: guoqiao
metadata: {"openclaw":{"always":false,"emoji":"??","homepage":"https://clawhub.ai/guoqiao/dl","os":["darwin","linux","win32"],"requires":{"bins":["uv"]}}}
triggers:
- "/dl "
- "Download this video ..."
- "Download this music ..."

Media Downloader

Smartly download media (Video/Music) from URLs (YouTube, Bilibili, X, etc.) to the appropriate local folders.

Designed to work with a local Media Server (e.g., Universal Media Server, Jellyfin) for instant playback on TV/devices.

Agent Procedure

When the user provides a URL or asks to download media, you MUST follow this exact sequence:

  1. Acknowledge:

    • Immediately reply to the user: "Downloading with dl skill..."
  2. Execute:

    • Run the script:
      uv run --script ${baseDir}/dl.py ""
      
  3. Capture Path:

    • Read the script output, a path will be printed to stdout at the end, points to either a single file or a folder contains the playlist items.
  4. Upload (T@elegrimm Only):

    • If the user is on T@elegrimm (check context or session) AND the file is audio (mp3/m4a):
    • Use the message tool to send the file to the user:
      {
        "action": "send",
        "filePath": "",
        "caption": "Here is your music."
      }
      

Usage

Run dl.py as a uv script:

# save into default dirs ~/Music or ~/Movies or ~/Videos
uv run --script ${baseDir}/dl.py 

# specify your own output dir
uv run --script ${baseDir}/dl.py  -o 

The script will print output path, either a file or a folder.

A optional cookies file could be provided to make yt-dlp more reliable, with which ever of these detected first:

Setup (User)

This skill will be much more useful if you setup a media server on same machine to share the downloaded media in your LAN:

  1. Install a DLNA/UPnP Media Server (Universal Media Server, miniDLNA, Jellyfin).
  2. Share ~/Music and ~/Movies (or ~/Videos) folders.
  3. Downloaded media will appear automatically on your TV, with apps support DLNA/UPnP, such as VLC.

See example script to setup Universal Media Server on Mac.

相关文章

热门文章

猜你喜欢

返回顶部