DeepSeek Harness (DSH) adopts a plugin-based architecture. When developing agents to handle music resources, challenges such as cross-platform downloading, format conversion (e.g., MP3 320k), and lyric retrieval often need to be addressed. The dsh-song-download plugin directly addresses these requirements.

Plugin Overview

This is an open-source plugin maintained by Raywh (MIT License). It provides two core capabilities: searching and downloading. It can convert audio resources from platforms such as Bilibili and YouTube into MP3 320k format (compatible with players such as KuGou and QQ Music), and automatically include LRC lyrics.

Core Features

The plugin provides the following two tools:

  • song_search: Searches for songs. It prioritizes the Bilibili search API, and automatically switches to YouTube search if Bilibili anti-crawling measures are triggered. The returned results include the title, duration, uploader, and link.
  • song_download: Downloads audio to the downloads/ directory in the workspace. The default output is MP3 320k with ID3 tags. It also supports downloading the original audio quality.

Workflow

From user instruction to file generation, the process is as follows:

  1. The user inputs a command (e.g., “Download Jay Chou’s Sunny Day”), triggering song_download.
  2. The plugin automatically searches for the first result on Bilibili.
  3. If it encounters a Bilibili 412 anti-crawling restriction, it automatically switches to the YouTube source.
  4. It uses yt-dlp to obtain the best audio stream.
  5. It uses ffmpeg to transcode the audio to MP3 320k and writes ID3 tags (title, artist, album).
  6. It preferentially extracts site subtitles and converts them to LRC. If no subtitles are available, it fetches lyrics via the NetEase Cloud Music API.
  7. It finally outputs files named “Artist - song name.mp3” and “Artist - song name.lrc”.

Installation and Activation

Installing this plugin requires a DSH environment.

dsh plugin --profile main add dsh-song-download

After installation, the dsh web process needs to be restarted. This plugin will take effect for all sessions.

Typical Usage

After installation, operations can be performed using natural language commands:

  • “Download Jay Chou’s Sunny Day”
  • “Search for Beyond’s A Sea of Freedom”
  • “Download the audio from these links to downloads” (supports passing URLs for batch downloading)

Dependencies and Notes

Dependencies:
* Python 3 environment
* yt-dlp library (pip install yt-dlp)
* ffmpeg (used for transcoding. It can be configured via the PATH environment variable, or provided as an embedded binary via pip install imageio-ffmpeg)

Notes:
* The plugin runs with the permissions of the current DSH process. Ensure the working directory has write permissions.
* Before downloading, confirm that you have the right to use the resource and comply with the copyright terms of each platform.
* To view the source code or contribute, please visit the GitHub repository.