使用 Soulseek.NET 构建的 Soulseek 自动下载器。接受 CSV 文件以及 Spotify 和 YouTube 网址。
支持播放列表和专辑下载;根据用户配置的文件条件和启发法选择最佳文件。
请参阅使用示例。
Usage: sldl <input> [OPTIONS]
<input> A url, search string, or path to a local CSV file.
Run --help "input" to view the accepted inputs.
Can also be passed with -i, --input <input>
--user <username> Soulseek username
--pass <password> Soulseek password
-p, --path <path> Download directory
--input-type <type> [csv|youtube|spotify|bandcamp|string|list]
--name-format <format> Name format for downloaded tracks. See --help name-format
-n, --number <maxtracks> Download the first n tracks of a playlist
-o, --offset <offset> Skip a specified number of tracks
-r, --reverse Download tracks in reverse order
-c, --config <path> Set config file location. Set to 'none' to ignore config
--profile <names> Configuration profile(s) to use. See --help ""config"".
--concurrent-downloads <num> Max concurrent downloads (default: 2)
--write-playlist Create an m3u playlist file in the output directory
--playlist-path <path> Override default path for m3u playlist file
--no-skip-existing Do not skip downloaded tracks
--no-write-index Do not create a file indexing all downloaded tracks
--index-path <path> Override default path for sldl index
--skip-check-cond Check file conditions when skipping existing files
--skip-check-pref-cond Check preferred conditions when skipping existing files
--skip-music-dir <path> Also skip downloading tracks found in a music library by
comparing filenames. Not 100% reliable.
--skip-not-found Skip searching for tracks that weren't found on Soulseek
during the last run.
--listen-port <port> Port for incoming connections (default: 49998)
--on-complete <command> Run a command whenever a file is downloaded.
Available placeholders: {path} (local save path), {title},
{artist},{album},{uri},{length},{failure-reason},{state}.
Prepend a state number to only run in specific cases:
1:, 2:, 3:, 4: for the Downloaded, Failed, Exists, and
NotFoundLastTime states respectively.
E.g: '1:<cmd>' will only run the command if the file is
downloaded successfully. Prepend 's:' to use the system
shell to execute the command.
--print <option> Print tracks or search results instead of downloading:
'tracks': Print all tracks to be downloaded
'tracks-full': Print extended information about all tracks
'results': Print search results satisfying file conditions
'results-full': Print search results including full paths.
--no-progress Disable progress bars/percentages, only simple printing
--debug Print extra debug info
--fast-search Begin downloading as soon as a file satisfying the preferred
conditions is found. Only for normal download mode.
--remove-ft Remove 'feat.' and everything after before searching
--no-remove-special-chars Do not remove special characters before searching
--remove-brackets Remove square brackets and their contents before searching
--regex <regex> Remove a regexp from all track titles and artist names.
Optionally specify a replacement regex after a semicolon.
Add 'T:', 'A:' or 'L:' at the start to only apply this to
the track title, artist, or album respectively.
--artist-maybe-wrong Performs an additional search without the artist name.
Useful for sources like SoundCloud where the "artist"
could just be an uploader. Note that when downloading a
YouTube playlist via url, this option is set automatically
on a per-track basis, so it is best kept off in that case.
-d, --desperate Tries harder to find the desired track by searching for the
artist/album/title only, then filtering. (slower search)
--fails-to-downrank <num> Number of fails to downrank a user's shares (default: 1)
--fails-to-ignore <num> Number of fails to ban/ignore a user's shares (default: 2)
--yt-dlp Use yt-dlp to download tracks that weren't found on
Soulseek. yt-dlp must be available from the command line.
--yt-dlp-argument <str> The command line arguments when running yt-dlp. Default:
"{id}" -f bestaudio/best -cix -o "{savepath}.%(ext)s"
Available vars are: {id}, {savedir}, {savepath} (w/o ext).
Note that -x causes yt-dlp to download webms in case ffmpeg
is unavailable.
--search-timeout <ms> Max search time in ms (default: 6000)
--max-stale-time <ms> Max download time without progress in ms (default: 50000)
--searches-per-time <num> Max searches per time interval. Higher values may cause
30-minute bans, see --help "search". (default: 34)
--searches-renew-time <sec> Controls how often available searches are replenished.
See --help "search". (default: 220)
--spotify-id <id> Spotify client ID
--spotify-secret <secret> Spotify client secret
--spotify-token <token> Spotify access token
--spotify-refresh <token> Spotify refresh token
--remove-from-source Remove downloaded tracks from source playlist
--youtube-key <key> Youtube data API key
--get-deleted Attempt to retrieve titles of deleted videos from wayback
machine. Requires yt-dlp.
--deleted-only Only retrieve & download deleted music.
--artist-col Artist column name
--title-col Track title column name
--album-col Album column name
--length-col Track length column name
--album-track-count-col Album track count column name (sets --album-track-count)
--yt-desc-col Youtube description column (improves --yt-parse)
--yt-id-col Youtube video id column (improves --yt-parse)
--time-format <format> Time format in Length column of the csv file (e.g h:m:s.ms
for durations like 1:04:35.123). Default: s
--yt-parse Enable if the CSV contains YouTube video titles and channel
names; attempt to parse them into title and artist names.
--remove-from-source Remove downloaded tracks from source CSV file
--format <formats> Accepted file format(s), comma-separated, without periods
--length-tol <sec> Length tolerance in seconds
--min-bitrate <rate> Minimum file bitrate
--max-bitrate <rate> Maximum file bitrate
--min-samplerate <rate> Minimum file sample rate
--max-samplerate <rate> Maximum file sample rate
--min-bitdepth <depth> Minimum bit depth
--max-bitdepth <depth> Maximum bit depth
--strict-title File name must contain title
--strict-artist File path must contain artist name
--strict-album File path must contain album name
--banned-users <list> Comma-separated list of users to ignore
--pref-format <formats> Preferred file format(s), comma-separated (default: mp3)
--pref-length-tol <sec> Preferred length tolerance in seconds (default: 3)
--pref-min-bitrate <rate> Preferred minimum bitrate (default: 200)
--pref-max-bitrate <rate> Preferred maximum bitrate (default: 2500)
--pref-min-samplerate <rate> Preferred minimum sample rate
--pref-max-samplerate <rate> Preferred maximum sample rate (default: 48000)
--pref-min-bitdepth <depth> Preferred minimum bit depth
--pref-max-bitdepth <depth> Preferred maximum bit depth
--pref-banned-users <list> Comma-separated list of users to downrank
--strict-conditions Skip files with missing properties instead of accepting by
default; if --min-bitrate is set, ignores any files with
unknown bitrate.
-a, --album Album download mode: Download a folder
-t, --interactive Interactive mode, allows to select the folder and images
--album-track-count <num> Specify the exact number of tracks in the album. Add a + or
- for inequalities, e.g '5+' for five or more tracks.
--album-art <option> Retrieve additional images after downloading the album:
'default': No additional images
'largest': Download from the folder with the largest image
'most': Download from the folder containing the most images
--album-art-only Only download album art for the provided album
--no-browse-folder Do not automatically browse user shares to get all files in
in the folder
--failed-album-path Path to move all album files to when one of the items from
the directory fails to download. Set to 'delete' to delete
the files instead. Set to 'disable' keep it where it is.
Default: {configured output dir}/failed
-g, --aggregate Aggregate download mode: Find and download all distinct
songs associated with the provided artist, album, or title.
--aggregate-length-tol <tol> Max length tolerance in seconds to consider two tracks or
albums equal. (Default: 3)
--min-shares-aggregate <num> Minimum number of shares of a track or album for it to be
downloaded in aggregate mode. (Default: 2)
--relax-filtering Slightly relax file filtering in aggregate mode to include
more results
还接受两个和三个单词标志的首字母缩略词,例如 --twf。如果选项包含单词“max”,则 m 应为大写。 “bitrate”、“sameplerate”和“bitdepth”都应被视为两个单独的单词,例如 --Mbr 代表 --max-bitrate。
可以通过将标志设置为 false 来显式禁用它们,例如“--interactive false”
输入类型通常是自动确定的。要强制使用特定的输入类型,请设置 --input-type [spotify|youtube|csv|string|bandcamp|list]。可以使用以下输入类型:
本地 CSV 文件的路径:使用包含要下载歌曲的曲目信息的 csv 文件。列的名称应该是艺术家、标题、专辑、长度,尽管通常也会检测到其他名称。仅标题或专辑列是必需的,但额外的信息可能会提高搜索结果排名。没有标题列文本的每一行都将被视为专辑下载。
播放列表 url:从 YouTube 播放列表下载歌曲。检索播放列表的默认方法并不总是返回所有视频,尤其是不可用的视频。要获取所有视频标题,您可以通过提供带有 --youtube-key 的密钥来使用官方 API。在这里获取它 https://console.cloud.google.com。创建一个新项目,点击“启用Api”并搜索“youtube data”,然后按照提示操作。
播放列表/专辑 URL 或“spotify-likes”:下载 Spotify 播放列表、专辑或您喜欢的歌曲。下载私人播放列表或喜欢的音乐时需要凭据。
在 https://developer.spotify.com/dashboard/applications 上创建一个 Spotify 应用程序,并使用重定向 URL http://localhost:48721/callback。从创建的应用程序仪表板中获取应用程序 ID 和密钥。
使用获得的凭据和授权操作启动 sldl 以触发 Spotify 应用程序登录流程:
sldl spotify-likes --spotify-id 123456 --spotify-secret 123456 -n 1 --print-tracks
sldl 将尝试自动打开浏览器,但会回退到记录登录流 URL 以进行输出。登录流程完成后,sldl 将输出令牌和刷新令牌并完成当前命令的运行。
要跳过每次使用 sldl 时都需要登录流程,可以向 sldl 提供令牌和刷新令牌(提示:将此信息存储在配置文件中以使命令不那么冗长):
sldl spotify-likes --spotify-id 123456 --spotify-secret 123456 --spotify-refresh 123456 --spotify-token 123456 -n 1 --pt
Spotify-token 访问的有效期仅为 1 小时。 Spotify-refresh 将使 sldl 能够在每次运行时更新访问权限(并且可以在不包含 spotify-token 的情况下使用)
bandcamp url:下载单曲、专辑或艺术家的整个唱片目录。提取艺术家姓名、专辑名称并设置 --album-track-count="n+",其中 n 是 bandcamp 页面上可见曲目的数量。
要搜索的曲目、专辑或艺术家的名称:可以是任何典型的搜索字符串(例如您在 Soulseek 搜索栏中输入的内容),也可以是逗号分隔的属性列表,例如 'title=歌曲名称, Artist=艺术家姓名,长度=215'。
接受以下属性:
title
artist
album
length (in seconds)
artist-maybe-wrong
album-track-count
输入示例及其解释:
Input String | Artist | Title | Album | Length
---------------------------------------------------------------------------------
'Foo Bar' (without any hyphens) | | Foo Bar | |
'Foo - Bar' | Foo | Bar | |
'Foo - Bar' (with --album enabled) | Foo | | Bar |
'Artist - Title, length=42' | Artist | Title | | 42
'artist=AR, title=T, album=AL' | AR | T | AL |
文本文件的路径,其中每行具有以下形式:
"some input" "conditions" "preferred conditions"
例如:
"artist=Artist, album=Album" "format=mp3; br > 128" "br >= 320"
其中“某些输入”是上述任何输入类型。如果字段不包含空格,则可以省略引号。条件字段添加在配置的条件之上,也可以省略。列表输入必须使用 --input-type=list 手动激活。
它还接受专辑下载的简写: a:"Artist - Album"
。请注意, a:
必须出现在引号之外。
默认。为每个输入条目下载一个文件。
sldl 将搜索专辑并下载整个文件夹,包括非音频文件。当输入是指向 Spotify 或 bandcamp 专辑的链接、输入字符串或 csv 行没有曲目标题或启用 -a/--album 时激活。
使用 -g/--aggregate,sldl 对输入执行普通搜索,然后尝试将结果分组为不同的歌曲,并从大多数用户共享的歌曲开始下载每种歌曲。
请注意,--min-shares-aggregate 默认为 2,这意味着仅由一个用户共享的歌曲将被忽略。
当 --album 和 --aggregate 都启用时激活。 sldl 将对共享进行分组并下载每个不同专辑的一张,从最多用户共享的专辑开始。建议将其与 --interactive 配对。
请注意,--min-shares-aggregate 默认为 2,这意味着仅由一个用户共享的相册将被忽略。
搜索查询确定如下:
如果短时间内执行过多搜索,服务器将禁止您 30 分钟。该程序有一个搜索限制器,可以通过 --searches-per-time 和 --searches-renew-time 进行调整(当达到限制时,下载状态将为“等待”)。默认情况下,它配置为每 220 秒最多允许 34 次搜索。默认值是通过实验确定的,因此可能不正确。
以下选项将使搜索速度更快,但可能会降低搜索结果质量或导致不稳定:
不满足条件的文件将不会被下载。满足优先条件的文件将被优先考虑;设置 --pref-format "flac,wav" 将使其下载无损文件(如果可用),并且仅在没有其他文件的情况下下载有损文件。
没有默认的必需条件。默认的首选条件是:
pref-format = mp3
pref-length-tol = 3
pref-min-bitrate = 200
pref-max-bitrate = 2500
pref-max-samplerate = 48000
pref-strict-title = true
pref-strict-album = true
pref-accept-no-length = false
因此,sldl 更喜欢比特率在 200 到 2500 kbps 之间的 mp3 文件,并且其长度与提供的长度相差不超过 3 秒。它还会优先选择其路径包含所提供的标题和专辑(忽略大小写,并由边界字符界定)并且具有非空长度的文件。不建议更改最后三个首选条件。
请注意,满足首选条件子集的文件仍优先于不满足任何条件的文件,但某些条件优先于其他条件。例如,仅满足严格标题(如果启用)的文件将始终优先于仅满足格式条件的文件。使用 --print "results-full" 运行以显示排序逻辑。
条件也可以通过 --cond 和 --pref 以分号分隔的字符串形式提供,例如 --cond "br >= 320; format = mp3,ogg; sr < 96000"。
选项 --strict-title、--strict-artist 和 --strict-album 将过滤文件名中不包含标题/艺术家/专辑的任何文件(忽略大小写,以边界字符为界)。
防止错误下载的另一种方法是将 --length-tol 设置为 3 或更少,以使其忽略与输入相差超过 3 秒的任何歌曲。然而,默认情况下,所有 4 个选项均已启用为“首选”条件,这意味着无论如何,这些文件只会作为最后的手段下载。因此,仅当您需要尽可能减少错误下载时,或者名称只有一两个字符的曲目或专辑等特殊情况时,才建议启用它们。
根据对等方使用的客户端,某些信息可能不可用。例如,标准的 Soulseek 客户端不共享文件比特率。如果(例如)设置了 --min-bitrate,则 sldl 仍将接受任何具有未知比特率的文件。您可以通过启用 --strict-conditions 将其配置为拒绝所有已检查属性为 null(未知)的文件。
因此,如果还设置了 --min-bitrate,则用户与默认客户端共享的任何文件都将被忽略。另请注意,由于比特率和采样率检查,默认首选条件已经影响此选项的排名。
{} 中包含的变量将被相应的文件标记值替换。名称格式支持子目录以及条件表达式,例如 {tag1|tag2} - 如果 tag1 为 null,则使用 tag2。在 null 检查中,括号中的字符串文字将被忽略。
artist First artist (from the file tags)
sartist Source artist (as on CSV/Spotify/YouTube/etc)
artists Artists, joined with '&'
albumartist First album artist
albumartists Album artists, joined with '&'
title Track title
stitle Source track title
album Album name
salbum Source album name
year Track year or date
track Track number
disc Disc number
filename Soulseek filename without extension
foldername Soulseek folder name
extractor Name of the extractor used (CSV/Spotify/YouTube/etc)
default-folder Default sldl folder name (usually the playlist name)
sldl 将在以下位置查找名为 sldl.conf 的文件:
~/AppData/Roaming/sldl/sldl.conf
~/.config/sldl/sldl.conf
以及可执行文件的目录中。
配置文件示例:
username = your-username
password = your-password
pref-format = flac
fast-search = true
以井号标签 (#) 开头的行将被忽略。路径中的波形符将扩展为用户目录。
支持的配置文件:
[lossless]
pref-format = flac,wav
要激活上述配置文件,请运行 --profile "lossless"。要列出所有可用的配置文件,请运行 --profile "help"。
配置文件可以根据几个简单的条件自动激活:
[no-stale]
profile-cond = interactive && download-mode == "album"
max-stale-time = 999999
# album downloads will never be automatically cancelled in interactive mode
[youtube]
profile-cond = input-type == "youtube"
path = ~/downloads/sldl-youtube
# download to another location for youtube
支持在 profile-cond 中使用以下运算符:&&、||、==、!=、!{bool}。
以下变量可用:
input-type ("youtube"|"csv"|"string"|"bandcamp"|"spotify")
download-mode ("normal"|"aggregate"|"album"|"album-aggregate")
interactive (bool)
从 csv 文件下载曲目:
sldl test.csv
下载 Spotify 喜欢:
sldl spotify-likes
互动专辑下载:
sldl "Some Album" -a -t
按名称下载特定歌曲,首选无损:
sldl "MC MENTAL @ HIS BEST, length=242" --pref-format "flac,wav"
下载 Spotify 播放列表中每首歌曲的专辑:
sldl https://spotify/playlist/id -a
检索已删除的视频名称,然后从 YouTube 播放列表下载并回退到 yt-dlp:
sldl https://www.youtube.com/playlist/id --get-deleted --yt-dlp
打印不在您的音乐库中的艺术家的所有歌曲:
sldl "artist=MC MENTAL" --aggregate --skip-music-dir "path/to/music" --print results-full
下载在 Soulseek 上找到的艺术家的所有专辑:
sldl "artist=MC MENTAL" -a -g -t
创建一个名为wishlist.txt
的文件,并添加一些项目,如输入类型:列表中详细说明:
" Artist - My Favorite Song "
a: " Artist - Some Album, album-track-count=5 " " format=flac "
将配置文件添加到sldl.conf
:
[wishlist]
input = ~/sldl/wishlist.txt
input-type = list
index-path = ~/sldl/wishlist-index.sldl
这将创建一个全局索引文件wishlist-index.sldl
,每次运行 sldl 时都会扫描该文件以跳过已下载的愿望清单项目。如果您想继续搜索直到下载满足首选条件的版本,还可以添加skip-check-pref-cond = true
(请注意,这要求文件在下载后保留在同一位置)。
最后,使用以下选项设置 cron 作业(或 Windows 上的计划任务)以定期运行 sldl:
sldl --profile wishlist
chmod +x publish.sh && sh publish.sh
。对于intel mac,取消注释x64并注释publish.sh中的arm64部分。--no-progress
。 可以从此存储库构建用于运行sldl
的 docker 容器。该镜像支持linux x86/ARM。
构建并启动容器:
clone https://github.com/fiso64/slsk-batchdl
cd slsk-batchdl
docker compose up -d
exec
进入容器以开始使用sldl
:
docker compose exec sldl sh
sldl --help
compose 堆栈相对于docker-compose.yml
所在位置安装了两个目录,可用于文件管理:
/config
(位于主机上的./config
处)- 将sldl.conf
配置放入此目录中,然后使用sldl -c /config ...
在容器中使用您的配置/data
(位于主机上的./data
) - 用作下载目录 IE sldl -p /data ...
如果您在Linux 主机上运行 Docker,则应指定拥有主机上配置和数据目录的用户的user:group
权限,以避免 docker 文件权限问题。这些可以使用环境变量PUID和PGID来指定。
要获取当前用户的 UID 和 GID,请从终端运行以下命令:
id -u
-- 打印 UIDid -g
-- 打印 GID将它们替换为docker-compose.yml
中相应的变量( PUID
PGID
)。
可以使用容器内置的 cron 按计划运行一个或多个sldl
命令。
要创建计划,请在主机./config/crontabs/abc
上创建一个新文件,并将其与标准 crontab 语法一起使用。
确保在对 cron 文件进行任何更改后重新启动容器。
示例=>每周日凌晨 1 点运行sldl
,从指定的 Spotify 播放列表中搜索丢失的曲目
# min hour day month weekday command
0 1 * * 0 sldl https://open.spotify.com/playlist/6sf1WR5grXGJ6dET -c /config -p /data --skip-existing --m3u-path /data/index.sldl"
crontab.guru 可用于帮助调度表达式。