Skip to main content

NeteaseCloudMusic APIs for Python 3.x 适用于 Python 3 的网易云音乐 API

Project description

PyNCM

NeteaseCloudMusic APIs for Python 3.x 适用于 Python 3 的网易云音乐 API

安装

`pip install pyncm`

直接使用

API 可以通过命令行直接访问,请参照下列命令输出进行操作 python -m pyncm -h

命令行使用说明

配置

  • pyncm config 可以将输入的参数存储在 ~/.pyncm 中,一劳永逸 python -m pyncm config --phone [your phone number] --password [your password] --output Downloads --clear-temp --quality lossless --logging-level 30
    • 解释 --phone --password 登录令牌;将会以 cookie 的形式被保存 --output 输出文件夹 --clear-temp 自动清除下载临时文件 --quality 下载质量 --logging-level 日志过滤等级
    • 优先级: 若在使用中设置了其他参数,命令行的参数会作为该会话的设置

使用

下载歌曲

pyncm song --id [歌曲 ID]

下载歌单

pyncm playlist --id [歌单 ID]

下载专辑

pyncm album --id [专辑 ID]

关于 ID

可通过网易云音乐的“分享链接”功能取得 如 https://music.163.com/playlist?id=3199245372&userid=315542615,该ID即为3199245372 其他功能详见 pyncm --help

Python 使用示例

from pyncm import NeteaseCloudMusic
# 导入核心包
NCM = NeteaseCloudMusic()
# 获取歌曲信息    
NCM.GetSongInfo(29732235)
`{'data': [{'id': 29732235, 'url': 'http://m701.music.126.net/20200313090222/479f50d5748625d59d405c7a219f3f5b/jdyyaac/040f/565c ...`    
# 获取歌曲详情
NCM.GetSongDetail(29732235)    
`{'songs': [{'name': 'Supernova', 'id': 29732235, 'pst': 0, 't': 0, 'ar': [{'id': 38725, 'name': 'Laszlo', 'tns': [], ...`
# 获取歌曲评论
NCM.GetSongComments(29732235)    
`{'isMusician': False, 'userId': -1, 'topComments': [], 'moreHot': True, 'hotComments': [{'user': {'locationInfo': None, 'liveIn ...`

详见 [工程进度](# 工程进度)

工程进度

ncm.ncm_core
功能 进度 函数名
明文登录(通过手机号及明文密码) NeteaseCloudMusic.UpdateLoginInfo
音频解析(无损解析需要以VIP特权登录) NeteaseCloudMusic.GetSongInfo
歌曲信息爬取 NeteaseCloudMusic.GetExtraSongInfoNeteaseCloudMusic.GetSongDetail
歌词解析 NeteaseCloudMusic.GetSongLyrics
歌单解析 NeteaseCloudMusic.GetPlaylistInfo
歌曲评论爬取 NeteaseCloudMusic.GetSongComments
专辑信息爬取 NeteaseCloudMusic.GetAlbumInfo
专辑评论爬取 NeteaseCloudMusic.GetAlbumComments
获取用户歌单 NeteaseCloudMusic.GetUserPlaylists
MV信息爬取 NeteaseCloudMusic.GetMVInfo
MV评论爬取 NeteaseCloudMusic.GetMVComments
ncm.ncm_func
功能 进度 函数名
下载歌曲并填入 META NCMFunctions.DownloadSongAudio
批量下载专辑歌曲并填入 META NCMFunctions.DownloadAllSongsInAlbumAndMerge
批量下载歌单歌曲并填入 META NCMFunctions.DownloadAllSongsInPlaylistAndMerge
下载歌词并转换为多语言LRC NCMFunctions.DownloadAndFormatLyrics

大部分包都已详尽地注释过,如有疑问请提 issue

依赖包

requests
pycryptodome
mutagen
colorama

安装依赖

pip install -r requirements.txt

衍生项目

[PyNCMd](https://github.com/greats3an/pyncmd) 

Project details


Release history Release notifications | RSS feed

This version

0.6.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyncm-0.6.2.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

pyncm-0.6.2-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file pyncm-0.6.2.tar.gz.

File metadata

  • Download URL: pyncm-0.6.2.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

File hashes

Hashes for pyncm-0.6.2.tar.gz
Algorithm Hash digest
SHA256 328d6e1dffa26fc1f230594a747b7d985fa5707d7b7daaaf55eb700b2a284baa
MD5 aa3ae1b3bd06c09ff72395e60fddb479
BLAKE2b-256 670fa317f2f6a40b0e95da5c7a8abb6545c2080af49ad7b6733269f3938437d8

See more details on using hashes here.

File details

Details for the file pyncm-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: pyncm-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

File hashes

Hashes for pyncm-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a114d1fdb5c1c24ca6c2f34dc83b8f8ad2de2adeffd978644dcf15dd42d3f410
MD5 13aaaf6d86ade1c7f73188768b539999
BLAKE2b-256 8a585325dbf79e263421cbdb54830027921e3f20a2138c8624e9f7ce7ae7009b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page