"Python開源:netease-dl -基于命令行的網易云音樂下載器"

fvbd8769 7年前發布 | 63K 次閱讀 網易 Python開發

一個基于命令行的網易云音樂下載器。

  • 安裝
    • Git clone最新版
    • PyPi安裝
  • 功能特性
  • 使用
    • 下載單首歌曲
    • 下載一個歌手的50首熱門歌曲
    • 下載一張唱片的所有歌曲
    • 下載一張歌單的所有歌曲
    • 下載指定用戶的公開歌單
    • 下載個人收藏以及創建的歌單
  • Contact

安裝

Git clone最新版

$ git clone https://github.com/ziwenxie/netease-dl
$ python3 setup.py install

PyPi安裝

$ pip3 install netease-dl

p.s: 目前僅支持Python3.x,Python2.x以后也會支持。

功能特性

通過 --help 可以查看到所有的功能特性,包括下載單首歌曲,一張唱片的所有歌曲,一個歌手的前50首熱門歌曲,一張歌單的所有歌曲,一個用戶的公開歌單以及登錄后可下載個人的私有歌單。

$ netease-dl --help
Usage: netease-dl [OPTIONS] COMMAND [ARGS]...

  A command tool to download NetEase-Music's songs.

Options:
  -t, --timeout INTEGER  Time to wait before giving up, in seconds.
  -p, --proxy TEXT       Use the specified HTTP/HTTPS/SOCKS proxy.
  -o, --output PATH      Specify the storage path.
  -q, --quiet            Automatically select the best one.
  -l, --lyric            Download lyric.
  -a, --again            Login Again.
  --help                 Show this message and exit.

Commands:
  album     Download a album's songs by name or id.
  artist    Download a artist's hot songs by name or id.
  me        Download my playlists.
  playlist  Download a playlist's songs by id.
  song      Download a song by name or id.
  user      Download a user's playlists by id.

使用

下載單首歌曲

使用 song 命令,在后面通過 --name 或者 -n 選項來指定歌曲的名字:

$ netease-dl song --name 成都
+----------+----------------------------+-------------+
| Sequence |         Song Name          | Artist Name |
+----------+----------------------------+-------------+
|    1     |            成都             |     趙雷    |
...
+----------+----------------------------+-------------+
Select one song [1]:
Downlaoding 成都 12831kb  [####################################]  100%

上面會返回10條搜索結果,可以在 song 命令前面加一個 --quiet , netease-dl 會自動匹配第一個返回的結果:

$ netease-dl --quiet song --name 成都
Downlaoding 成都 12831kb  [####################################]  100%

如果知道歌曲id的話,也可以直接使用 --id 或者 -i 選項來指定:

$ netease-dl song --id 436514312
Downlaoding 成都 12831kb  [####################################]  100%

netease-dl 的所有子命令所支持的特性都可以通過在子命令后面加一個 --help 選項來查看:

$ netease-dl song --help
Usage: netease-dl song [OPTIONS]

  Download a song by name or id.

Options:
  -n, --name TEXT   Song name.
  -i, --id INTEGER  Song id.
  --help            Show this message and exit.

下載一個歌手的50首熱門歌曲

使用 artist 命令,并且在后面通過 --name 或者 -n 選項來指定歌手的姓名:

$ netease-dl artist --name 陳奕迅
Downlaoding 陪你度過漫長歲月 9471kb  [####################################]  100%
Downlaoding 不要說話 11149kb  [####################################]  100%
...
Cost 215s

和上面下載歌曲的時候一樣,也可以使用 --quiet 和 --id ,下面也是一樣的原理,接下來我就不重復了。

下載一張唱片的所有歌曲

使用 album 命令,后面接 --name 或者 -n 選項來指定唱片的名字:

$ netease-dl album --name 范特西
+----------+-------------------+-----------------+
| Sequence |     Album Name    |   Artist Name   |
+----------+-------------------+-----------------+
|    1     |       范特西       |      周杰倫      |
...
+----------+-------------------+-----------------+
Select one album [1]:
Downlaoding 愛在西元前 3661kb  [####################################]  100%
Downlaoding 爸我回來了 3682kb  [####################################]  100%
Downlaoding 簡單愛 4235kb  [####################################]  100%
...
Cost 24s

下載一張歌單的所有歌曲

使用 playlist 命令,后面接 --name 或者 -n 選項來指定歌單的名字:

$ netease-dl playlist --name 美國Billboard周榜
+----------+------------------------------------+
| Sequence |                Name                |
+----------+------------------------------------+
|    1     |       美國billboard周榜Top50        |
|    2     |       2016美國Billboard周榜         |
|    3     |         美國billboard周榜           |
+----------+------------------------------------+
Select one playlist [1]:
Downlaoding Shape of You 3611kb  [####################################]  100%
Downlaoding Bad and Boujee 5227kb  [####################################]  100%
Downlaoding Thats What I Like 3230kb  [####################################]  100%
...
Cost 152s

下載指定用戶的公開歌單

> netease-dl user --name 子文歇
+----------+--------------------------------------+
| Sequence |                 Name                 |
+----------+--------------------------------------+
|    1     |            子文歇喜歡的音樂             |
...
+----------+--------------------------------------+
Select one playlist [1]:
...

下載個人收藏以及創建的歌單

登錄之后可以下載自己的所有歌單包括私密的歌單,以后一段之間之內如果沒有修改過密碼就不需要重新登錄了:

$ netease-dl me
Please enter your email or phone number: ziwenxiecat@163.com
Please enter your password:
+----------+--------------------------------------+
| Sequence |                 Name                 |
+----------+--------------------------------------+
|    1     |            子文歇喜歡的音樂             |
|    2     |            子文歇收藏的音樂             |
...
+----------+--------------------------------------+
Select one playlist [1]:
...

如果要換一個帳號或者登錄密碼修改了,使用 --again 或者 -a 選項重新登錄:

$ netease-dl --again me

 

 

 本文由用戶 fvbd8769 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!