A Netsase music api
Project description
NeteaseMusicApi
一个网易云音乐的Api
食用使用教程
- 使用pip安装
pip install nemusicapi - 导入包,创建api
import nemusicapi api = Api()
- 然后就可以愉快的使用了
举个栗子例子
import os
from NEmusicApi import Api, QualityLevel
download_dir = './download'
cookie = '这里输入cookie'
api = Api(cookie=cookie, download_dir=download_dir)
def main(raw_song_name: str):
res = api.get_song_data(raw_song_name, limit=1)
if res is None:
return
song_id = list(res.keys())[0]
song_name = list(res.values())[0]
level = QualityLevel.hires
res = api.get_song_download_data(song_id, level=level)
if res is None:
return
song_url, song_type = res
file_name = f'{song_name}_{level.value}.{song_type.value}'
if not os.path.exists(os.path.join(download_dir, file_name)):
api.download_song(song_url, file_name)
if __name__ == '__main__':
main('这里输入歌曲名')
注意事项
- 创建api的时候,不输入
cookie或者cookie对应的账号没有vip,都有可能导致获取信息不完整,需要自己测试 - 创建api的时候,不输入
download_dir,在使用download_song方法的时候会raise异常
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nemusicapi-0.1.1a8.tar.gz
(8.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nemusicapi-0.1.1a8.tar.gz.
File metadata
- Download URL: nemusicapi-0.1.1a8.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f84620a65561ca7af50259568961da28f046ba9123c42bcb9380837c8359e82
|
|
| MD5 |
8605176af18140b0da18e1ffc480bed1
|
|
| BLAKE2b-256 |
c9c9821608cb547fcb2332804acbe982d5238c2bcfae3af4f5c264fb5cf92f9a
|
File details
Details for the file nemusicapi-0.1.1a8-py3-none-any.whl.
File metadata
- Download URL: nemusicapi-0.1.1a8-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e86051e39a261c389341500789c750ea9f55eb24fc8cb3ef4bf66e96b146069b
|
|
| MD5 |
1363c1924e06e845d0a8b8416d2b8a66
|
|
| BLAKE2b-256 |
cc3d32345d17fa5dcd06cc13cc9343eae4df3098b11e9c630924d847a5797ec6
|