一个网易云音乐的Api框架
Project description
NEmusicApi
一个网易云音乐的Api框架
本项目使用Apache2.0开源协议
- 使用本项目时要求保留原始版权和许可声明。同时向贡献者明确授予专利权。
- 使用者可以自由修改,进行商业使用,可以使用不同的条款分发,没有开源要求。
项目介绍
本项目基于网易云音乐API,实现了部分网易云音乐的功能,包括但不限于:
- 搜索歌曲
- 获取歌曲详情
- 获取歌曲url
- 下载歌曲
食用使用教程
- 使用pip安装
pip install nemusicapi - 导入包,创建api
from NEmusicApi import Api 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异常 <<<<<<< HEAD
=======
单元测试
poetry run python .\test\test_api.pypoetry run python .\test\test_base_api.py
45134f4e5be70b561d35210b77775909c598dbb2
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.1.tar.gz
(8.8 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.1.tar.gz.
File metadata
- Download URL: nemusicapi-0.1.1.tar.gz
- Upload date:
- Size: 8.8 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 |
0402635e232ae61922c548fe9060ec8569ca0d7738bbd8a61c350e61f198a6d5
|
|
| MD5 |
344b97f8ac128c167adba5f8cf050e3d
|
|
| BLAKE2b-256 |
eef807f836058c0425124583f5b283e6eeee87f893d563567bdbe94cdc3da25d
|
File details
Details for the file nemusicapi-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nemusicapi-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.0 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 |
17f44db390df186f0c2ed1830d05fa867072a5f3f12e5ee6b6c16ac47d088f66
|
|
| MD5 |
178122b6868926363af9664d6514aa2c
|
|
| BLAKE2b-256 |
2c8a19e1b097d74f4db0868897cdc8d89dfa2f2b6bbe640621f62a5a44e2bad3
|