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 可以通过命令行直接访问,请参照下列命令输出进行操作 pyncm -h

Python 使用示例

>>> from pyncm import NeteaseCloudMusic
# 导入核心包
>>> NCM = NeteaseCloudMusic()
>>> NCM.GetSongInfo(29732235)
# 获取歌曲信息
{'data': [{'id': 29732235, 'url': 'http://m701.music.126.net/20200313090222/479f50d5748625d59d405c7a219f3f5b/jdyyaac/040f/565c/0508/3ed3de2e4ea60ff52b6a2bc8a500f397.m4a', 'br': 96000, 'size': 3979843, 'md5': '3ed3de2e4ea60ff52b6a2bc8a500f397', 'code': 200, 'expi': 1200, 'type': 'm4a', 'gain': 0.0, 'fee': 8, 'uf': None, 'payed': 0, 'flag': 256, 'canExtend': False, 'freeTrialInfo': None, 'level': 'standard', 'encodeType': 'aac'}], 'code': 200}

>>> NCM.GetSongDetail(29732235)
# 获取歌曲详情
{'songs': [{'name': 'Supernova', 'id': 29732235, 'pst': 0, 't': 0, 'ar': [{'id': 38725, 'name': 'Laszlo', 'tns': [], 'alias': []}], 'alia': [], 'pop': 80.0, 'st': 0, 'rt': None, 'fee': 8, 'v': 13, 'crbt': None, 'cf': '', 'al': {'id': 3069044, 'name': 'Supernova', 'picUrl': 'https://p2.music.126.net/lX7Tq41nF4VkYYeW_Tz1Wg==/109951163311252223.jpg', 'tns': [], 'pic_str': '109951163311252223', 'pic': 109951163311252223}, 'dt': 326844, 'h': {'br': 320000, 'fid': 0, 'size': 13075897, 'vd': -32900.0}, 'm': {'br': 192000, 'fid': 0, 'size': 7845555, 'vd': -30500.0}, 'l': {'br': 128000, 'fid': 0, 'size': 5230385, 'vd': -29600.0}, 'a': None, 'cd': '1', 'no': 1, 'rtUrl': None, 'ftype': 0, 'rtUrls': [], 'djId': 0, 'copyright': 2, 's_id': 0, 'mark': 393216, 'originCoverType': 0, 'mst': 9, 'cp': 729016, 'mv': 447041, 'rtype': 0, 'rurl': None, 'publishTime': 1415577600000}], 'privileges': [{'id': 29732235, 'fee': 8, 'payed': 0, 'st': 0, 'pl': 128000, 'dl': 0, 'sp': 7, 'cp': 1, 'subp': 1, 'cs': False, 'maxbr': 999000, 'fl': 128000, 'toast': False, 'flag': 256, 'preSell': False, 'playMaxbr': 999000, 'downloadMaxbr': 999000}], 'code': 200}

>>> NCM.GetSongComments(29732235)
# 获取歌曲评论
{'isMusician': False, 'userId': -1, 'topComments': [], 'moreHot': True, 'hotComments': [{'user': {'locationInfo': None, 'liveInfo': None, 'expertTags': None, 'vipRights': None, 'vipType': 0, 'remarkName': None, 'userType': 0, 'nickname': 'MoeCity', 'experts': None, 'authStatus': 0, 'userId': 3445645, 'avatarUrl': 'https://p2.music.126.net/02UUU0SdRdIjhkx1OzXhTA==/19067730649247823.jpg'}...

工程进度

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.0.5

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.0.5.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

pyncm-0.0.5-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyncm-0.0.5.tar.gz
  • Upload date:
  • Size: 20.7 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.0.5.tar.gz
Algorithm Hash digest
SHA256 47a88ea215cc6185d76bd52b80db7004f5a4e9032317e52b1aa1a2d2fa86fa38
MD5 88d7bea95e2422d742d00181c509dff8
BLAKE2b-256 e37cd1da5c3a95ec8d963a166c06947cab7e63784184aa40a909e3093583955b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyncm-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 26.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.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 18c8fc8d62de80383dba0331f85fe96ee7d23aa5e280a7b9bb8b4211bdea5e92
MD5 afb3c19ec38c7127b404e3c7bb784621
BLAKE2b-256 6468ce3320bc0877ba3db5e7e173839c5635604e185182e41dcbd51b85de407c

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