Content
# selenium-mp3-download
Panda lossless music website (xmwsyy.com) music downloader, supporting batch download via command line and integration with MCP server for natural language control via Claude Desktop.
Downloads are facilitated through Quark Cloud Storage (primary) / 139.com (backup), requiring manual login and cookie saving via a browser popup upon first use.
## Environment
```bash
pip install selenium mcp
```
Requires local installation of Chrome and chromedriver.
## Command Line Usage (download_v8.py)
```bash
python ./download_v8.py
```
Interactive menu:
1. **Single Song Download** — Search and download by song name
2. **Batch Download** — Read song names from a text file (one song per line), e.g., `new_dj.txt`
3. **Exit**
First run will launch Chrome; manually log in to Quark Cloud Storage, then press Enter. The cookie will be saved in `quark_cookies.pkl` for subsequent reuse.
Downloads are saved to `downloads/` by default; the download path can be changed at launch.
## MCP Server Usage (xmwsyy_mcp.py)
Encapsulates the download capabilities as an MCP tool for use with Claude Desktop or other MCP clients. Natural language commands can be used, such as: "Search for Taylor Swift's 'Father Figure' and download it," "Give me the top 20 songs," or "Download all songs from `new_dj.txt`."
### Claude Desktop Configuration
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
```json
{
"mcpServers": {
"xmwsyy-music": {
"command": "/opt/anaconda3/bin/python",
"args": ["/Users/xlisp/PyPro/selenium-mp3-download/xmwsyy_mcp.py"]
}
}
}
```
Adjust the Python path according to your environment and restart Claude Desktop.
### Tool List
**Query Tools (pure curl, fast, no browser overhead):**
| Tool | Description |
| --- | --- |
| `search_songs(keyword, limit)` | Search songs by keyword |
| `list_recent_songs(limit)` | List recently updated songs (`/recentlysong/`) |
| `list_top_songs(limit)` | List popular songs (`/trendsong/wk.html`) |
| `list_category_songs(category, limit)` | Browse by category |
| `recommend_songs(limit)` | Homepage recommendations (mix of latest and popular) |
| `get_song_download_url(name_or_url)` | Resolve actual cloud storage link, no download |
Available `category`: `douyin` / `neidi` / `gangtai` / `rihan` / `oumei` / `chezaidj` / `chunyinyue`
**Download Tools (selenium, browser login required for first use):**
| Tool | Description |
| --- | --- |
| `download_song(song_name)` | Download a single song by name |
| `download_song_by_url(detail_url)` | Download directly from song details page URL |
| `batch_download(song_names)` | Batch download a list of songs |
| `batch_download_from_file(file_path)` | Batch download from a file |
| `close_browser()` | Close the browser instance |
**Directory Management:**
| Tool | Description |
| --- | --- |
| `set_download_folder(path)` | Set the download directory |
| `get_download_folder()` | Get the current download directory |
| `list_downloaded_files(limit)` | List downloaded files |
### Design Highlights
- **Browser Singleton + Lazy Loading**: Chrome is launched only upon the first call to a download tool and reused thereafter, maintaining Quark login state.
- **stdout Redirection**: The reused `download_v8` function uses `print()`, which could disrupt the protocol in MCP stdio mode; `contextlib.redirect_stdout` is used to isolate this.
- **Query via curl, Download via selenium**: The browser is only used when necessary, such as clicking the download button on Quark Cloud Storage; pure page scraping for searches and charts does not require a browser.
## Site Structure (calibrated as of 2026-04)
Key URLs on xmwsyy.com for reference:
- Homepage (with search bar): `https://www.xmwsyy.com/`
- Search: POST `/index/search/` form `action=1&keyword=...` (GET results in 404)
- Song details: `/song/<slug>.html`
- Download intermediary: `/dls/<code>.html` → JS redirects to actual cloud storage
- `rmk*` → Quark MP3
- `rwk*` → Quark WAV
- `rym*` → 139.com MP3 (unlimited speed)
- `ryw*` → 139.com WAV (unlimited speed)
- Recent updates: `/recentlysong/index.html`
- Charts: `/trendsong/wk.html`
- Categories: `/music/{douyin,neidi,gangtai,rihan,oumei,chezaidj,chunyinyue}.html`
## Files
- `download_v8.py` — Command line batch download script, containing core selenium/link parsing logic
- `xmwsyy_mcp.py` — MCP server, encapsulating all capabilities
- `quark_cookies.pkl` — Quark Cloud Storage login cookie (generated automatically after first login)
- `new_dj.txt` — Example batch download song list
- `downloads/` — Default download directory
- `remove_dict_song.py` / `remove_repeat_file.py` — Auxiliary scripts for organizing downloaded files
## English Song Supplemental Resources
`www.hydr0.org` template example:
```
https://juicy-j-feat-kevin-gates-future-and-sage-the-gemini-payback.hydr0.org/
```
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
hyperframes
Write HTML. Render video. Built for agents.
palmier-pro
macOS video editor with AI generation
FireRed-OpenStoryline
FireRed-OpenStoryline is an AI video editing agent that transforms manual...
notion-local-ops-mcp
Use Notion AI with your local files, shell, and fallback local agents.
lanhu-mcp
Lanhu MCP non-browser
OpenDocuments
Self-hosted open-source RAG platform that unifies organizational documents...