musicdl 2.1.11__py3-none-any.whl → 2.7.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. musicdl/__init__.py +5 -5
  2. musicdl/modules/__init__.py +10 -3
  3. musicdl/modules/common/__init__.py +2 -0
  4. musicdl/modules/common/gdstudio.py +204 -0
  5. musicdl/modules/js/__init__.py +1 -0
  6. musicdl/modules/js/youtube/__init__.py +2 -0
  7. musicdl/modules/js/youtube/botguard.js +1 -0
  8. musicdl/modules/js/youtube/jsinterp.py +902 -0
  9. musicdl/modules/js/youtube/runner.js +2 -0
  10. musicdl/modules/sources/__init__.py +41 -10
  11. musicdl/modules/sources/apple.py +207 -0
  12. musicdl/modules/sources/base.py +256 -28
  13. musicdl/modules/sources/bilibili.py +118 -0
  14. musicdl/modules/sources/buguyy.py +148 -0
  15. musicdl/modules/sources/fangpi.py +153 -0
  16. musicdl/modules/sources/fivesing.py +108 -0
  17. musicdl/modules/sources/gequbao.py +148 -0
  18. musicdl/modules/sources/jamendo.py +108 -0
  19. musicdl/modules/sources/joox.py +104 -68
  20. musicdl/modules/sources/kugou.py +129 -76
  21. musicdl/modules/sources/kuwo.py +188 -68
  22. musicdl/modules/sources/lizhi.py +107 -0
  23. musicdl/modules/sources/migu.py +172 -66
  24. musicdl/modules/sources/mitu.py +140 -0
  25. musicdl/modules/sources/mp3juice.py +264 -0
  26. musicdl/modules/sources/netease.py +163 -115
  27. musicdl/modules/sources/qianqian.py +125 -77
  28. musicdl/modules/sources/qq.py +232 -94
  29. musicdl/modules/sources/tidal.py +342 -0
  30. musicdl/modules/sources/ximalaya.py +256 -0
  31. musicdl/modules/sources/yinyuedao.py +144 -0
  32. musicdl/modules/sources/youtube.py +238 -0
  33. musicdl/modules/utils/__init__.py +12 -4
  34. musicdl/modules/utils/appleutils.py +563 -0
  35. musicdl/modules/utils/data.py +107 -0
  36. musicdl/modules/utils/logger.py +211 -58
  37. musicdl/modules/utils/lyric.py +73 -0
  38. musicdl/modules/utils/misc.py +335 -23
  39. musicdl/modules/utils/modulebuilder.py +75 -0
  40. musicdl/modules/utils/neteaseutils.py +81 -0
  41. musicdl/modules/utils/qqutils.py +184 -0
  42. musicdl/modules/utils/quarkparser.py +105 -0
  43. musicdl/modules/utils/songinfoutils.py +54 -0
  44. musicdl/modules/utils/tidalutils.py +738 -0
  45. musicdl/modules/utils/youtubeutils.py +3606 -0
  46. musicdl/musicdl.py +184 -86
  47. musicdl-2.7.3.dist-info/LICENSE +203 -0
  48. musicdl-2.7.3.dist-info/METADATA +704 -0
  49. musicdl-2.7.3.dist-info/RECORD +53 -0
  50. {musicdl-2.1.11.dist-info → musicdl-2.7.3.dist-info}/WHEEL +5 -5
  51. musicdl-2.7.3.dist-info/entry_points.txt +2 -0
  52. musicdl/modules/sources/baiduFlac.py +0 -69
  53. musicdl/modules/sources/xiami.py +0 -104
  54. musicdl/modules/utils/downloader.py +0 -80
  55. musicdl-2.1.11.dist-info/LICENSE +0 -22
  56. musicdl-2.1.11.dist-info/METADATA +0 -82
  57. musicdl-2.1.11.dist-info/RECORD +0 -24
  58. {musicdl-2.1.11.dist-info → musicdl-2.7.3.dist-info}/top_level.txt +0 -0
  59. {musicdl-2.1.11.dist-info → musicdl-2.7.3.dist-info}/zip-safe +0 -0
@@ -0,0 +1,704 @@
1
+ Metadata-Version: 2.1
2
+ Name: musicdl
3
+ Version: 2.7.3
4
+ Summary: Musicdl: A lightweight music downloader written in pure python
5
+ Home-page: https://github.com/CharlesPikachu/musicdl
6
+ Author: Zhenchao Jin
7
+ Author-email: charlesblwx@gmail.com
8
+ License: Apache License 2.0
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: OS Independent
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: click
16
+ Requires-Dist: json-repair
17
+ Requires-Dist: prettytable
18
+ Requires-Dist: pycryptodome
19
+ Requires-Dist: orjson
20
+ Requires-Dist: requests
21
+ Requires-Dist: cryptography
22
+ Requires-Dist: pyfreeproxy
23
+ Requires-Dist: fake-useragent
24
+ Requires-Dist: pathvalidate
25
+ Requires-Dist: rich
26
+ Requires-Dist: emoji
27
+ Requires-Dist: bleach
28
+ Requires-Dist: beautifulsoup4
29
+ Requires-Dist: aigpy
30
+ Requires-Dist: av
31
+ Requires-Dist: tabulate
32
+ Requires-Dist: mutagen
33
+ Requires-Dist: ytmusicapi
34
+ Requires-Dist: nodejs-wheel
35
+ Requires-Dist: m3u8
36
+ Requires-Dist: pywidevine
37
+ Requires-Dist: tinytag
38
+
39
+ <div align="center">
40
+ <img src="https://raw.githubusercontent.com/CharlesPikachu/musicdl/master/docs/logo.png" width="600" alt="musicdl logo" />
41
+ <br />
42
+
43
+ <a href="https://musicdl.readthedocs.io/">
44
+ <img src="https://img.shields.io/badge/docs-latest-blue" alt="docs" />
45
+ </a>
46
+ <a href="https://pypi.org/project/musicdl/">
47
+ <img src="https://img.shields.io/pypi/pyversions/musicdl" alt="PyPI - Python Version" />
48
+ </a>
49
+ <a href="https://pypi.org/project/musicdl">
50
+ <img src="https://img.shields.io/pypi/v/musicdl" alt="PyPI" />
51
+ </a>
52
+ <a href="https://github.com/CharlesPikachu/musicdl/blob/master/LICENSE">
53
+ <img src="https://img.shields.io/github/license/CharlesPikachu/musicdl.svg" alt="license" />
54
+ </a>
55
+ <a href="https://pypi.org/project/musicdl/">
56
+ <img src="https://static.pepy.tech/badge/musicdl" alt="PyPI - Downloads">
57
+ </a>
58
+ <a href="https://pypi.org/project/musicdl/">
59
+ <img src="https://static.pepy.tech/badge/musicdl/month" alt="PyPI - Downloads">
60
+ </a>
61
+ <a href="https://github.com/CharlesPikachu/musicdl/issues">
62
+ <img src="https://isitmaintained.com/badge/resolution/CharlesPikachu/musicdl.svg" alt="issue resolution" />
63
+ </a>
64
+ <a href="https://github.com/CharlesPikachu/musicdl/issues">
65
+ <img src="https://isitmaintained.com/badge/open/CharlesPikachu/musicdl.svg" alt="open issues" />
66
+ </a>
67
+ </div>
68
+
69
+ <p align="center">
70
+ <a href="https://musicdl.readthedocs.io/" target="_blank"><strong>📚 Documents: musicdl.readthedocs.io</strong></a>
71
+ </p>
72
+
73
+ <div align="center">
74
+ <p>
75
+ <strong>🎧 Live Demo · MusicSquare (音乐广场)</strong><br />
76
+ <a href="https://charlespikachu.github.io/musicsquare/" target="_blank">
77
+ <img
78
+ alt="demo"
79
+ src="https://img.shields.io/badge/demo-online-brightgreen?style=for-the-badge"
80
+ />
81
+ </a> <br />
82
+ <a href="https://github.com/CharlesPikachu/musicsquare" target="_blank"><strong>🛠 Source Code (MusicSquare)</strong></a>
83
+ </p>
84
+
85
+ <p>
86
+ <em>
87
+ MusicSquare is a browser-based music playground — search, play, and download tracks directly in your browser.<br />
88
+ ⚠️ For learning and testing only: please respect copyright and the terms of each music platform.
89
+ </em>
90
+ </p>
91
+ </div>
92
+
93
+ <p align="center">
94
+ <strong>学习收获更多有趣的内容, 欢迎关注微信公众号:Charles的皮卡丘</strong>
95
+ </p>
96
+
97
+
98
+ # 🎉 What's New
99
+
100
+ - 2025-12-17: Released musicdl v2.7.3 — supports native Bilibili music search and downloads, improves the search speed of some third-party APIs, refactors the Ximalaya music platform code, and includes several other minor code optimizations.
101
+ - 2025-12-15: Released musicdl v2.7.2 — added support for jamendo and make some improvements.
102
+ - 2025-12-11: Released musicdl v2.7.1 — added support for two new sites and fixed several potential bugs.
103
+ - 2025-12-10: Released musicdl v2.7.0 — the code has been further refactored, with a large amount of redundant code removed or merged; all supported sites can now download lossless music (for some sites, you need to set your membership cookies in the command line or in the code), the search speed has been greatly optimized, and several problematic sites have been fixed.
104
+
105
+
106
+ # 🎵 Introduction
107
+
108
+ A lightweight music downloader written in pure Python. Like it? ⭐ Star the repository to stay up to date. Thanks!
109
+
110
+
111
+ # ⚠️ Disclaimer
112
+
113
+ This project is for educational use only and is not intended for commercial purposes. It interacts with publicly available web endpoints and does not host or distribute copyrighted content.
114
+ To access paid tracks, please purchase or subscribe to the relevant music service—do not use this project to bypass paywalls or DRM.
115
+ If you are a rights holder and believe this repository infringes your rights, please contact me and I will promptly address it.
116
+
117
+
118
+ # 🎧 Supported Music Client
119
+
120
+ | MusicClient (EN) | MusicClient (CN) | Search | Download | Code Snippet |
121
+ | :----: | :----: | :----: | :----: | :----: |
122
+ | [FiveSingMusicClient](https://5sing.kugou.com/index.html) | [5SING音乐](https://5sing.kugou.com/index.html) | ✓ | ✓ | [fivesing.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/fivesing.py) |
123
+ | [KugouMusicClient](http://www.kugou.com/) | [酷狗音乐](http://www.kugou.com/) | ✓ | ✓ | [kugou.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/kugou.py) |
124
+ | [KuwoMusicClient](http://www.kuwo.cn/) | [酷我音乐](http://www.kuwo.cn/) | ✓ | ✓ | [kuwo.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/kuwo.py) |
125
+ | [LizhiMusicClient](https://www.lizhi.fm/) | [荔枝FM](https://www.lizhi.fm/) | ✓ | ✓ | [lizhi.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/lizhi.py) |
126
+ | [MiguMusicClient](https://music.migu.cn/v5/#/musicLibrary) | [咪咕音乐](https://music.migu.cn/v5/#/musicLibrary) | ✓ | ✓ | [migu.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/migu.py) |
127
+ | [NeteaseMusicClient](https://music.163.com/) | [网易云音乐](https://music.163.com/) | ✓ | ✓ | [netease.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/netease.py) |
128
+ | [QianqianMusicClient](http://music.taihe.com/) | [千千音乐](http://music.taihe.com/) | ✓ | ✓ | [qianqian.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/qianqian.py) |
129
+ | [QQMusicClient](https://y.qq.com/) | [QQ音乐](https://y.qq.com/) | ✓ | ✓ | [qq.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/qq.py) |
130
+ | [XimalayaMusicClient](https://www.ximalaya.com/) | [喜马拉雅](https://www.ximalaya.com/) | ✓ | ✓ | [ximalaya.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/ximalaya.py) |
131
+ | [JooxMusicClient](https://www.joox.com/intl) | [JOOX (QQ音乐海外版)](https://www.joox.com/intl) | ✓ | ✓ | [joox.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/joox.py) |
132
+ | [TIDALMusicClient](https://tidal.com/) | [TIDAL (提供HiFi音质的流媒体平台)](https://tidal.com/) | ✓ | ✓ | [tidal.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/tidal.py) |
133
+ | [YouTubeMusicClient](https://music.youtube.com/) | [油管音乐](https://music.youtube.com/) | ✓ | ✓ | [youtube.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/youtube.py) |
134
+ | [AppleMusicClient](https://music.apple.com/) | [苹果音乐](https://music.apple.com/) | ✓ | ✓ | [apple.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/apple.py) |
135
+ | [MP3JuiceMusicClient](https://mp3juice.co/) | [MP3 Juice (SoundCloud+YouTube源)](https://mp3juice.co/) | ✓ | ✓ | [mp3juice.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/mp3juice.py) |
136
+ | [MituMusicClient](https://www.qqmp3.vip/) | [米兔音乐](https://www.qqmp3.vip/) | ✓ | ✓ | [mitu.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/mitu.py) |
137
+ | [GequbaoMusicClient](https://www.gequbao.com/) | [歌曲宝](https://www.gequbao.com/) | ✓ | ✓ | [gequbao.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/gequbao.py) |
138
+ | [YinyuedaoMusicClient](https://1mp3.top/) | [音乐岛](https://1mp3.top/) | ✓ | ✓ | [yinyuedao.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/yinyuedao.py) |
139
+ | [BuguyyMusicClient](https://buguyy.top/) | [布谷音乐](https://buguyy.top/) | ✓ | ✓ | [buguyy.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/buguyy.py) |
140
+ | [FangpiMusicClient](https://www.fangpi.net/) | [放屁音乐](https://www.fangpi.net/) | ✓ | ✓ | [fangpi.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/fangpi.py) |
141
+ | [GDStudioMusicClient](https://music.gdstudio.xyz/) | [GD音乐台 (Spotify, Qobuz, B站等10个音乐源)](https://music.gdstudio.xyz/) | ✓ | ✓ | [gdstudio.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/gdstudio.py) |
142
+ | [JamendoMusicClient](https://www.jamendo.com/) | [简音乐 (欧美流行音乐)](https://www.jamendo.com/) | ✓ | ✓ | [jamendo.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/jamendo.py) |
143
+ | [BilibiliMusicClient](https://www.bilibili.com/audio/home/?type=9) | [Bilibili音乐](https://www.bilibili.com/audio/home/?type=9) | ✓ | ✓ | [bilibili.py](https://github.com/CharlesPikachu/musicdl/blob/master/musicdl/modules/sources/bilibili.py) |
144
+
145
+
146
+ # 🧪 Playground
147
+
148
+ Here are some projects built on top of musicdl,
149
+
150
+ | Project (EN) | Project (CN) | WeChat Article | Project Location |
151
+ | :----: | :----: | :----: | :----: |
152
+ | Music downloader GUI | 音乐下载器GUI界面 | [click](https://mp.weixin.qq.com/s/fN1ORyI6lzQFqxf6Zk1oIg) | [musicdlgui](https://github.com/CharlesPikachu/musicdl/tree/master/examples/musicdlgui) |
153
+ | Singer lyrics analysis | 歌手歌词分析 | [click](https://mp.weixin.qq.com/s/I8Dy7CoM2ThnSpjoUaPtig) | [singerlyricsanalysis](https://github.com/CharlesPikachu/musicdl/tree/master/examples/singerlyricsanalysis) |
154
+ | Lyric-based song snippet retrieval | 歌词获取歌曲片段 | [click](https://mp.weixin.qq.com/s/Vmc1IhuhMJ6C5vBwBe43Pg) | [searchlyrics](https://github.com/CharlesPikachu/musicdl/tree/master/examples/searchlyrics) |
155
+
156
+ For example, the Music Downloader GUI looks/works like this,
157
+
158
+ <div align="center">
159
+ <img src="https://raw.githubusercontent.com/CharlesPikachu/musicdl/master/examples/musicdlgui/screenshot.png" width="600" alt="musicdl logo" />
160
+ </div>
161
+
162
+
163
+ # 📦 Install
164
+
165
+ You have three installation methods to choose from,
166
+
167
+ ```sh
168
+ # from pip
169
+ pip install musicdl
170
+ # from github repo method-1
171
+ pip install git+https://github.com/CharlesPikachu/musicdl.git@master
172
+ # from github repo method-2
173
+ git clone https://github.com/CharlesPikachu/musicdl.git
174
+ cd musicdl
175
+ python setup.py install
176
+ ```
177
+
178
+ Some of the music downloaders supported by `musicdl` require additional CLI tools to function properly, mainly for decrypting encrypted search/download requests and audio files.
179
+ These CLI tools include [FFmpeg](https://www.ffmpeg.org/) and [Node.js](https://nodejs.org/en). Specifically,
180
+
181
+ - [FFmpeg](https://www.ffmpeg.org/): At the moment, only `TIDALMusicClient` and `AppleMusicClient` depends on FFmpeg for audio file decoding.
182
+ If you don’t need to use `TIDALMusicClient` and `AppleMusicClient` when working with `musicdl`, you don’t need to install FFmpeg.
183
+ After installing it, you should run the following command in a terminal (Command Prompt / PowerShell on Windows, Terminal on macOS/Linux) to check whether FFmpeg is on your system `PATH`:
184
+ ```bash
185
+ ffmpeg -version
186
+ ```
187
+ If FFmpeg is installed correctly and on your `PATH`, this command will print the FFmpeg version information (*e.g.*, a few lines starting with `ffmpeg version ...`).
188
+ If you see an error like `command not found` or `'ffmpeg' is not recognized as an internal or external command`, then FFmpeg is either not installed or not added to your `PATH`.
189
+
190
+ - [Node.js](https://nodejs.org/en): Currently, only `YouTubeMusicClient` in `musicdl` depends on Node.js, so if you don’t need `YouTubeMusicClient`, you don’t have to install Node.js.
191
+ Similar to FFmpeg, after installing Node.js, you should run the following command to check whether Node.js is on your system `PATH`:
192
+ ```bash
193
+ node -v (npm -v)
194
+ ```
195
+ If Node.js is installed correctly, `node -v` will print the Node.js version (*e.g.*, `v22.11.0`), and `npm -v` will print the npm version.
196
+ If you see a similar `command not found` / `not recognized` error, Node.js is not installed correctly or not available on your `PATH`.
197
+
198
+ - [GPAC](https://gpac.io/downloads/gpac-nightly-builds/): GPAC is an open-source multimedia framework for packaging, processing, and streaming formats like MP4, DASH, and HLS.
199
+ In musicdl, this library is mainly used for handling `AppleMusicClient` audio streams, so if you don’t need `AppleMusicClient` support, you don’t need to install it.
200
+ After installing GPAC, you need to make sure all of its executables are available in your system `PATH`.
201
+ A quick way to verify this is that you should be able to run
202
+ ```bash
203
+ python -c "import shutil; print(shutil.which('MP4Box'))"
204
+ ```
205
+ in Command Prompt and get the full path without an error.
206
+
207
+ - [Bento4](https://www.bento4.com/downloads/): Bento4 is an open-source C++ toolkit for reading, writing, inspecting, and packaging MP4 files and related multimedia formats.
208
+ In musicdl, this library is mainly used for handling `AppleMusicClient` audio streams, so if you don’t need `AppleMusicClient` support, you don’t need to install it.
209
+ After installing Bento4, you need to make sure all of its executables are available in your system `PATH`.
210
+ A quick way to verify this is that you should be able to run
211
+ ```bash
212
+ python -c "import shutil; print(shutil.which('mp4decrypt'))"
213
+ ```
214
+ in Command Prompt and get the full path without an error.
215
+
216
+ - [N_m3u8DL-RE](https://github.com/nilaoda/N_m3u8DL-RE): N_m3u8DL-RE is a powerful open-source command-line tool for downloading, decrypting, and muxing HLS/DASH (m3u8/mpd) streaming media into local video files.
217
+ In musicdl, this library is mainly used for handling `AppleMusicClient` audio streams, so if you don’t need `AppleMusicClient` support, you don’t need to install it.
218
+ After installing N_m3u8DL-RE, you need to make sure all of its executables are available in your system `PATH`.
219
+ A quick way to verify this is that you should be able to run
220
+ ```bash
221
+ python -c "import shutil; print(shutil.which('N_m3u8DL-RE'))"
222
+ ```
223
+ in Command Prompt and get the full path without an error.
224
+
225
+
226
+ # 🚀 Quick Start
227
+
228
+ #### Typical Examples
229
+
230
+ Here, we provide some common musicdl use cases to help you quickly get started with the tool.
231
+
232
+ If you want the quickest way to run musicdl to verify that your environment meets its basic requirements and that musicdl has been installed successfully, you can write and run the following code,
233
+
234
+ ```python
235
+ from musicdl import musicdl
236
+
237
+ music_client = musicdl.MusicClient(music_sources=['MiguMusicClient', 'NeteaseMusicClient', 'QQMusicClient', 'KugouMusicClient', 'KuwoMusicClient', 'QianqianMusicClient'])
238
+ music_client.startcmdui()
239
+ ```
240
+
241
+ The above code runs musicdl using `MiguMusicClient`, `NeteaseMusicClient`, `QQMusicClient`, `KugouMusicClient`, `KuwoMusicClient` and `QianqianMusicClient` as both the search sources and download sources.
242
+
243
+ Of course, you can also run musicdl by entering the following equivalent command directly in the command line,
244
+
245
+ ```bash
246
+ musicdl -m NeteaseMusicClient,MiguMusicClient,QQMusicClient,KugouMusicClient,KuwoMusicClient,QianqianMusicClient
247
+ ```
248
+
249
+ The demonstration is as follows,
250
+
251
+ <div align="center">
252
+ <div>
253
+ <img src="https://github.com/CharlesPikachu/musicdl/raw/master/docs/screenshot.png" width="600"/>
254
+ </div>
255
+ <div>
256
+ <img src="https://github.com/CharlesPikachu/musicdl/raw/master/docs/screenshot.gif" width="600"/>
257
+ </div>
258
+ </div>
259
+ <br />
260
+
261
+ You can also use `musicdl --help` to see the detailed usage of the musicdl command-line tool, as follows:
262
+
263
+ ```bash
264
+ Usage: musicdl [OPTIONS]
265
+
266
+ Options:
267
+ --version Show the version and exit.
268
+ -k, --keyword TEXT The keywords for the music search. If left
269
+ empty, an interactive terminal will open
270
+ automatically.
271
+ -m, --music-sources, --music_sources TEXT
272
+ The music search and download sources.
273
+ [default: MiguMusicClient,NeteaseMusicClient
274
+ ,QQMusicClient,KugouMusicClient,KuwoMusicCli
275
+ ent,QianqianMusicClient]
276
+ -i, --init-music-clients-cfg, --init_music_clients_cfg TEXT
277
+ Config such as `work_dir` for each music
278
+ client as a JSON string.
279
+ -r, --requests-overrides, --requests_overrides TEXT
280
+ Requests.get / Requests.post kwargs such as
281
+ `headers` and `proxies` for each music
282
+ client as a JSON string.
283
+ -c, --clients-threadings, --clients_threadings TEXT
284
+ Number of threads used for each music client
285
+ as a JSON string.
286
+ -s, --search-rules, --search_rules TEXT
287
+ Search rules for each music client as a JSON
288
+ string.
289
+ --help Show this message and exit.
290
+ ```
291
+
292
+ If you want to change the download path for the music files, you can write the following code:
293
+
294
+ ```python
295
+ from musicdl import musicdl
296
+
297
+ init_music_clients_cfg = dict()
298
+ init_music_clients_cfg['MiguMusicClient'] = {'work_dir': 'migu'}
299
+ init_music_clients_cfg['NeteaseMusicClient'] = {'work_dir': 'netease'}
300
+ init_music_clients_cfg['QQMusicClient'] = {'work_dir': 'qq'}
301
+ music_client = musicdl.MusicClient(music_sources=['MiguMusicClient', 'NeteaseMusicClient', 'QQMusicClient'])
302
+ music_client.startcmdui()
303
+ ```
304
+
305
+ Alternatively, you can equivalently run the following command directly in the command line:
306
+
307
+ ```bash
308
+ musicdl -m NeteaseMusicClient,MiguMusicClient,QQMusicClient -i "{'MiguMusicClient': {'work_dir': 'migu'}, {'NeteaseMusicClient': {'work_dir': 'netease'}, {'QQMusicClient': {'work_dir': 'qq'}}"
309
+ ```
310
+
311
+ If you are a VIP user on a particular music platform, you can pass the cookies from your logged-in web session on that platform to musicdl to improve the quality of song search and downloads.
312
+ Specifically, for example, if you have a membership on `QQMusicClient`, your code can be written as follows:
313
+
314
+ ```python
315
+ from musicdl import musicdl
316
+
317
+ your_vip_cookies_with_str_or_dict_format = ""
318
+ init_music_clients_cfg = dict()
319
+ init_music_clients_cfg['QQMusicClient'] = {'default_search_cookies': your_vip_cookies_with_str_or_dict_format, 'default_download_cookies': your_vip_cookies_with_str_or_dict_format}
320
+ music_client = musicdl.MusicClient(music_sources=['NeteaseMusicClient', 'QQMusicClient'], init_music_clients_cfg=init_music_clients_cfg)
321
+ music_client.startcmdui()
322
+ ```
323
+
324
+ Of course, you can also achieve the same effect by running the following command directly in the command line:
325
+
326
+ ```bash
327
+ musicdl -m NeteaseMusicClient,QQMusicClient -i "{'QQMusicClient': {'default_search_cookies': your_vip_cookies_with_str_or_dict_format, 'default_download_cookies': your_vip_cookies_with_str_or_dict_format}}"
328
+ ```
329
+
330
+ If you want to search for more songs on a specific music platform (*e.g.*, `QQMusicClient`), you can do the following:
331
+
332
+ ```python
333
+ from musicdl import musicdl
334
+
335
+ init_music_clients_cfg = dict()
336
+ init_music_clients_cfg['QQMusicClient'] = {'search_size_per_source': 20}
337
+ music_client = musicdl.MusicClient(music_sources=['NeteaseMusicClient', 'QQMusicClient'], init_music_clients_cfg=init_music_clients_cfg)
338
+ music_client.startcmdui()
339
+ ```
340
+
341
+ Or enter the following in the command line:
342
+
343
+ ```bash
344
+ musicdl -m NeteaseMusicClient,QQMusicClient -i "{'QQMusicClient': {'search_size_per_source': 20}}"
345
+ ```
346
+
347
+ In this way, you can see up to 20 search results from `QQMusicClient`.
348
+
349
+ If you want to use the [pyfreeproxy](https://github.com/CharlesPikachu/freeproxy) library to automatically leverage free online proxies for music search and download, you can do it as follows:
350
+
351
+ ```python
352
+ from musicdl import musicdl
353
+
354
+ init_music_clients_cfg = dict()
355
+ init_music_clients_cfg['NeteaseMusicClient'] = {'search_size_per_source': 1000, 'auto_set_proxies': True, 'proxy_sources': ['QiyunipProxiedSession', 'ProxydailyProxiedSession']}
356
+ music_client = musicdl.MusicClient(music_sources=['NeteaseMusicClient'], init_music_clients_cfg=init_music_clients_cfg)
357
+ music_client.startcmdui()
358
+ ```
359
+
360
+ The command-line usage is similar:
361
+
362
+ ```bash
363
+ musicdl -m NeteaseMusicClient -i "{'NeteaseMusicClient': {'search_size_per_source': 1000, 'auto_set_proxies': True, 'proxy_sources': ['QiyunipProxiedSession', 'ProxydailyProxiedSession']}}"
364
+ ```
365
+
366
+ #### Separating Search and Download Results
367
+
368
+ You can also call the `.search` and `.download` interfaces of musicdl separately to inspect its intermediate results or perform secondary development,
369
+
370
+ ```python
371
+ from musicdl import musicdl
372
+
373
+ # instance
374
+ music_client = musicdl.MusicClient(music_sources=['NeteaseMusicClient'])
375
+ # search
376
+ search_results = music_client.search(keyword='尾戒')
377
+ print(search_results)
378
+ song_infos = []
379
+ for song_infos_per_source in list(search_results.values()):
380
+ song_infos.extend(song_infos_per_source)
381
+ # download
382
+ music_client.download(song_infos=song_infos)
383
+ ```
384
+
385
+ You can also choose not to use the unified `MusicClient` interface and instead directly import the definition class for a specific music platform for secondary development.
386
+ For example, to import the definition class for `NeteaseMusicClient`:
387
+
388
+ ```python
389
+ from musicdl.modules.sources import NeteaseMusicClient
390
+
391
+ netease_music_client = NeteaseMusicClient()
392
+ # search
393
+ search_results = netease_music_client.search(keyword='那些年')
394
+ print(search_results)
395
+ # download
396
+ netease_music_client.download(song_infos=search_results)
397
+ ```
398
+
399
+ All supported classes can be obtained by printing `MusicClientBuilder.REGISTERED_MODULES`, *e.g*,
400
+
401
+ ```python
402
+ from musicdl.modules import MusicClientBuilder
403
+
404
+ print(MusicClientBuilder.REGISTERED_MODULES)
405
+ ```
406
+
407
+ #### WhisperLRC
408
+
409
+ On some music platforms, it’s not possible to obtain the lyric files corresponding to the audio, *e.g*, `XimalayaMusicClient` and `MituMusicClient`.
410
+ To handle this, we provide a faster-whisper interface that can automatically generate lyrics for tracks whose lyrics are unavailable for download.
411
+
412
+ For audio files that have already been downloaded, you can use the following invocation to automatically generate lyrics for the local file,
413
+
414
+ ```python
415
+ from musicdl.modules import WhisperLRC
416
+
417
+ your_local_music_file_path = 'xxx.flac'
418
+ WhisperLRC(model_size_or_path='base').fromfilepath(your_local_music_file_path)
419
+ ```
420
+
421
+ The available `model_size_or_path`, ordered from smallest to largest, are:
422
+
423
+ ```python
424
+ tiny, tiny.en, base, base.en, small, small.en, distil-small.en, medium, medium.en, distil-medium.en, large-v1, large-v2, large-v3, large, distil-large-v2, distil-large-v3, large-v3-turbo, turbo
425
+ ```
426
+
427
+ In general, the larger the model, the better the generated lyrics (transcription/translation) will be, but this also means it will take longer to run.
428
+
429
+ If you want to automatically generate lyric files during the download process,
430
+ you can set the environment variable `ENABLE_WHISPERLRC=True` (for example, by running `export ENABLE_WHISPERLRC=True`).
431
+ However, this is generally not recommended, as it may cause a single run of the program to take a very long time,
432
+ unless you set `search_size_per_source` to `1` and `model_size_or_path` to `tiny`.
433
+
434
+ Of course, you can also directly call `.fromurl` to generate a lyrics file for a song given by a direct URL:
435
+
436
+ ```python
437
+ from musicdl.modules import WhisperLRC
438
+
439
+ music_file_link = ''
440
+ WhisperLRC(model_size_or_path='base').fromurl(music_link)
441
+ ```
442
+
443
+ #### Scenarios Where Quark Netdisk Login Cookies Are Required
444
+
445
+ Some websites share high-quality or lossless music files via [Quark Netdisk](https://pan.quark.cn/) links, for example, `MituMusicClient`, `GequbaoMusicClient`, `YinyuedaoMusicClient`, and `BuguyyMusicClient`.
446
+
447
+ If you want to download high-quality or lossless audio files from these music platforms, you need to provide the cookies from your logged-in Quark Netdisk web session when calling musicdl.
448
+ For example, you can do the following:
449
+
450
+ ```python
451
+ from musicdl import musicdl
452
+
453
+ init_music_clients_cfg = dict()
454
+ init_music_clients_cfg['YinyuedaoMusicClient'] = {'quark_parser_config': {'cookies': your_cookies_with_str_or_dict_format}}
455
+ init_music_clients_cfg['GequbaoMusicClient'] = {'quark_parser_config': {'cookies': your_cookies_with_str_or_dict_format}}
456
+ init_music_clients_cfg['MituMusicClient'] = {'quark_parser_config': {'cookies': your_cookies_with_str_or_dict_format}}
457
+ init_music_clients_cfg['BuguyyMusicClient'] = {'quark_parser_config': {'cookies': your_cookies_with_str_or_dict_format}}
458
+
459
+ music_client = musicdl.MusicClient(music_sources=['MituMusicClient', 'YinyuedaoMusicClient', 'GequbaoMusicClient', 'BuguyyMusicClient'], init_music_clients_cfg=init_music_clients_cfg)
460
+ music_client.startcmdui()
461
+ ```
462
+
463
+ Please note that musicdl does not provide any speed-limit bypass for Quark Netdisk.
464
+ If the cookies you supply belong to a non-VIP Quark account, the download speed may be limited to only a few hundred KB/s.
465
+
466
+ #### TIDAL High-Quality Music Download
467
+
468
+ If you want to download lossless-quality music from [TIDAL](https://tidal.com/), you need to make sure that [PyAV](https://github.com/PyAV-Org/PyAV) is available or that [FFmpeg](https://www.ffmpeg.org/) is in your environment variables,
469
+ and then use musicdl as follows:
470
+
471
+ ```python
472
+ from musicdl import musicdl
473
+
474
+ music_client = musicdl.MusicClient(music_sources=['TIDALMusicClient'])
475
+ music_client.startcmdui()
476
+ ```
477
+
478
+ Running the above code will automatically open your default browser and prompt you to log in to TIDAL. Once you have successfully logged in, musicdl will automatically capture the tokens from your session to support subsequent music search and download.
479
+
480
+ If you are running on a remote server where the browser cannot be opened automatically, you can instead copy the URL printed in the terminal and open it in your local browser to complete the login process.
481
+
482
+ Note that if the account you log in with is not a paid TIDAL subscription, you will still be unable to download the full lossless audio files.
483
+
484
+ #### YouTube Music Download
485
+
486
+ If you want to use musicdl to search for and download music from `YouTubeMusicClient`, you must have [Node.js](https://nodejs.org/en) installed, *e.g.*, on Linux, you can install Node.js using the following script:
487
+
488
+ ```bash
489
+ #!/usr/bin/env bash
490
+ set -e
491
+
492
+ # Install nvm (Node Version Manager)
493
+ curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
494
+
495
+ # Load nvm for this script
496
+ export NVM_DIR="$HOME/.nvm"
497
+ [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
498
+
499
+ # Install and use latest LTS Node.js
500
+ nvm install --lts
501
+ nvm use --lts
502
+
503
+ # Print versions
504
+ node -v
505
+ npm -v
506
+ ```
507
+
508
+ On macOS, you can install Node.js using the following script:
509
+
510
+ ```bash
511
+ #!/usr/bin/env bash
512
+ set -e
513
+
514
+ # Install nvm (Node Version Manager)
515
+ curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
516
+
517
+ # Load nvm for this script
518
+ export NVM_DIR="$HOME/.nvm"
519
+ [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
520
+
521
+ # Install and use latest LTS Node.js
522
+ nvm install --lts
523
+ nvm use --lts
524
+
525
+ # Print versions
526
+ node -v
527
+ npm -v
528
+ ```
529
+
530
+ On Windows (PowerShell), you can install Node.js using the following script:
531
+
532
+ ```bash
533
+ # Install Node.js LTS via winget
534
+ winget install --id OpenJS.NodeJS.LTS -e --source winget
535
+
536
+ # Print hint for version check
537
+ Write-Output ""
538
+ Write-Output "Please reopen PowerShell and run:"
539
+ Write-Output " node -v"
540
+ Write-Output " npm -v"
541
+ ```
542
+
543
+ A simple example of searching for and downloading music from `YouTubeMusicClient` is as follows,
544
+
545
+ ```python
546
+ from musicdl import musicdl
547
+
548
+ music_client = musicdl.MusicClient(music_sources=['YouTubeMusicClient'])
549
+ music_client.startcmdui()
550
+ ```
551
+
552
+ #### Apple Music Download
553
+
554
+ `AppleMusicClient` works similarly to `TIDALMusicClient`:
555
+ if you are not an Apple Music subscriber or you have not manually set in musicdl the cookies (*i.e.*, the `media-user-token`) from your logged-in Apple Music session in the browser,
556
+ you will only be able to download a partial segment of each track (usually 30–90 seconds).
557
+
558
+ If you need to download the full audio and lyrics for each song, you can configure musicdl as follows:
559
+
560
+ ```python
561
+ from musicdl import musicdl
562
+
563
+ cookies = {'media-user-token': xxx}
564
+ init_music_clients_cfg = {'AppleMusicClient': {'default_search_cookies': cookies, 'default_download_cookies': cookies, 'search_size_per_source': 10}}
565
+ music_client = musicdl.MusicClient(music_sources=['AppleMusicClient'], init_music_clients_cfg=init_music_clients_cfg)
566
+ music_client.startcmdui()
567
+ ```
568
+
569
+ It is important to note that to download Apple Music audio files (including decryption) using musicdl, you must properly install [GPAC](https://gpac.io/downloads/gpac-nightly-builds/),
570
+ [Bento4](https://www.bento4.com/downloads/) and [N_m3u8DL-RE](https://github.com/nilaoda/N_m3u8DL-RE).
571
+
572
+ #### GD Studio Music Download
573
+
574
+ We’ve added `GDStudioMusicClient` to musicdl as a practical solution for users who are on a tight budget or who find it difficult to configure extra command-line tools/arguments for musicdl.
575
+ With only the basic installation of musicdl, you can search for and download high-quality music files from the following music platforms:
576
+
577
+ | Source (EN) | Source (CN) | Official Websites | `allowed_music_sources` |
578
+ | ----------------- | ------------------- | ----------------------------------- | ------------------- |
579
+ | Spotify | Spotify | https://www.spotify.com | `spotify` |
580
+ | Tencent (QQ Music) | QQ音乐 | https://y.qq.com | `tencent` |
581
+ | NetEase Cloud Music | 网易云音乐 | https://music.163.com | `netease` |
582
+ | Kuwo | 酷我音乐 | https://www.kuwo.cn | `kuwo` |
583
+ | TIDAL | TIDAL | https://tidal.com | `tidal` |
584
+ | Qobuz | Qobuz | https://www.qobuz.com | `qobuz` |
585
+ | JOOX | JOOX | https://www.joox.com | `joox` |
586
+ | Bilibili | 哔哩哔哩 | https://www.bilibili.com | `bilibili` |
587
+ | Apple Music | 苹果音乐 | https://www.apple.com/apple-music/ | `apple` |
588
+ | YouTube Music | 油管音乐 | https://music.youtube.com | `ytmusic` |
589
+
590
+ Specifically, you just need to write and run a few lines of code like this:
591
+
592
+ ```python
593
+ from musicdl import musicdl
594
+
595
+ music_client = musicdl.MusicClient(music_sources=['GDStudioMusicClient'])
596
+ music_client.startcmdui()
597
+ ```
598
+
599
+ Or, equivalently, run the following command in the command line:
600
+
601
+ ```bash
602
+ musicdl -m GDStudioMusicClient
603
+ ```
604
+
605
+ By default, the above code will search for and download music from nine music platforms, excluding YouTube Music.
606
+ The screenshot of the running result is as follows:
607
+
608
+ <div align="center">
609
+ <div>
610
+ <img src="https://github.com/CharlesPikachu/musicdl/raw/master/docs/gdstudioscreenshot.png" width="600"/>
611
+ </div>
612
+ </div>
613
+ <br />
614
+
615
+ However, please note that this way of running is not very stable (*e.g.*, some sources may fail to find any valid songs) and is likely to exceed the limit on the number of requests per minute allowed for a single IP by `GDStudioMusicClient`.
616
+ If you still wish to perform a full-platform search, we recommend modifying the default arguments as follows:
617
+
618
+ ```python
619
+ from musicdl import musicdl
620
+
621
+ init_music_clients_cfg = {'GDStudioMusicClient': {'search_size_per_source': 2}}
622
+ music_client = musicdl.MusicClient(music_sources=['GDStudioMusicClient'], init_music_clients_cfg=init_music_clients_cfg)
623
+ music_client.startcmdui()
624
+ ```
625
+
626
+ The equivalent command in the command line is:
627
+
628
+ ```bash
629
+ musicdl -m GDStudioMusicClient -i "{'GDStudioMusicClient': {'search_size_per_source': 2}}"
630
+ ```
631
+
632
+ Or, an even better option is to manually specify a few platforms where you believe your desired music files are likely to be found, for example:
633
+
634
+ ```python
635
+ from musicdl import musicdl
636
+
637
+ # allowed_music_sources can be set to any subset (i.e., any combination) of ['spotify', 'tencent', 'netease', 'kuwo', 'tidal', 'qobuz', 'joox', 'bilibili', 'apple', 'ytmusic']
638
+ init_music_clients_cfg = {'GDStudioMusicClient': {'search_size_per_source': 5, 'allowed_music_sources': ['spotify', 'qobuz', 'tidal', 'apple']}}
639
+ music_client = musicdl.MusicClient(music_sources=['GDStudioMusicClient'], init_music_clients_cfg=init_music_clients_cfg, clients_threadings=clients_threadings)
640
+ music_client.startcmdui()
641
+ ```
642
+
643
+ The way to run it from the command line is similar:
644
+
645
+ ```bash
646
+ musicdl -m GDStudioMusicClient -i "{'GDStudioMusicClient': {'search_size_per_source': 5, 'allowed_music_sources': ['spotify', 'qobuz', 'tidal', 'apple']}}"
647
+ ```
648
+
649
+ For more details, please refer to the [official documentation](https://musicdl.readthedocs.io/).
650
+
651
+
652
+ # ⭐ Recommended Projects
653
+
654
+ - [Games](https://github.com/CharlesPikachu/Games): Create interesting games in pure python.
655
+ - [DecryptLogin](https://github.com/CharlesPikachu/DecryptLogin): APIs for loginning some websites by using requests.
656
+ - [Musicdl](https://github.com/CharlesPikachu/musicdl): A lightweight music downloader written in pure python.
657
+ - [Videodl](https://github.com/CharlesPikachu/videodl): A lightweight video downloader written in pure python.
658
+ - [Pytools](https://github.com/CharlesPikachu/pytools): Some useful tools written in pure python.
659
+ - [PikachuWeChat](https://github.com/CharlesPikachu/pikachuwechat): Play WeChat with itchat-uos.
660
+ - [Pydrawing](https://github.com/CharlesPikachu/pydrawing): Beautify your image or video.
661
+ - [ImageCompressor](https://github.com/CharlesPikachu/imagecompressor): Image compressors written in pure python.
662
+ - [FreeProxy](https://github.com/CharlesPikachu/freeproxy): Collecting free proxies from internet.
663
+ - [Paperdl](https://github.com/CharlesPikachu/paperdl): Search and download paper from specific websites.
664
+ - [Sciogovterminal](https://github.com/CharlesPikachu/sciogovterminal): Browse "The State Council Information Office of the People's Republic of China" in the terminal.
665
+ - [CodeFree](https://github.com/CharlesPikachu/codefree): Make no code a reality.
666
+ - [DeepLearningToys](https://github.com/CharlesPikachu/deeplearningtoys): Some deep learning toys implemented in pytorch.
667
+ - [DataAnalysis](https://github.com/CharlesPikachu/dataanalysis): Some data analysis projects in charles_pikachu.
668
+ - [Imagedl](https://github.com/CharlesPikachu/imagedl): Search and download images from specific websites.
669
+ - [Pytoydl](https://github.com/CharlesPikachu/pytoydl): A toy deep learning framework built upon numpy.
670
+ - [NovelDL](https://github.com/CharlesPikachu/noveldl): Search and download novels from some specific websites.
671
+
672
+
673
+ # 📚 Citation
674
+
675
+ If you use this project in your research, please cite the repository.
676
+
677
+ ```
678
+ @misc{musicdl2020,
679
+ author = {Zhenchao Jin},
680
+ title = {Musicdl: A lightweight music downloader written in pure python},
681
+ year = {2020},
682
+ publisher = {GitHub},
683
+ journal = {GitHub repository},
684
+ howpublished = {\url{https://github.com/CharlesPikachu/musicdl}},
685
+ }
686
+ ```
687
+
688
+
689
+ # 🌟 Star History
690
+
691
+ [![Star History Chart](https://api.star-history.com/svg?repos=CharlesPikachu/musicdl&type=date&legend=top-left)](https://www.star-history.com/#CharlesPikachu/musicdl&type=date&legend=top-left)
692
+
693
+
694
+ # ☕ Appreciation (赞赏 / 打赏)
695
+
696
+ | WeChat Appreciation QR Code (微信赞赏码) | Alipay Appreciation QR Code (支付宝赞赏码) |
697
+ | :--------: | :----------: |
698
+ | <img src="https://raw.githubusercontent.com/CharlesPikachu/musicdl/master/.github/pictures/wechat_reward.jpg" width="260" /> | <img src="https://raw.githubusercontent.com/CharlesPikachu/musicdl/master/.github/pictures/alipay_reward.png" width="260" /> |
699
+
700
+
701
+ # 📢 WeChat Official Account (微信公众号):
702
+
703
+ Charles的皮卡丘 (*Charles_pikachu*)
704
+ ![img](https://raw.githubusercontent.com/CharlesPikachu/musicdl/master/docs/pikachu.jpg)