mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-06-24 08:43:42 +08:00
Compare commits
6 Commits
v0.53.0
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce2a7f6ae4 | ||
|
|
6fbde66415 | ||
|
|
943ad190e6 | ||
|
|
cfcca79a12 | ||
|
|
33a886fac9 | ||
|
|
57539ec3da |
@@ -26,6 +26,9 @@
|
|||||||
- Multi-user support
|
- Multi-user support
|
||||||
- Auto organize files based on storage rules
|
- Auto organize files based on storage rules
|
||||||
- Watch specified chats and auto-save messages, with filters
|
- Watch specified chats and auto-save messages, with filters
|
||||||
|
- Transfer files between different storage backends
|
||||||
|
- Integrate with yt-dlp to download and save media from 1000+ websites
|
||||||
|
- Aria2 integration to download files from URLs/magnets and save to storages
|
||||||
- Write JS parser plugins to save files from almost any website
|
- Write JS parser plugins to save files from almost any website
|
||||||
- Storage backends:
|
- Storage backends:
|
||||||
- Alist
|
- Alist
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
- 多用户使用
|
- 多用户使用
|
||||||
- 基于存储规则的自动整理
|
- 基于存储规则的自动整理
|
||||||
- 监听并自动转存指定聊天的消息, 支持过滤
|
- 监听并自动转存指定聊天的消息, 支持过滤
|
||||||
|
- 在不同存储端之间转存文件
|
||||||
|
- 集成 yt-dlp, 从所支持的网站下载并转存媒体文件
|
||||||
|
- 集成 Aria2, 支持直链/磁力下载和转存
|
||||||
- 使用 js 编写解析器插件以转存任意网站的文件
|
- 使用 js 编写解析器插件以转存任意网站的文件
|
||||||
- 存储端支持:
|
- 存储端支持:
|
||||||
- Alist
|
- Alist
|
||||||
|
|||||||
@@ -45,10 +45,17 @@ func (t *Task) Execute(ctx context.Context) error {
|
|||||||
fetchedTotalBytes.Add(resp.ContentLength)
|
fetchedTotalBytes.Add(resp.ContentLength)
|
||||||
file.Size = resp.ContentLength
|
file.Size = resp.ContentLength
|
||||||
if name := resp.Header.Get("Content-Disposition"); name != "" {
|
if name := resp.Header.Get("Content-Disposition"); name != "" {
|
||||||
// Set file name
|
// Set file name from Content-Disposition header
|
||||||
filename := parseFilename(name)
|
filename := parseFilename(name)
|
||||||
file.Name = filename
|
file.Name = filename
|
||||||
}
|
}
|
||||||
|
// Fallback: extract filename from URL if no filename was determined from Content-Disposition
|
||||||
|
if file.Name == "" {
|
||||||
|
file.Name = filenameFromURL(file.URL)
|
||||||
|
}
|
||||||
|
if file.Name == "" {
|
||||||
|
return fmt.Errorf("could not determine filename for %s", file.URL)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -173,6 +173,35 @@ func parseFilenameFallback(cd string) string {
|
|||||||
return decodeFilenameParam(value)
|
return decodeFilenameParam(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// filenameFromURL extracts filename from a URL path.
|
||||||
|
// It uses the last path segment and removes any query parameters.
|
||||||
|
// Returns empty string if the URL cannot be parsed or has no valid path.
|
||||||
|
func filenameFromURL(rawURL string) string {
|
||||||
|
u, err := url.Parse(rawURL)
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the path and extract the base name
|
||||||
|
path := u.Path
|
||||||
|
if path == "" || path == "/" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the last path segment
|
||||||
|
idx := strings.LastIndex(path, "/")
|
||||||
|
if idx >= 0 && idx < len(path)-1 {
|
||||||
|
filename := path[idx+1:]
|
||||||
|
// URL decode the filename
|
||||||
|
if decoded, err := url.QueryUnescape(filename); err == nil {
|
||||||
|
return decoded
|
||||||
|
}
|
||||||
|
return filename
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var progressUpdatesLevels = []struct {
|
var progressUpdatesLevels = []struct {
|
||||||
size int64 // 文件大小阈值
|
size int64 // 文件大小阈值
|
||||||
stepPercent int // 每多少 % 更新一次
|
stepPercent int // 每多少 % 更新一次
|
||||||
|
|||||||
83
core/tasks/directlinks/util_test.go
Normal file
83
core/tasks/directlinks/util_test.go
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
package directlinks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestFilenameFromURL(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
url string
|
||||||
|
expected string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "simple file",
|
||||||
|
url: "https://example.com/file.zip",
|
||||||
|
expected: "file.zip",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "file with path",
|
||||||
|
url: "https://example.com/path/to/document.pdf",
|
||||||
|
expected: "document.pdf",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "url with query params",
|
||||||
|
url: "https://example.com/file.mp4?token=abc123",
|
||||||
|
expected: "file.mp4",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "url with fragment",
|
||||||
|
url: "https://example.com/file.txt#section",
|
||||||
|
expected: "file.txt",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "url encoded filename",
|
||||||
|
url: "https://example.com/%E6%B5%8B%E8%AF%95.zip",
|
||||||
|
expected: "测试.zip",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "url encoded Chinese filename",
|
||||||
|
url: "https://example.com/10%E6%9C%8817%E6%97%A5(6).mp4",
|
||||||
|
expected: "10月17日(6).mp4",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "root path only",
|
||||||
|
url: "https://example.com/",
|
||||||
|
expected: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "no path",
|
||||||
|
url: "https://example.com",
|
||||||
|
expected: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "empty url",
|
||||||
|
url: "",
|
||||||
|
expected: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "file with spaces encoded",
|
||||||
|
url: "https://example.com/my%20file.txt",
|
||||||
|
expected: "my file.txt",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "complex path with multiple slashes",
|
||||||
|
url: "https://cdn.example.com/a/b/c/d/e/video.mkv",
|
||||||
|
expected: "video.mkv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "malformed url with invalid characters",
|
||||||
|
url: "://invalid url",
|
||||||
|
expected: "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
result := filenameFromURL(tt.url)
|
||||||
|
if result != tt.expected {
|
||||||
|
t.Errorf("filenameFromURL(%q) = %q, expected %q", tt.url, result, tt.expected)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,9 @@ Save Any Bot is a tool that allows you to save files from Telegram to various st
|
|||||||
- Multi-user
|
- Multi-user
|
||||||
- Automatic organization based on storage rules
|
- Automatic organization based on storage rules
|
||||||
- Watch specific chats and automatically save messages, with filters
|
- Watch specific chats and automatically save messages, with filters
|
||||||
|
- Transfer files between different storage backends
|
||||||
|
- Integrate with yt-dlp to download and save media from 1000+ websites
|
||||||
|
- Aria2 integration to download files from URLs/magnets and save to storages
|
||||||
- Write JS parser plugins to save files from almost any website
|
- Write JS parser plugins to save files from almost any website
|
||||||
- Supports multiple storage backends:
|
- Supports multiple storage backends:
|
||||||
- Alist
|
- Alist
|
||||||
|
|||||||
@@ -92,6 +92,27 @@ enable = false
|
|||||||
session = "data/usersession.db"
|
session = "data/usersession.db"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Aria2 Configuration
|
||||||
|
|
||||||
|
Aria2 is a powerful download manager that supports HTTP/HTTPS, FTP, BitTorrent, and other protocols. When enabled, the bot can use the `/aria2dl` command to download files via Aria2.
|
||||||
|
|
||||||
|
- `enable`: Whether to enable Aria2 support, default is `false`
|
||||||
|
- `url`: Aria2 RPC address, typically `http://localhost:6800/jsonrpc`
|
||||||
|
- `secret`: Aria2 RPC secret, if you configured `rpc-secret` in Aria2, you need to fill it in here
|
||||||
|
- `remove_after_transfer`: Whether to remove local files downloaded by Aria2 after transfer, default is `true`
|
||||||
|
|
||||||
|
{{< hint info >}}
|
||||||
|
Aria2 needs to be installed and running separately. You can refer to the [Aria2 official documentation](https://aria2.github.io/) to learn how to install and configure Aria2.
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[aria2]
|
||||||
|
enable = true
|
||||||
|
url = "http://localhost:6800/jsonrpc"
|
||||||
|
secret = "your-rpc-secret"
|
||||||
|
remove_after_transfer = true
|
||||||
|
```
|
||||||
|
|
||||||
### Storage Endpoints List
|
### Storage Endpoints List
|
||||||
|
|
||||||
The storage endpoints list is used to define the storage locations supported by the Bot. Each storage endpoint needs to specify a name, type, and related configuration, using the double bracket syntax `[[storages]]`.
|
The storage endpoints list is used to define the storage locations supported by the Bot. Each storage endpoint needs to specify a name, type, and related configuration, using the double bracket syntax `[[storages]]`.
|
||||||
|
|||||||
@@ -112,6 +112,142 @@ Regex-match the message text. For example:
|
|||||||
|
|
||||||
This will watch the chat with ID `12345678`, and only save messages whose text contains `hello`.
|
This will watch the chat with ID `12345678`, and only save messages whose text contains `hello`.
|
||||||
|
|
||||||
|
## Direct Download Links
|
||||||
|
|
||||||
|
Use the `/dl` command to directly download one or more HTTP/HTTPS files to storage.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/dl <url1> [url2] [url3] ...
|
||||||
|
```
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/dl https://example.com/file.zip
|
||||||
|
/dl https://example.com/file1.zip https://example.com/file2.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
The bot will validate the link format and then ask you to select the target storage location.
|
||||||
|
|
||||||
|
## Aria2 Download
|
||||||
|
|
||||||
|
{{< hint warning >}}
|
||||||
|
This feature requires enabling Aria2 in the configuration file and configuring the RPC connection.
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
|
Use the `/aria2dl` command to download files via the Aria2 download manager, supporting HTTP/HTTPS, FTP, BitTorrent, and other protocols.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/aria2dl <uri1> [uri2] [uri3] ...
|
||||||
|
```
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Download HTTP link
|
||||||
|
/aria2dl https://example.com/file.zip
|
||||||
|
|
||||||
|
# Download magnet link
|
||||||
|
/aria2dl magnet:?xt=urn:btih:...
|
||||||
|
|
||||||
|
# Download torrent file (need to upload .torrent file first)
|
||||||
|
/aria2dl https://example.com/file.torrent
|
||||||
|
```
|
||||||
|
|
||||||
|
Configure Aria2:
|
||||||
|
|
||||||
|
Add to `config.toml`:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[aria2]
|
||||||
|
enable = true
|
||||||
|
url = "http://localhost:6800/jsonrpc"
|
||||||
|
secret = "your-rpc-secret" # If rpc-secret is configured
|
||||||
|
remove_after_transfer = true # Remove local files after transfer
|
||||||
|
```
|
||||||
|
|
||||||
|
## yt-dlp Video Download
|
||||||
|
|
||||||
|
{{< hint warning >}}
|
||||||
|
This feature requires the yt-dlp command-line tool installed on your system.
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
|
Use the `/ytdlp` command to download videos and audio from supported video websites, including YouTube, Bilibili, Twitter, and 1000+ other sites.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/ytdlp <url1> [url2] [flags...]
|
||||||
|
```
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Basic download
|
||||||
|
/ytdlp https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
||||||
|
|
||||||
|
# Download multiple videos
|
||||||
|
/ytdlp https://www.youtube.com/watch?v=video1 https://www.youtube.com/watch?v=video2
|
||||||
|
|
||||||
|
# Use custom parameters
|
||||||
|
/ytdlp https://www.youtube.com/watch?v=dQw4w9WgXcQ -f best
|
||||||
|
/ytdlp https://www.youtube.com/watch?v=dQw4w9WgXcQ --extract-audio --audio-format mp3
|
||||||
|
```
|
||||||
|
|
||||||
|
Common parameters:
|
||||||
|
|
||||||
|
- `-f <format>`: Specify download format (e.g., `best`, `worst`, `bestvideo+bestaudio`)
|
||||||
|
- `--extract-audio`: Extract audio
|
||||||
|
- `--audio-format <format>`: Audio format (e.g., `mp3`, `m4a`, `wav`)
|
||||||
|
- `--write-sub`: Download subtitles
|
||||||
|
- `--write-thumbnail`: Download thumbnail
|
||||||
|
|
||||||
|
For more parameters, see [yt-dlp documentation](https://github.com/yt-dlp/yt-dlp#usage-and-options).
|
||||||
|
|
||||||
|
## Storage Transfer
|
||||||
|
|
||||||
|
Use the `/transfer` command to transfer files directly between different storages without going through Telegram.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/transfer <source_storage>:/<source_path> [filter]
|
||||||
|
```
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- `source_storage`: Source storage name
|
||||||
|
- `source_path`: Source path
|
||||||
|
- `filter`: Optional regex filter to transfer only matching files
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Transfer entire directory
|
||||||
|
/transfer local1:/downloads
|
||||||
|
|
||||||
|
# Transfer files from specified path
|
||||||
|
/transfer alist1:/media/photos
|
||||||
|
|
||||||
|
# Transfer only mp4 files
|
||||||
|
/transfer webdav1:/videos ".*\.mp4$"
|
||||||
|
|
||||||
|
# Transfer image files
|
||||||
|
/transfer local1:/pictures "(?i)\.(jpg|png|gif)$"
|
||||||
|
```
|
||||||
|
|
||||||
|
The bot will:
|
||||||
|
|
||||||
|
1. List all files in the source path
|
||||||
|
2. Apply the filter (if provided)
|
||||||
|
3. Display file count and total size
|
||||||
|
4. Ask you to select the target storage
|
||||||
|
5. Ask you to select the target directory (if configured for that storage)
|
||||||
|
6. Start the transfer task
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
- Source storage must support listing and reading
|
||||||
|
- Target storage must support writing
|
||||||
|
- Real-time progress is displayed during transfer
|
||||||
|
- Transfer tasks can be cancelled
|
||||||
|
|
||||||
## Save Files Outside Telegram
|
## Save Files Outside Telegram
|
||||||
|
|
||||||
Besides files on Telegram, the bot can also save files from other websites via JavaScript plugins or built-in parsers.
|
Besides files on Telegram, the bot can also save files from other websites via JavaScript plugins or built-in parsers.
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ title: 介绍
|
|||||||
- 多用户使用
|
- 多用户使用
|
||||||
- 基于存储规则的自动整理
|
- 基于存储规则的自动整理
|
||||||
- 监听并自动转存指定聊天的消息, 支持过滤
|
- 监听并自动转存指定聊天的消息, 支持过滤
|
||||||
|
- 在不同存储端之间转存文件
|
||||||
|
- 集成 yt-dlp, 从所支持的网站下载并转存媒体文件
|
||||||
|
- 集成 Aria2, 支持直链/磁力下载和转存
|
||||||
- 使用 js 编写解析器插件以转存任意网站的文件
|
- 使用 js 编写解析器插件以转存任意网站的文件
|
||||||
- 存储端支持:
|
- 存储端支持:
|
||||||
- Alist
|
- Alist
|
||||||
|
|||||||
@@ -90,6 +90,27 @@ enable = false
|
|||||||
session = "data/usersession.db"
|
session = "data/usersession.db"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Aria2 配置
|
||||||
|
|
||||||
|
Aria2 是一个强大的下载管理器,支持 HTTP/HTTPS、FTP、BitTorrent 等多种协议。启用后,Bot 可以使用 `/aria2dl` 命令通过 Aria2 下载文件。
|
||||||
|
|
||||||
|
- `enable`: 是否启用 Aria2 支持,默认为 `false`
|
||||||
|
- `url`: Aria2 RPC 地址,通常为 `http://localhost:6800/jsonrpc`
|
||||||
|
- `secret`: Aria2 RPC 密钥,如果你在 Aria2 中配置了 `rpc-secret`,需要在此填写
|
||||||
|
- `remove_after_transfer`: 转存完成后是否删除 Aria2 下载的本地文件,默认为 `true`
|
||||||
|
|
||||||
|
{{< hint info >}}
|
||||||
|
Aria2 需要单独安装和运行。你可以参考 [Aria2 官方文档](https://aria2.github.io/) 了解如何安装和配置 Aria2。
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[aria2]
|
||||||
|
enable = true
|
||||||
|
url = "http://localhost:6800/jsonrpc"
|
||||||
|
secret = "your-rpc-secret"
|
||||||
|
remove_after_transfer = true
|
||||||
|
```
|
||||||
|
|
||||||
### 存储端列表
|
### 存储端列表
|
||||||
|
|
||||||
存储端列表用于定义 Bot 支持的存储位置, 每个存储端需要指定名称、类型和相关配置, 使用双中括号语法 `[[storages]]` 定义.
|
存储端列表用于定义 Bot 支持的存储位置, 每个存储端需要指定名称、类型和相关配置, 使用双中括号语法 `[[storages]]` 定义.
|
||||||
|
|||||||
@@ -112,6 +112,142 @@ IS-ALBUM true MyWebdav NEW-FOR-ALBUM
|
|||||||
|
|
||||||
这将会监听 ID 为 12345678 的聊天, 并且只保存消息文本中包含 "hello" 的消息.
|
这将会监听 ID 为 12345678 的聊天, 并且只保存消息文本中包含 "hello" 的消息.
|
||||||
|
|
||||||
|
## 直接下载链接
|
||||||
|
|
||||||
|
使用 `/dl` 命令可以直接下载一个或多个 HTTP/HTTPS 链接的文件到存储中.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/dl <url1> [url2] [url3] ...
|
||||||
|
```
|
||||||
|
|
||||||
|
示例:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/dl https://example.com/file.zip
|
||||||
|
/dl https://example.com/file1.zip https://example.com/file2.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
Bot 会验证链接格式, 然后让你选择目标存储位置.
|
||||||
|
|
||||||
|
## Aria2 下载
|
||||||
|
|
||||||
|
{{< hint warning >}}
|
||||||
|
该功能需要在配置文件中启用 Aria2 并配置 RPC 连接.
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
|
使用 `/aria2dl` 命令可以通过 Aria2 下载管理器下载文件, 支持 HTTP/HTTPS、FTP、BitTorrent 等多种协议.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/aria2dl <uri1> [uri2] [uri3] ...
|
||||||
|
```
|
||||||
|
|
||||||
|
示例:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 下载 HTTP 链接
|
||||||
|
/aria2dl https://example.com/file.zip
|
||||||
|
|
||||||
|
# 下载磁力链接
|
||||||
|
/aria2dl magnet:?xt=urn:btih:...
|
||||||
|
|
||||||
|
# 下载种子文件 (需要先上传 .torrent 文件)
|
||||||
|
/aria2dl https://example.com/file.torrent
|
||||||
|
```
|
||||||
|
|
||||||
|
配置 Aria2:
|
||||||
|
|
||||||
|
在 `config.toml` 中添加:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[aria2]
|
||||||
|
enable = true
|
||||||
|
url = "http://localhost:6800/jsonrpc"
|
||||||
|
secret = "your-rpc-secret" # 如果配置了 rpc-secret
|
||||||
|
remove_after_transfer = true # 转存完成后删除本地文件
|
||||||
|
```
|
||||||
|
|
||||||
|
## yt-dlp 视频下载
|
||||||
|
|
||||||
|
{{< hint warning >}}
|
||||||
|
该功能需要在系统中安装 yt-dlp 命令行工具.
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
|
使用 `/ytdlp` 命令可以下载支持的视频网站的视频和音频, 支持 YouTube、Bilibili、Twitter 等 1000+ 个网站.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/ytdlp <url1> [url2] [flags...]
|
||||||
|
```
|
||||||
|
|
||||||
|
示例:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 基本下载
|
||||||
|
/ytdlp https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
||||||
|
|
||||||
|
# 下载多个视频
|
||||||
|
/ytdlp https://www.youtube.com/watch?v=video1 https://www.youtube.com/watch?v=video2
|
||||||
|
|
||||||
|
# 使用自定义参数
|
||||||
|
/ytdlp https://www.youtube.com/watch?v=dQw4w9WgXcQ -f best
|
||||||
|
/ytdlp https://www.youtube.com/watch?v=dQw4w9WgXcQ --extract-audio --audio-format mp3
|
||||||
|
```
|
||||||
|
|
||||||
|
常用参数:
|
||||||
|
|
||||||
|
- `-f <format>`: 指定下载格式 (如 `best`, `worst`, `bestvideo+bestaudio`)
|
||||||
|
- `--extract-audio`: 提取音频
|
||||||
|
- `--audio-format <format>`: 音频格式 (如 `mp3`, `m4a`, `wav`)
|
||||||
|
- `--write-sub`: 下载字幕
|
||||||
|
- `--write-thumbnail`: 下载缩略图
|
||||||
|
|
||||||
|
更多参数请参考 [yt-dlp 文档](https://github.com/yt-dlp/yt-dlp#usage-and-options).
|
||||||
|
|
||||||
|
## 存储间传输
|
||||||
|
|
||||||
|
使用 `/transfer` 命令可以在不同存储之间直接传输文件, 无需经过 Telegram.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/transfer <source_storage>:/<source_path> [filter]
|
||||||
|
```
|
||||||
|
|
||||||
|
参数说明:
|
||||||
|
|
||||||
|
- `source_storage`: 源存储名称
|
||||||
|
- `source_path`: 源路径
|
||||||
|
- `filter`: 可选的正则表达式过滤器, 只传输匹配的文件
|
||||||
|
|
||||||
|
示例:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 传输整个目录
|
||||||
|
/transfer local1:/downloads
|
||||||
|
|
||||||
|
# 传输指定路径的文件
|
||||||
|
/transfer alist1:/media/photos
|
||||||
|
|
||||||
|
# 只传输 mp4 文件
|
||||||
|
/transfer webdav1:/videos ".*\.mp4$"
|
||||||
|
|
||||||
|
# 传输图片文件
|
||||||
|
/transfer local1:/pictures "(?i)\.(jpg|png|gif)$"
|
||||||
|
```
|
||||||
|
|
||||||
|
Bot 会:
|
||||||
|
|
||||||
|
1. 列出源路径下的所有文件
|
||||||
|
2. 应用过滤器 (如果提供)
|
||||||
|
3. 显示文件数量和总大小
|
||||||
|
4. 让你选择目标存储
|
||||||
|
5. 让你选择目标目录 (如果该存储配置了目录)
|
||||||
|
6. 开始传输任务
|
||||||
|
|
||||||
|
注意:
|
||||||
|
|
||||||
|
- 源存储必须支持列举和读取功能
|
||||||
|
- 目标存储必须支持写入功能
|
||||||
|
- 传输过程显示实时进度
|
||||||
|
- 支持取消正在进行的传输任务
|
||||||
|
|
||||||
## 转存 Telegram 之外的文件
|
## 转存 Telegram 之外的文件
|
||||||
|
|
||||||
除了 Telegram 上的文件, Bot 还可通过 JavaScript 插件或内置解析器来支持转存其他网站的文件.
|
除了 Telegram 上的文件, Bot 还可通过 JavaScript 插件或内置解析器来支持转存其他网站的文件.
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
module github.com/krau/SaveAny-Bot/docs
|
module github.com/krau/SaveAny-Bot/docs
|
||||||
|
|
||||||
go 1.24.4
|
go 1.24.4
|
||||||
|
|
||||||
require github.com/alex-shpak/hugo-book v0.0.0-20250530233833-f2c703e15588 // indirect
|
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
github.com/alex-shpak/hugo-book v0.0.0-20250530233833-f2c703e15588 h1:pwxkzpzw/iJSxMBgQLWjYMQubhIemLG3UrNjeWoCkSM=
|
|
||||||
github.com/alex-shpak/hugo-book v0.0.0-20250530233833-f2c703e15588/go.mod h1:L4NMyzbn15fpLIpmmtDg9ZFFyTZzw87/lk7M2bMQ7ds=
|
|
||||||
|
|||||||
Reference in New Issue
Block a user